diff --git a/README.md b/README.md index 1702a057a..17643ac94 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ and API server scaffolding (routing, validation, serialization) from api specifi Currently, [OpenAPI 3.0](https://swagger.io/specification/v3), [OpenAPI 3.1](https://swagger.io/specification/), and [TypeSpec](https://typespec.io/) are supported as input specifications. -With typescript templates for [koa](https://openapi-code-generator.nahkies.co.nz/guides/server-templates/typescript-koa), [fetch](https://openapi-code-generator.nahkies.co.nz/guides/client-templates/typescript-fetch), [axios](https://openapi-code-generator.nahkies.co.nz/guides/client-templates/typescript-axios), and [angular](https://openapi-code-generator.nahkies.co.nz/guides/client-templates/typescript-angular) currently available. +With typescript templates for [koa](https://openapi-code-generator.nahkies.co.nz/guides/server-templates/typescript-koa), [express](https://openapi-code-generator.nahkies.co.nz/guides/server-templates/typescript-express), [fetch](https://openapi-code-generator.nahkies.co.nz/guides/client-templates/typescript-fetch), [axios](https://openapi-code-generator.nahkies.co.nz/guides/client-templates/typescript-axios), and [angular](https://openapi-code-generator.nahkies.co.nz/guides/client-templates/typescript-angular) currently available. The [fetch](https://openapi-code-generator.nahkies.co.nz/guides/client-templates/typescript-fetch) and [axios](https://openapi-code-generator.nahkies.co.nz/guides/client-templates/typescript-axios) templates work great in conjunction with [react-query](https://tanstack.com/query/latest) @@ -39,6 +39,7 @@ The repository is structured as a mono repo of several npm packages that work to - [openapi-code-generator](./packages/openapi-code-generator) - [typescript-axios-runtime](./packages/typescript-axios-runtime) +- [typescript-express-runtime](./packages/typescript-express-runtime) - [typescript-fetch-runtime](./packages/typescript-fetch-runtime) - [typescript-koa-runtime](./packages/typescript-koa-runtime) diff --git a/e2e/scripts/generate.sh b/e2e/scripts/generate.sh index 98ba1a635..55b22e627 100755 --- a/e2e/scripts/generate.sh +++ b/e2e/scripts/generate.sh @@ -12,6 +12,14 @@ yarn openapi-code-generator \ --extract-inline-schemas \ --grouping-strategy first-tag +yarn openapi-code-generator \ + --input ./openapi.yaml \ + --output ./src/generated/server/express \ + --template typescript-express \ + --schema-builder "$SCHEMA_BUILDER" \ + --extract-inline-schemas \ + --grouping-strategy first-tag + yarn openapi-code-generator \ --input ./openapi.yaml \ --output ./src/generated/client/fetch \ diff --git a/e2e/src/express.entrypoint.ts b/e2e/src/express.entrypoint.ts new file mode 100644 index 000000000..3ea51b28e --- /dev/null +++ b/e2e/src/express.entrypoint.ts @@ -0,0 +1,57 @@ +import {type NextFunction, type Request, type Response, Router} from "express" +import {bootstrap} from "./generated/server/express" +import {createEscapeHatchesRouter} from "./routes/express/escape-hatches" +import {createRequestHeadersRouter} from "./routes/express/request-headers" +import {createValidationRouter} from "./routes/express/validation" +import {createErrorResponse} from "./shared" + +function createRouter() { + const router = Router() + + const requestHeadersRouter = createRequestHeadersRouter() + const validationRouter = createValidationRouter() + const escapeHatchesRouter = createEscapeHatchesRouter() + + router.use(requestHeadersRouter) + router.use(validationRouter) + router.use(escapeHatchesRouter) + + return router +} + +export async function startExpressServer() { + const {app, server, address} = await bootstrap({ + cors: { + credentials: true, + allowedHeaders: ["Authorization", "Content-Type"], + methods: ["GET", "OPTIONS"], + origin: "http://example.com", + }, + router: createRouter(), + notFoundHandler: (req: Request, res: Response, next: NextFunction) => { + res.status(404).json({code: 404, message: "route not found"}) + }, + errorHandler: ( + err: Error, + req: Request, + res: Response, + next: NextFunction, + ) => { + if (res.headersSent) { + return next(err) + } + + const {status, body} = createErrorResponse(err) + res.status(status).json(body) + }, + }) + + return {app, server, address} +} + +if (require.main === module) { + startExpressServer().catch((err) => { + console.error("fatal error", err) + process.exit(1) + }) +} diff --git a/e2e/src/generated/server/express/index.ts b/e2e/src/generated/server/express/index.ts new file mode 100644 index 000000000..0dd47a6ed --- /dev/null +++ b/e2e/src/generated/server/express/index.ts @@ -0,0 +1,13 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + ServerConfig, + startServer, +} from "@nahkies/typescript-express-runtime/server" + +export async function bootstrap(config: ServerConfig) { + // E2E Tests for @nahkies/openapi-code-generator + return startServer(config) +} diff --git a/e2e/src/generated/server/express/models.ts b/e2e/src/generated/server/express/models.ts new file mode 100644 index 000000000..a9a0b6096 --- /dev/null +++ b/e2e/src/generated/server/express/models.ts @@ -0,0 +1,46 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type t_Enumerations = { + colors: "red" | "green" | "blue" + starRatings: 1 | 2 | 3 +} + +export type t_RandomNumber = { + params?: + | { + forbidden?: number[] | undefined + max?: number | undefined + min?: number | undefined + } + | undefined + result?: number | undefined +} + +export type t_GetHeadersRequestRequestHeaderSchema = { + authorization?: string | undefined + "number-header"?: number | undefined + "route-level-header"?: string | undefined +} + +export type t_getHeadersRequestJson200Response = { + rawHeaders?: unknown | undefined + typedHeaders?: unknown | undefined +} + +export type t_getHeadersUndeclaredJson200Response = { + rawHeaders?: unknown | undefined + typedHeaders?: unknown | undefined +} + +export type t_GetValidationNumbersRandomNumberQuerySchema = { + forbidden?: number[] | undefined + max?: number | undefined + min?: number | undefined +} + +export type t_PostValidationEnumsRequestBodySchema = { + colors: "red" | "green" | "blue" + starRatings: 1 | 2 | 3 +} diff --git a/e2e/src/generated/server/express/routes/escape-hatches.ts b/e2e/src/generated/server/express/routes/escape-hatches.ts new file mode 100644 index 000000000..bd1e3a70d --- /dev/null +++ b/e2e/src/generated/server/express/routes/escape-hatches.ts @@ -0,0 +1,95 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { ExpressRuntimeError } from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + SkipResponse, + StatusCode, +} from "@nahkies/typescript-express-runtime/server" +import { responseValidationFactory } from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type GetEscapeHatchesPlainTextResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEscapeHatchesPlainText = ( + params: Params, + respond: GetEscapeHatchesPlainTextResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EscapeHatchesImplementation = { + getEscapeHatchesPlainText: GetEscapeHatchesPlainText +} + +export function createEscapeHatchesRouter( + implementation: EscapeHatchesImplementation, +): Router { + const router = Router() + + const getEscapeHatchesPlainTextResponseBodyValidator = + responseValidationFactory([["200", z.string()]], undefined) + + // getEscapeHatchesPlainText + router.get( + `/escape-hatches/plain-text`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEscapeHatchesPlainText(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getEscapeHatchesPlainTextResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export { createEscapeHatchesRouter as createRouter } +export type { EscapeHatchesImplementation as Implementation } diff --git a/e2e/src/generated/server/express/routes/request-headers.ts b/e2e/src/generated/server/express/routes/request-headers.ts new file mode 100644 index 000000000..94c72f597 --- /dev/null +++ b/e2e/src/generated/server/express/routes/request-headers.ts @@ -0,0 +1,194 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_GetHeadersRequestRequestHeaderSchema, + t_getHeadersRequestJson200Response, + t_getHeadersUndeclaredJson200Response, +} from "../models" +import { + s_getHeadersRequestJson200Response, + s_getHeadersUndeclaredJson200Response, +} from "../schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + SkipResponse, + StatusCode, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type GetHeadersUndeclaredResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetHeadersUndeclared = ( + params: Params, + respond: GetHeadersUndeclaredResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetHeadersRequestResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetHeadersRequest = ( + params: Params, + respond: GetHeadersRequestResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type RequestHeadersImplementation = { + getHeadersUndeclared: GetHeadersUndeclared + getHeadersRequest: GetHeadersRequest +} + +export function createRequestHeadersRouter( + implementation: RequestHeadersImplementation, +): Router { + const router = Router() + + const getHeadersUndeclaredResponseBodyValidator = responseValidationFactory( + [["200", s_getHeadersUndeclaredJson200Response]], + undefined, + ) + + // getHeadersUndeclared + router.get( + `/headers/undeclared`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getHeadersUndeclared(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getHeadersUndeclaredResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getHeadersRequestRequestHeaderSchema = z.object({ + "route-level-header": z.string().optional(), + "number-header": z.coerce.number().optional(), + authorization: z.string().optional(), + }) + + const getHeadersRequestResponseBodyValidator = responseValidationFactory( + [["200", s_getHeadersRequestJson200Response]], + undefined, + ) + + // getHeadersRequest + router.get( + `/headers/request`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: parseRequestInput( + getHeadersRequestRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getHeadersRequest(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getHeadersRequestResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export { createRequestHeadersRouter as createRouter } +export type { RequestHeadersImplementation as Implementation } diff --git a/e2e/src/generated/server/express/routes/validation.ts b/e2e/src/generated/server/express/routes/validation.ts new file mode 100644 index 000000000..6c35c1879 --- /dev/null +++ b/e2e/src/generated/server/express/routes/validation.ts @@ -0,0 +1,340 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Enumerations, + t_GetValidationNumbersRandomNumberQuerySchema, + t_PostValidationEnumsRequestBodySchema, + t_RandomNumber, +} from "../models" +import { s_Enumerations, s_RandomNumber } from "../schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + SkipResponse, + StatusCode, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type GetValidationNumbersRandomNumberResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetValidationNumbersRandomNumber = ( + params: Params< + void, + t_GetValidationNumbersRandomNumberQuerySchema, + void, + void + >, + respond: GetValidationNumbersRandomNumberResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostValidationEnumsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostValidationEnums = ( + params: Params, + respond: PostValidationEnumsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetResponses500Responder = { + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetResponses500 = ( + params: Params, + respond: GetResponses500Responder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetResponsesEmptyResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetResponsesEmpty = ( + params: Params, + respond: GetResponsesEmptyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ValidationImplementation = { + getValidationNumbersRandomNumber: GetValidationNumbersRandomNumber + postValidationEnums: PostValidationEnums + getResponses500: GetResponses500 + getResponsesEmpty: GetResponsesEmpty +} + +export function createValidationRouter( + implementation: ValidationImplementation, +): Router { + const router = Router() + + const getValidationNumbersRandomNumberQuerySchema = z.object({ + max: z.coerce.number().min(1).optional().default(10), + min: z.coerce.number().min(0).optional().default(0), + forbidden: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.coerce.number()), + ) + .optional(), + }) + + const getValidationNumbersRandomNumberResponseBodyValidator = + responseValidationFactory([["200", s_RandomNumber]], undefined) + + // getValidationNumbersRandomNumber + router.get( + `/validation/numbers/random-number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getValidationNumbersRandomNumberQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getValidationNumbersRandomNumber(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getValidationNumbersRandomNumberResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postValidationEnumsRequestBodySchema = s_Enumerations + + const postValidationEnumsResponseBodyValidator = responseValidationFactory( + [["200", s_Enumerations]], + undefined, + ) + + // postValidationEnums + router.post( + `/validation/enums`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postValidationEnumsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postValidationEnums(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postValidationEnumsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getResponses500ResponseBodyValidator = responseValidationFactory( + [["500", z.undefined()]], + undefined, + ) + + // getResponses500 + router.get( + `/responses/500`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getResponses500(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getResponses500ResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getResponsesEmptyResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // getResponsesEmpty + router.get( + `/responses/empty`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getResponsesEmpty(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getResponsesEmptyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export { createValidationRouter as createRouter } +export type { ValidationImplementation as Implementation } diff --git a/e2e/src/generated/server/express/schemas.ts b/e2e/src/generated/server/express/schemas.ts new file mode 100644 index 000000000..3e66a6e7f --- /dev/null +++ b/e2e/src/generated/server/express/schemas.ts @@ -0,0 +1,31 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { z } from "zod" + +export const s_Enumerations = z.object({ + colors: z.enum(["red", "green", "blue"]), + starRatings: z.union([z.literal(1), z.literal(2), z.literal(3)]), +}) + +export const s_RandomNumber = z.object({ + result: z.coerce.number().optional(), + params: z + .object({ + min: z.coerce.number().optional(), + max: z.coerce.number().optional(), + forbidden: z.array(z.coerce.number()).optional(), + }) + .optional(), +}) + +export const s_getHeadersUndeclaredJson200Response = z.object({ + rawHeaders: z.unknown().optional(), + typedHeaders: z.unknown().optional(), +}) + +export const s_getHeadersRequestJson200Response = z.object({ + rawHeaders: z.unknown().optional(), + typedHeaders: z.unknown().optional(), +}) diff --git a/e2e/src/index.ts b/e2e/src/index.ts index e908908f0..c2c6a1842 100644 --- a/e2e/src/index.ts +++ b/e2e/src/index.ts @@ -1,3 +1,4 @@ +import {startExpressServer} from "./express.entrypoint" import {startKoaServer} from "./koa.entrypoint" type StartServerFunction = { @@ -13,4 +14,8 @@ export const startServerFunctions = [ name: "koa", startServer: startKoaServer, }, + { + name: "express", + startServer: startExpressServer, + }, ] satisfies StartServerFunction[] diff --git a/e2e/src/routes/express/escape-hatches.ts b/e2e/src/routes/express/escape-hatches.ts new file mode 100644 index 000000000..139eff497 --- /dev/null +++ b/e2e/src/routes/express/escape-hatches.ts @@ -0,0 +1,26 @@ +import {SkipResponse} from "@nahkies/typescript-express-runtime/server" +import { + type GetEscapeHatchesPlainText, + createRouter, +} from "../../generated/server/express/routes/escape-hatches" + +const getEscapeHatchesPlainText: GetEscapeHatchesPlainText = async ( + _, + respond, + req, + res, +) => { + res.setHeader("x-ratelimit-remaining", "100") + res.status(200).send("Plain text response") + + // TODO: the typescript types are correct, but gets mangled by json serialization + // return respond.with200().body("Plain text response") + + return SkipResponse +} + +export function createEscapeHatchesRouter() { + return createRouter({ + getEscapeHatchesPlainText, + }) +} diff --git a/e2e/src/routes/express/request-headers.ts b/e2e/src/routes/express/request-headers.ts new file mode 100644 index 000000000..329758866 --- /dev/null +++ b/e2e/src/routes/express/request-headers.ts @@ -0,0 +1,32 @@ +import { + type GetHeadersRequest, + type GetHeadersUndeclared, + createRouter, +} from "../../generated/server/express/routes/request-headers" + +const getHeadersUndeclared: GetHeadersUndeclared = async ( + {headers}, + respond, + req, +) => { + return respond + .with200() + .body({typedHeaders: headers, rawHeaders: req.headers}) +} + +const getHeadersRequest: GetHeadersRequest = async ( + {headers}, + respond, + req, +) => { + return respond + .with200() + .body({typedHeaders: headers, rawHeaders: req.headers}) +} + +export function createRequestHeadersRouter() { + return createRouter({ + getHeadersUndeclared, + getHeadersRequest, + }) +} diff --git a/e2e/src/routes/express/validation.ts b/e2e/src/routes/express/validation.ts new file mode 100644 index 000000000..42e2b2187 --- /dev/null +++ b/e2e/src/routes/express/validation.ts @@ -0,0 +1,55 @@ +import type {ExpressRuntimeResponse} from "@nahkies/typescript-express-runtime/server" +import { + type GetResponses500, + type GetResponsesEmpty, + type GetValidationNumbersRandomNumber, + type PostValidationEnums, + createRouter, +} from "../../generated/server/express/routes/validation" + +const postValidationEnums: PostValidationEnums = async ({body}, respond) => { + return respond.with200().body(body) +} + +const getValidationNumbersRandomNumber: GetValidationNumbersRandomNumber = + async ({query}, respond) => { + const max = query.max ?? 10 + const min = query.min ?? 0 + const forbidden = new Set(query.forbidden ?? []) + + const maxAttempts = 10 + for (let i = 0; i < maxAttempts; i++) { + const result = Math.random() * (max - min) + min + + if (!forbidden.has(result)) { + const response = { + result, + params: { + min, + max, + forbidden: Array.from(forbidden), + }, + } + return respond.with200().body(response) + } + } + + return respond.withStatus(404) + } + +const getResponsesEmpty: GetResponsesEmpty = async (_, respond) => { + return respond.with204() +} + +const getResponses500: GetResponses500 = async () => { + throw new Error("something went wrong") +} + +export function createValidationRouter() { + return createRouter({ + postValidationEnums, + getValidationNumbersRandomNumber, + getResponsesEmpty, + getResponses500, + }) +} diff --git a/e2e/src/shared.ts b/e2e/src/shared.ts index 461769fd2..896b63b05 100644 --- a/e2e/src/shared.ts +++ b/e2e/src/shared.ts @@ -1,7 +1,12 @@ +import {ExpressRuntimeError} from "@nahkies/typescript-express-runtime/errors" import {KoaRuntimeError} from "@nahkies/typescript-koa-runtime/errors" export function createErrorResponse(err: unknown) { - if (KoaRuntimeError.isKoaError(err) && err.phase !== "request_handler") { + if ( + (KoaRuntimeError.isKoaError(err) || + ExpressRuntimeError.isExpressError(err)) && + err.phase !== "request_handler" + ) { return { status: 400, body: { diff --git a/integration-tests/typescript-express/package.json b/integration-tests/typescript-express/package.json new file mode 100644 index 000000000..ec26994e6 --- /dev/null +++ b/integration-tests/typescript-express/package.json @@ -0,0 +1,22 @@ +{ + "name": "typescript-express", + "version": "0.0.1", + "main": "./dist/index.js", + "author": "Michael Nahkies", + "license": "MIT", + "private": true, + "scripts": { + "clean": "rm -rf ./dist && rm -rf ./src/generated", + "validate": "tsc -p ./tsconfig.json" + }, + "dependencies": { + "@nahkies/typescript-express-runtime": "*", + "express": "^5.1.0", + "joi": "^17.13.3", + "zod": "^3.24.3" + }, + "devDependencies": { + "@types/express": "^5.0.1", + "typescript": "~5.8.3" + } +} diff --git a/integration-tests/typescript-express/src/generated/api.github.com.yaml/generated.ts b/integration-tests/typescript-express/src/generated/api.github.com.yaml/generated.ts new file mode 100644 index 000000000..1b75b1a68 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/api.github.com.yaml/generated.ts @@ -0,0 +1,107272 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + EmptyObject, + t_ActionsAddCustomLabelsToSelfHostedRunnerForOrgParamSchema, + t_ActionsAddCustomLabelsToSelfHostedRunnerForOrgRequestBodySchema, + t_ActionsAddCustomLabelsToSelfHostedRunnerForRepoParamSchema, + t_ActionsAddCustomLabelsToSelfHostedRunnerForRepoRequestBodySchema, + t_ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + t_ActionsAddSelectedRepoToOrgSecretParamSchema, + t_ActionsAddSelectedRepoToOrgVariableParamSchema, + t_ActionsAddSelfHostedRunnerToGroupForOrgParamSchema, + t_ActionsApproveWorkflowRunParamSchema, + t_ActionsCancelWorkflowRunParamSchema, + t_ActionsCreateEnvironmentVariableParamSchema, + t_ActionsCreateEnvironmentVariableRequestBodySchema, + t_ActionsCreateHostedRunnerForOrgParamSchema, + t_ActionsCreateHostedRunnerForOrgRequestBodySchema, + t_ActionsCreateOrUpdateEnvironmentSecretParamSchema, + t_ActionsCreateOrUpdateEnvironmentSecretRequestBodySchema, + t_ActionsCreateOrUpdateOrgSecretParamSchema, + t_ActionsCreateOrUpdateOrgSecretRequestBodySchema, + t_ActionsCreateOrUpdateRepoSecretParamSchema, + t_ActionsCreateOrUpdateRepoSecretRequestBodySchema, + t_ActionsCreateOrgVariableParamSchema, + t_ActionsCreateOrgVariableRequestBodySchema, + t_ActionsCreateRegistrationTokenForOrgParamSchema, + t_ActionsCreateRegistrationTokenForRepoParamSchema, + t_ActionsCreateRemoveTokenForOrgParamSchema, + t_ActionsCreateRemoveTokenForRepoParamSchema, + t_ActionsCreateRepoVariableParamSchema, + t_ActionsCreateRepoVariableRequestBodySchema, + t_ActionsCreateSelfHostedRunnerGroupForOrgParamSchema, + t_ActionsCreateSelfHostedRunnerGroupForOrgRequestBodySchema, + t_ActionsCreateWorkflowDispatchParamSchema, + t_ActionsCreateWorkflowDispatchRequestBodySchema, + t_ActionsDeleteActionsCacheByIdParamSchema, + t_ActionsDeleteActionsCacheByKeyParamSchema, + t_ActionsDeleteActionsCacheByKeyQuerySchema, + t_ActionsDeleteArtifactParamSchema, + t_ActionsDeleteEnvironmentSecretParamSchema, + t_ActionsDeleteEnvironmentVariableParamSchema, + t_ActionsDeleteHostedRunnerForOrgParamSchema, + t_ActionsDeleteOrgSecretParamSchema, + t_ActionsDeleteOrgVariableParamSchema, + t_ActionsDeleteRepoSecretParamSchema, + t_ActionsDeleteRepoVariableParamSchema, + t_ActionsDeleteSelfHostedRunnerFromOrgParamSchema, + t_ActionsDeleteSelfHostedRunnerFromRepoParamSchema, + t_ActionsDeleteSelfHostedRunnerGroupFromOrgParamSchema, + t_ActionsDeleteWorkflowRunLogsParamSchema, + t_ActionsDeleteWorkflowRunParamSchema, + t_ActionsDisableSelectedRepositoryGithubActionsOrganizationParamSchema, + t_ActionsDisableWorkflowParamSchema, + t_ActionsDownloadArtifactParamSchema, + t_ActionsDownloadJobLogsForWorkflowRunParamSchema, + t_ActionsDownloadWorkflowRunAttemptLogsParamSchema, + t_ActionsDownloadWorkflowRunLogsParamSchema, + t_ActionsEnableSelectedRepositoryGithubActionsOrganizationParamSchema, + t_ActionsEnableWorkflowParamSchema, + t_ActionsForceCancelWorkflowRunParamSchema, + t_ActionsGenerateRunnerJitconfigForOrgParamSchema, + t_ActionsGenerateRunnerJitconfigForOrgRequestBodySchema, + t_ActionsGenerateRunnerJitconfigForRepoParamSchema, + t_ActionsGenerateRunnerJitconfigForRepoRequestBodySchema, + t_ActionsGetActionsCacheListParamSchema, + t_ActionsGetActionsCacheListQuerySchema, + t_ActionsGetActionsCacheUsageByRepoForOrgParamSchema, + t_ActionsGetActionsCacheUsageByRepoForOrgQuerySchema, + t_ActionsGetActionsCacheUsageForOrgParamSchema, + t_ActionsGetActionsCacheUsageParamSchema, + t_ActionsGetAllowedActionsOrganizationParamSchema, + t_ActionsGetAllowedActionsRepositoryParamSchema, + t_ActionsGetArtifactParamSchema, + t_ActionsGetCustomOidcSubClaimForRepoParamSchema, + t_ActionsGetEnvironmentPublicKeyParamSchema, + t_ActionsGetEnvironmentSecretParamSchema, + t_ActionsGetEnvironmentVariableParamSchema, + t_ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema, + t_ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema, + t_ActionsGetGithubActionsPermissionsOrganizationParamSchema, + t_ActionsGetGithubActionsPermissionsRepositoryParamSchema, + t_ActionsGetHostedRunnerForOrgParamSchema, + t_ActionsGetHostedRunnersGithubOwnedImagesForOrgParamSchema, + t_ActionsGetHostedRunnersLimitsForOrgParamSchema, + t_ActionsGetHostedRunnersMachineSpecsForOrgParamSchema, + t_ActionsGetHostedRunnersPartnerImagesForOrgParamSchema, + t_ActionsGetHostedRunnersPlatformsForOrgParamSchema, + t_ActionsGetJobForWorkflowRunParamSchema, + t_ActionsGetOrgPublicKeyParamSchema, + t_ActionsGetOrgSecretParamSchema, + t_ActionsGetOrgVariableParamSchema, + t_ActionsGetPendingDeploymentsForRunParamSchema, + t_ActionsGetRepoPublicKeyParamSchema, + t_ActionsGetRepoSecretParamSchema, + t_ActionsGetRepoVariableParamSchema, + t_ActionsGetReviewsForRunParamSchema, + t_ActionsGetSelfHostedRunnerForOrgParamSchema, + t_ActionsGetSelfHostedRunnerForRepoParamSchema, + t_ActionsGetSelfHostedRunnerGroupForOrgParamSchema, + t_ActionsGetWorkflowAccessToRepositoryParamSchema, + t_ActionsGetWorkflowParamSchema, + t_ActionsGetWorkflowRunAttemptParamSchema, + t_ActionsGetWorkflowRunAttemptQuerySchema, + t_ActionsGetWorkflowRunParamSchema, + t_ActionsGetWorkflowRunQuerySchema, + t_ActionsGetWorkflowRunUsageParamSchema, + t_ActionsGetWorkflowUsageParamSchema, + t_ActionsListArtifactsForRepoParamSchema, + t_ActionsListArtifactsForRepoQuerySchema, + t_ActionsListEnvironmentSecretsParamSchema, + t_ActionsListEnvironmentSecretsQuerySchema, + t_ActionsListEnvironmentVariablesParamSchema, + t_ActionsListEnvironmentVariablesQuerySchema, + t_ActionsListGithubHostedRunnersInGroupForOrgParamSchema, + t_ActionsListGithubHostedRunnersInGroupForOrgQuerySchema, + t_ActionsListHostedRunnersForOrgParamSchema, + t_ActionsListHostedRunnersForOrgQuerySchema, + t_ActionsListJobsForWorkflowRunAttemptParamSchema, + t_ActionsListJobsForWorkflowRunAttemptQuerySchema, + t_ActionsListJobsForWorkflowRunParamSchema, + t_ActionsListJobsForWorkflowRunQuerySchema, + t_ActionsListLabelsForSelfHostedRunnerForOrgParamSchema, + t_ActionsListLabelsForSelfHostedRunnerForRepoParamSchema, + t_ActionsListOrgSecretsParamSchema, + t_ActionsListOrgSecretsQuerySchema, + t_ActionsListOrgVariablesParamSchema, + t_ActionsListOrgVariablesQuerySchema, + t_ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + t_ActionsListRepoAccessToSelfHostedRunnerGroupInOrgQuerySchema, + t_ActionsListRepoOrganizationSecretsParamSchema, + t_ActionsListRepoOrganizationSecretsQuerySchema, + t_ActionsListRepoOrganizationVariablesParamSchema, + t_ActionsListRepoOrganizationVariablesQuerySchema, + t_ActionsListRepoSecretsParamSchema, + t_ActionsListRepoSecretsQuerySchema, + t_ActionsListRepoVariablesParamSchema, + t_ActionsListRepoVariablesQuerySchema, + t_ActionsListRepoWorkflowsParamSchema, + t_ActionsListRepoWorkflowsQuerySchema, + t_ActionsListRunnerApplicationsForOrgParamSchema, + t_ActionsListRunnerApplicationsForRepoParamSchema, + t_ActionsListSelectedReposForOrgSecretParamSchema, + t_ActionsListSelectedReposForOrgSecretQuerySchema, + t_ActionsListSelectedReposForOrgVariableParamSchema, + t_ActionsListSelectedReposForOrgVariableQuerySchema, + t_ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema, + t_ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationQuerySchema, + t_ActionsListSelfHostedRunnerGroupsForOrgParamSchema, + t_ActionsListSelfHostedRunnerGroupsForOrgQuerySchema, + t_ActionsListSelfHostedRunnersForOrgParamSchema, + t_ActionsListSelfHostedRunnersForOrgQuerySchema, + t_ActionsListSelfHostedRunnersForRepoParamSchema, + t_ActionsListSelfHostedRunnersForRepoQuerySchema, + t_ActionsListSelfHostedRunnersInGroupForOrgParamSchema, + t_ActionsListSelfHostedRunnersInGroupForOrgQuerySchema, + t_ActionsListWorkflowRunArtifactsParamSchema, + t_ActionsListWorkflowRunArtifactsQuerySchema, + t_ActionsListWorkflowRunsForRepoParamSchema, + t_ActionsListWorkflowRunsForRepoQuerySchema, + t_ActionsListWorkflowRunsParamSchema, + t_ActionsListWorkflowRunsQuerySchema, + t_ActionsReRunJobForWorkflowRunParamSchema, + t_ActionsReRunJobForWorkflowRunRequestBodySchema, + t_ActionsReRunWorkflowFailedJobsParamSchema, + t_ActionsReRunWorkflowFailedJobsRequestBodySchema, + t_ActionsReRunWorkflowParamSchema, + t_ActionsReRunWorkflowRequestBodySchema, + t_ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgParamSchema, + t_ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoParamSchema, + t_ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgParamSchema, + t_ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoParamSchema, + t_ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + t_ActionsRemoveSelectedRepoFromOrgSecretParamSchema, + t_ActionsRemoveSelectedRepoFromOrgVariableParamSchema, + t_ActionsRemoveSelfHostedRunnerFromGroupForOrgParamSchema, + t_ActionsReviewCustomGatesForRunParamSchema, + t_ActionsReviewCustomGatesForRunRequestBodySchema, + t_ActionsReviewPendingDeploymentsForRunParamSchema, + t_ActionsReviewPendingDeploymentsForRunRequestBodySchema, + t_ActionsSetAllowedActionsOrganizationParamSchema, + t_ActionsSetAllowedActionsOrganizationRequestBodySchema, + t_ActionsSetAllowedActionsRepositoryParamSchema, + t_ActionsSetAllowedActionsRepositoryRequestBodySchema, + t_ActionsSetCustomLabelsForSelfHostedRunnerForOrgParamSchema, + t_ActionsSetCustomLabelsForSelfHostedRunnerForOrgRequestBodySchema, + t_ActionsSetCustomLabelsForSelfHostedRunnerForRepoParamSchema, + t_ActionsSetCustomLabelsForSelfHostedRunnerForRepoRequestBodySchema, + t_ActionsSetCustomOidcSubClaimForRepoParamSchema, + t_ActionsSetCustomOidcSubClaimForRepoRequestBodySchema, + t_ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema, + t_ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationRequestBodySchema, + t_ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema, + t_ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryRequestBodySchema, + t_ActionsSetGithubActionsPermissionsOrganizationParamSchema, + t_ActionsSetGithubActionsPermissionsOrganizationRequestBodySchema, + t_ActionsSetGithubActionsPermissionsRepositoryParamSchema, + t_ActionsSetGithubActionsPermissionsRepositoryRequestBodySchema, + t_ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + t_ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgRequestBodySchema, + t_ActionsSetSelectedReposForOrgSecretParamSchema, + t_ActionsSetSelectedReposForOrgSecretRequestBodySchema, + t_ActionsSetSelectedReposForOrgVariableParamSchema, + t_ActionsSetSelectedReposForOrgVariableRequestBodySchema, + t_ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema, + t_ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationRequestBodySchema, + t_ActionsSetSelfHostedRunnersInGroupForOrgParamSchema, + t_ActionsSetSelfHostedRunnersInGroupForOrgRequestBodySchema, + t_ActionsSetWorkflowAccessToRepositoryParamSchema, + t_ActionsSetWorkflowAccessToRepositoryRequestBodySchema, + t_ActionsUpdateEnvironmentVariableParamSchema, + t_ActionsUpdateEnvironmentVariableRequestBodySchema, + t_ActionsUpdateHostedRunnerForOrgParamSchema, + t_ActionsUpdateHostedRunnerForOrgRequestBodySchema, + t_ActionsUpdateOrgVariableParamSchema, + t_ActionsUpdateOrgVariableRequestBodySchema, + t_ActionsUpdateRepoVariableParamSchema, + t_ActionsUpdateRepoVariableRequestBodySchema, + t_ActionsUpdateSelfHostedRunnerGroupForOrgParamSchema, + t_ActionsUpdateSelfHostedRunnerGroupForOrgRequestBodySchema, + t_ActivityCheckRepoIsStarredByAuthenticatedUserParamSchema, + t_ActivityDeleteRepoSubscriptionParamSchema, + t_ActivityDeleteThreadSubscriptionParamSchema, + t_ActivityGetRepoSubscriptionParamSchema, + t_ActivityGetThreadParamSchema, + t_ActivityGetThreadSubscriptionForAuthenticatedUserParamSchema, + t_ActivityListEventsForAuthenticatedUserParamSchema, + t_ActivityListEventsForAuthenticatedUserQuerySchema, + t_ActivityListNotificationsForAuthenticatedUserQuerySchema, + t_ActivityListOrgEventsForAuthenticatedUserParamSchema, + t_ActivityListOrgEventsForAuthenticatedUserQuerySchema, + t_ActivityListPublicEventsForRepoNetworkParamSchema, + t_ActivityListPublicEventsForRepoNetworkQuerySchema, + t_ActivityListPublicEventsForUserParamSchema, + t_ActivityListPublicEventsForUserQuerySchema, + t_ActivityListPublicEventsQuerySchema, + t_ActivityListPublicOrgEventsParamSchema, + t_ActivityListPublicOrgEventsQuerySchema, + t_ActivityListReceivedEventsForUserParamSchema, + t_ActivityListReceivedEventsForUserQuerySchema, + t_ActivityListReceivedPublicEventsForUserParamSchema, + t_ActivityListReceivedPublicEventsForUserQuerySchema, + t_ActivityListRepoEventsParamSchema, + t_ActivityListRepoEventsQuerySchema, + t_ActivityListRepoNotificationsForAuthenticatedUserParamSchema, + t_ActivityListRepoNotificationsForAuthenticatedUserQuerySchema, + t_ActivityListReposStarredByAuthenticatedUserQuerySchema, + t_ActivityListReposStarredByUserParamSchema, + t_ActivityListReposStarredByUserQuerySchema, + t_ActivityListReposWatchedByUserParamSchema, + t_ActivityListReposWatchedByUserQuerySchema, + t_ActivityListStargazersForRepoParamSchema, + t_ActivityListStargazersForRepoQuerySchema, + t_ActivityListWatchedReposForAuthenticatedUserQuerySchema, + t_ActivityListWatchersForRepoParamSchema, + t_ActivityListWatchersForRepoQuerySchema, + t_ActivityMarkNotificationsAsReadRequestBodySchema, + t_ActivityMarkRepoNotificationsAsReadParamSchema, + t_ActivityMarkRepoNotificationsAsReadRequestBodySchema, + t_ActivityMarkThreadAsDoneParamSchema, + t_ActivityMarkThreadAsReadParamSchema, + t_ActivitySetRepoSubscriptionParamSchema, + t_ActivitySetRepoSubscriptionRequestBodySchema, + t_ActivitySetThreadSubscriptionParamSchema, + t_ActivitySetThreadSubscriptionRequestBodySchema, + t_ActivityStarRepoForAuthenticatedUserParamSchema, + t_ActivityUnstarRepoForAuthenticatedUserParamSchema, + t_ApiInsightsGetRouteStatsByActorParamSchema, + t_ApiInsightsGetRouteStatsByActorQuerySchema, + t_ApiInsightsGetSubjectStatsParamSchema, + t_ApiInsightsGetSubjectStatsQuerySchema, + t_ApiInsightsGetSummaryStatsByActorParamSchema, + t_ApiInsightsGetSummaryStatsByActorQuerySchema, + t_ApiInsightsGetSummaryStatsByUserParamSchema, + t_ApiInsightsGetSummaryStatsByUserQuerySchema, + t_ApiInsightsGetSummaryStatsParamSchema, + t_ApiInsightsGetSummaryStatsQuerySchema, + t_ApiInsightsGetTimeStatsByActorParamSchema, + t_ApiInsightsGetTimeStatsByActorQuerySchema, + t_ApiInsightsGetTimeStatsByUserParamSchema, + t_ApiInsightsGetTimeStatsByUserQuerySchema, + t_ApiInsightsGetTimeStatsParamSchema, + t_ApiInsightsGetTimeStatsQuerySchema, + t_ApiInsightsGetUserStatsParamSchema, + t_ApiInsightsGetUserStatsQuerySchema, + t_AppsAddRepoToInstallationForAuthenticatedUserParamSchema, + t_AppsCheckTokenParamSchema, + t_AppsCheckTokenRequestBodySchema, + t_AppsCreateFromManifestParamSchema, + t_AppsCreateInstallationAccessTokenParamSchema, + t_AppsCreateInstallationAccessTokenRequestBodySchema, + t_AppsDeleteAuthorizationParamSchema, + t_AppsDeleteAuthorizationRequestBodySchema, + t_AppsDeleteInstallationParamSchema, + t_AppsDeleteTokenParamSchema, + t_AppsDeleteTokenRequestBodySchema, + t_AppsGetBySlugParamSchema, + t_AppsGetInstallationParamSchema, + t_AppsGetOrgInstallationParamSchema, + t_AppsGetRepoInstallationParamSchema, + t_AppsGetSubscriptionPlanForAccountParamSchema, + t_AppsGetSubscriptionPlanForAccountStubbedParamSchema, + t_AppsGetUserInstallationParamSchema, + t_AppsGetWebhookDeliveryParamSchema, + t_AppsListAccountsForPlanParamSchema, + t_AppsListAccountsForPlanQuerySchema, + t_AppsListAccountsForPlanStubbedParamSchema, + t_AppsListAccountsForPlanStubbedQuerySchema, + t_AppsListInstallationReposForAuthenticatedUserParamSchema, + t_AppsListInstallationReposForAuthenticatedUserQuerySchema, + t_AppsListInstallationRequestsForAuthenticatedAppQuerySchema, + t_AppsListInstallationsForAuthenticatedUserQuerySchema, + t_AppsListInstallationsQuerySchema, + t_AppsListPlansQuerySchema, + t_AppsListPlansStubbedQuerySchema, + t_AppsListReposAccessibleToInstallationQuerySchema, + t_AppsListSubscriptionsForAuthenticatedUserQuerySchema, + t_AppsListSubscriptionsForAuthenticatedUserStubbedQuerySchema, + t_AppsListWebhookDeliveriesQuerySchema, + t_AppsRedeliverWebhookDeliveryParamSchema, + t_AppsRemoveRepoFromInstallationForAuthenticatedUserParamSchema, + t_AppsResetTokenParamSchema, + t_AppsResetTokenRequestBodySchema, + t_AppsScopeTokenParamSchema, + t_AppsScopeTokenRequestBodySchema, + t_AppsSuspendInstallationParamSchema, + t_AppsUnsuspendInstallationParamSchema, + t_AppsUpdateWebhookConfigForAppRequestBodySchema, + t_BillingGetGithubActionsBillingOrgParamSchema, + t_BillingGetGithubActionsBillingUserParamSchema, + t_BillingGetGithubBillingUsageReportOrgParamSchema, + t_BillingGetGithubBillingUsageReportOrgQuerySchema, + t_BillingGetGithubPackagesBillingOrgParamSchema, + t_BillingGetGithubPackagesBillingUserParamSchema, + t_BillingGetSharedStorageBillingOrgParamSchema, + t_BillingGetSharedStorageBillingUserParamSchema, + t_CampaignsCreateCampaignParamSchema, + t_CampaignsCreateCampaignRequestBodySchema, + t_CampaignsDeleteCampaignParamSchema, + t_CampaignsGetCampaignSummaryParamSchema, + t_CampaignsListOrgCampaignsParamSchema, + t_CampaignsListOrgCampaignsQuerySchema, + t_CampaignsUpdateCampaignParamSchema, + t_CampaignsUpdateCampaignRequestBodySchema, + t_ChecksCreateParamSchema, + t_ChecksCreateRequestBodySchema, + t_ChecksCreateSuiteParamSchema, + t_ChecksCreateSuiteRequestBodySchema, + t_ChecksGetParamSchema, + t_ChecksGetSuiteParamSchema, + t_ChecksListAnnotationsParamSchema, + t_ChecksListAnnotationsQuerySchema, + t_ChecksListForRefParamSchema, + t_ChecksListForRefQuerySchema, + t_ChecksListForSuiteParamSchema, + t_ChecksListForSuiteQuerySchema, + t_ChecksListSuitesForRefParamSchema, + t_ChecksListSuitesForRefQuerySchema, + t_ChecksRerequestRunParamSchema, + t_ChecksRerequestSuiteParamSchema, + t_ChecksSetSuitesPreferencesParamSchema, + t_ChecksSetSuitesPreferencesRequestBodySchema, + t_ChecksUpdateParamSchema, + t_ChecksUpdateRequestBodySchema, + t_ClassroomGetAClassroomParamSchema, + t_ClassroomGetAnAssignmentParamSchema, + t_ClassroomGetAssignmentGradesParamSchema, + t_ClassroomListAcceptedAssignmentsForAnAssignmentParamSchema, + t_ClassroomListAcceptedAssignmentsForAnAssignmentQuerySchema, + t_ClassroomListAssignmentsForAClassroomParamSchema, + t_ClassroomListAssignmentsForAClassroomQuerySchema, + t_ClassroomListClassroomsQuerySchema, + t_CodeScanningCommitAutofixParamSchema, + t_CodeScanningCommitAutofixRequestBodySchema, + t_CodeScanningCreateAutofixParamSchema, + t_CodeScanningCreateVariantAnalysisParamSchema, + t_CodeScanningCreateVariantAnalysisRequestBodySchema, + t_CodeScanningDeleteAnalysisParamSchema, + t_CodeScanningDeleteAnalysisQuerySchema, + t_CodeScanningDeleteCodeqlDatabaseParamSchema, + t_CodeScanningGetAlertParamSchema, + t_CodeScanningGetAnalysisParamSchema, + t_CodeScanningGetAutofixParamSchema, + t_CodeScanningGetCodeqlDatabaseParamSchema, + t_CodeScanningGetDefaultSetupParamSchema, + t_CodeScanningGetSarifParamSchema, + t_CodeScanningGetVariantAnalysisParamSchema, + t_CodeScanningGetVariantAnalysisRepoTaskParamSchema, + t_CodeScanningListAlertInstancesParamSchema, + t_CodeScanningListAlertInstancesQuerySchema, + t_CodeScanningListAlertsForOrgParamSchema, + t_CodeScanningListAlertsForOrgQuerySchema, + t_CodeScanningListAlertsForRepoParamSchema, + t_CodeScanningListAlertsForRepoQuerySchema, + t_CodeScanningListCodeqlDatabasesParamSchema, + t_CodeScanningListRecentAnalysesParamSchema, + t_CodeScanningListRecentAnalysesQuerySchema, + t_CodeScanningUpdateAlertParamSchema, + t_CodeScanningUpdateAlertRequestBodySchema, + t_CodeScanningUpdateDefaultSetupParamSchema, + t_CodeScanningUpdateDefaultSetupRequestBodySchema, + t_CodeScanningUploadSarifParamSchema, + t_CodeScanningUploadSarifRequestBodySchema, + t_CodeSecurityAttachConfigurationParamSchema, + t_CodeSecurityAttachConfigurationRequestBodySchema, + t_CodeSecurityAttachEnterpriseConfigurationParamSchema, + t_CodeSecurityAttachEnterpriseConfigurationRequestBodySchema, + t_CodeSecurityCreateConfigurationForEnterpriseParamSchema, + t_CodeSecurityCreateConfigurationForEnterpriseRequestBodySchema, + t_CodeSecurityCreateConfigurationParamSchema, + t_CodeSecurityCreateConfigurationRequestBodySchema, + t_CodeSecurityDeleteConfigurationForEnterpriseParamSchema, + t_CodeSecurityDeleteConfigurationParamSchema, + t_CodeSecurityDetachConfigurationParamSchema, + t_CodeSecurityDetachConfigurationRequestBodySchema, + t_CodeSecurityGetConfigurationForRepositoryParamSchema, + t_CodeSecurityGetConfigurationParamSchema, + t_CodeSecurityGetConfigurationsForEnterpriseParamSchema, + t_CodeSecurityGetConfigurationsForEnterpriseQuerySchema, + t_CodeSecurityGetConfigurationsForOrgParamSchema, + t_CodeSecurityGetConfigurationsForOrgQuerySchema, + t_CodeSecurityGetDefaultConfigurationsForEnterpriseParamSchema, + t_CodeSecurityGetDefaultConfigurationsParamSchema, + t_CodeSecurityGetRepositoriesForConfigurationParamSchema, + t_CodeSecurityGetRepositoriesForConfigurationQuerySchema, + t_CodeSecurityGetRepositoriesForEnterpriseConfigurationParamSchema, + t_CodeSecurityGetRepositoriesForEnterpriseConfigurationQuerySchema, + t_CodeSecurityGetSingleConfigurationForEnterpriseParamSchema, + t_CodeSecuritySetConfigurationAsDefaultForEnterpriseParamSchema, + t_CodeSecuritySetConfigurationAsDefaultForEnterpriseRequestBodySchema, + t_CodeSecuritySetConfigurationAsDefaultParamSchema, + t_CodeSecuritySetConfigurationAsDefaultRequestBodySchema, + t_CodeSecurityUpdateConfigurationParamSchema, + t_CodeSecurityUpdateConfigurationRequestBodySchema, + t_CodeSecurityUpdateEnterpriseConfigurationParamSchema, + t_CodeSecurityUpdateEnterpriseConfigurationRequestBodySchema, + t_CodesOfConductGetConductCodeParamSchema, + t_CodespacesAddRepositoryForSecretForAuthenticatedUserParamSchema, + t_CodespacesAddSelectedRepoToOrgSecretParamSchema, + t_CodespacesCheckPermissionsForDevcontainerParamSchema, + t_CodespacesCheckPermissionsForDevcontainerQuerySchema, + t_CodespacesCodespaceMachinesForAuthenticatedUserParamSchema, + t_CodespacesCreateForAuthenticatedUserRequestBodySchema, + t_CodespacesCreateOrUpdateOrgSecretParamSchema, + t_CodespacesCreateOrUpdateOrgSecretRequestBodySchema, + t_CodespacesCreateOrUpdateRepoSecretParamSchema, + t_CodespacesCreateOrUpdateRepoSecretRequestBodySchema, + t_CodespacesCreateOrUpdateSecretForAuthenticatedUserParamSchema, + t_CodespacesCreateOrUpdateSecretForAuthenticatedUserRequestBodySchema, + t_CodespacesCreateWithPrForAuthenticatedUserParamSchema, + t_CodespacesCreateWithPrForAuthenticatedUserRequestBodySchema, + t_CodespacesCreateWithRepoForAuthenticatedUserParamSchema, + t_CodespacesCreateWithRepoForAuthenticatedUserRequestBodySchema, + t_CodespacesDeleteCodespacesAccessUsersParamSchema, + t_CodespacesDeleteCodespacesAccessUsersRequestBodySchema, + t_CodespacesDeleteForAuthenticatedUserParamSchema, + t_CodespacesDeleteFromOrganizationParamSchema, + t_CodespacesDeleteOrgSecretParamSchema, + t_CodespacesDeleteRepoSecretParamSchema, + t_CodespacesDeleteSecretForAuthenticatedUserParamSchema, + t_CodespacesExportForAuthenticatedUserParamSchema, + t_CodespacesGetCodespacesForUserInOrgParamSchema, + t_CodespacesGetCodespacesForUserInOrgQuerySchema, + t_CodespacesGetExportDetailsForAuthenticatedUserParamSchema, + t_CodespacesGetForAuthenticatedUserParamSchema, + t_CodespacesGetOrgPublicKeyParamSchema, + t_CodespacesGetOrgSecretParamSchema, + t_CodespacesGetRepoPublicKeyParamSchema, + t_CodespacesGetRepoSecretParamSchema, + t_CodespacesGetSecretForAuthenticatedUserParamSchema, + t_CodespacesListDevcontainersInRepositoryForAuthenticatedUserParamSchema, + t_CodespacesListDevcontainersInRepositoryForAuthenticatedUserQuerySchema, + t_CodespacesListForAuthenticatedUserQuerySchema, + t_CodespacesListInOrganizationParamSchema, + t_CodespacesListInOrganizationQuerySchema, + t_CodespacesListInRepositoryForAuthenticatedUserParamSchema, + t_CodespacesListInRepositoryForAuthenticatedUserQuerySchema, + t_CodespacesListOrgSecretsParamSchema, + t_CodespacesListOrgSecretsQuerySchema, + t_CodespacesListRepoSecretsParamSchema, + t_CodespacesListRepoSecretsQuerySchema, + t_CodespacesListRepositoriesForSecretForAuthenticatedUserParamSchema, + t_CodespacesListSecretsForAuthenticatedUserQuerySchema, + t_CodespacesListSelectedReposForOrgSecretParamSchema, + t_CodespacesListSelectedReposForOrgSecretQuerySchema, + t_CodespacesPreFlightWithRepoForAuthenticatedUserParamSchema, + t_CodespacesPreFlightWithRepoForAuthenticatedUserQuerySchema, + t_CodespacesPublishForAuthenticatedUserParamSchema, + t_CodespacesPublishForAuthenticatedUserRequestBodySchema, + t_CodespacesRemoveRepositoryForSecretForAuthenticatedUserParamSchema, + t_CodespacesRemoveSelectedRepoFromOrgSecretParamSchema, + t_CodespacesRepoMachinesForAuthenticatedUserParamSchema, + t_CodespacesRepoMachinesForAuthenticatedUserQuerySchema, + t_CodespacesSetCodespacesAccessParamSchema, + t_CodespacesSetCodespacesAccessRequestBodySchema, + t_CodespacesSetCodespacesAccessUsersParamSchema, + t_CodespacesSetCodespacesAccessUsersRequestBodySchema, + t_CodespacesSetRepositoriesForSecretForAuthenticatedUserParamSchema, + t_CodespacesSetRepositoriesForSecretForAuthenticatedUserRequestBodySchema, + t_CodespacesSetSelectedReposForOrgSecretParamSchema, + t_CodespacesSetSelectedReposForOrgSecretRequestBodySchema, + t_CodespacesStartForAuthenticatedUserParamSchema, + t_CodespacesStopForAuthenticatedUserParamSchema, + t_CodespacesStopInOrganizationParamSchema, + t_CodespacesUpdateForAuthenticatedUserParamSchema, + t_CodespacesUpdateForAuthenticatedUserRequestBodySchema, + t_CopilotAddCopilotSeatsForTeamsParamSchema, + t_CopilotAddCopilotSeatsForTeamsRequestBodySchema, + t_CopilotAddCopilotSeatsForUsersParamSchema, + t_CopilotAddCopilotSeatsForUsersRequestBodySchema, + t_CopilotCancelCopilotSeatAssignmentForTeamsParamSchema, + t_CopilotCancelCopilotSeatAssignmentForTeamsRequestBodySchema, + t_CopilotCancelCopilotSeatAssignmentForUsersParamSchema, + t_CopilotCancelCopilotSeatAssignmentForUsersRequestBodySchema, + t_CopilotCopilotMetricsForOrganizationParamSchema, + t_CopilotCopilotMetricsForOrganizationQuerySchema, + t_CopilotCopilotMetricsForTeamParamSchema, + t_CopilotCopilotMetricsForTeamQuerySchema, + t_CopilotGetCopilotOrganizationDetailsParamSchema, + t_CopilotGetCopilotSeatDetailsForUserParamSchema, + t_CopilotListCopilotSeatsParamSchema, + t_CopilotListCopilotSeatsQuerySchema, + t_DependabotAddSelectedRepoToOrgSecretParamSchema, + t_DependabotCreateOrUpdateOrgSecretParamSchema, + t_DependabotCreateOrUpdateOrgSecretRequestBodySchema, + t_DependabotCreateOrUpdateRepoSecretParamSchema, + t_DependabotCreateOrUpdateRepoSecretRequestBodySchema, + t_DependabotDeleteOrgSecretParamSchema, + t_DependabotDeleteRepoSecretParamSchema, + t_DependabotGetAlertParamSchema, + t_DependabotGetOrgPublicKeyParamSchema, + t_DependabotGetOrgSecretParamSchema, + t_DependabotGetRepoPublicKeyParamSchema, + t_DependabotGetRepoSecretParamSchema, + t_DependabotListAlertsForEnterpriseParamSchema, + t_DependabotListAlertsForEnterpriseQuerySchema, + t_DependabotListAlertsForOrgParamSchema, + t_DependabotListAlertsForOrgQuerySchema, + t_DependabotListAlertsForRepoParamSchema, + t_DependabotListAlertsForRepoQuerySchema, + t_DependabotListOrgSecretsParamSchema, + t_DependabotListOrgSecretsQuerySchema, + t_DependabotListRepoSecretsParamSchema, + t_DependabotListRepoSecretsQuerySchema, + t_DependabotListSelectedReposForOrgSecretParamSchema, + t_DependabotListSelectedReposForOrgSecretQuerySchema, + t_DependabotRemoveSelectedRepoFromOrgSecretParamSchema, + t_DependabotSetSelectedReposForOrgSecretParamSchema, + t_DependabotSetSelectedReposForOrgSecretRequestBodySchema, + t_DependabotUpdateAlertParamSchema, + t_DependabotUpdateAlertRequestBodySchema, + t_DependencyGraphCreateRepositorySnapshotParamSchema, + t_DependencyGraphCreateRepositorySnapshotRequestBodySchema, + t_DependencyGraphDiffRangeParamSchema, + t_DependencyGraphDiffRangeQuerySchema, + t_DependencyGraphExportSbomParamSchema, + t_GistsCheckIsStarredParamSchema, + t_GistsCreateCommentParamSchema, + t_GistsCreateCommentRequestBodySchema, + t_GistsCreateRequestBodySchema, + t_GistsDeleteCommentParamSchema, + t_GistsDeleteParamSchema, + t_GistsForkParamSchema, + t_GistsGetCommentParamSchema, + t_GistsGetParamSchema, + t_GistsGetRevisionParamSchema, + t_GistsListCommentsParamSchema, + t_GistsListCommentsQuerySchema, + t_GistsListCommitsParamSchema, + t_GistsListCommitsQuerySchema, + t_GistsListForUserParamSchema, + t_GistsListForUserQuerySchema, + t_GistsListForksParamSchema, + t_GistsListForksQuerySchema, + t_GistsListPublicQuerySchema, + t_GistsListQuerySchema, + t_GistsListStarredQuerySchema, + t_GistsStarParamSchema, + t_GistsUnstarParamSchema, + t_GistsUpdateCommentParamSchema, + t_GistsUpdateCommentRequestBodySchema, + t_GistsUpdateParamSchema, + t_GistsUpdateRequestBodySchema, + t_GitCreateBlobParamSchema, + t_GitCreateBlobRequestBodySchema, + t_GitCreateCommitParamSchema, + t_GitCreateCommitRequestBodySchema, + t_GitCreateRefParamSchema, + t_GitCreateRefRequestBodySchema, + t_GitCreateTagParamSchema, + t_GitCreateTagRequestBodySchema, + t_GitCreateTreeParamSchema, + t_GitCreateTreeRequestBodySchema, + t_GitDeleteRefParamSchema, + t_GitGetBlobParamSchema, + t_GitGetCommitParamSchema, + t_GitGetRefParamSchema, + t_GitGetTagParamSchema, + t_GitGetTreeParamSchema, + t_GitGetTreeQuerySchema, + t_GitListMatchingRefsParamSchema, + t_GitUpdateRefParamSchema, + t_GitUpdateRefRequestBodySchema, + t_GitignoreGetTemplateParamSchema, + t_HostedComputeCreateNetworkConfigurationForOrgParamSchema, + t_HostedComputeCreateNetworkConfigurationForOrgRequestBodySchema, + t_HostedComputeDeleteNetworkConfigurationFromOrgParamSchema, + t_HostedComputeGetNetworkConfigurationForOrgParamSchema, + t_HostedComputeGetNetworkSettingsForOrgParamSchema, + t_HostedComputeListNetworkConfigurationsForOrgParamSchema, + t_HostedComputeListNetworkConfigurationsForOrgQuerySchema, + t_HostedComputeUpdateNetworkConfigurationForOrgParamSchema, + t_HostedComputeUpdateNetworkConfigurationForOrgRequestBodySchema, + t_InteractionsGetRestrictionsForOrgParamSchema, + t_InteractionsGetRestrictionsForRepoParamSchema, + t_InteractionsRemoveRestrictionsForOrgParamSchema, + t_InteractionsRemoveRestrictionsForRepoParamSchema, + t_InteractionsSetRestrictionsForAuthenticatedUserRequestBodySchema, + t_InteractionsSetRestrictionsForOrgParamSchema, + t_InteractionsSetRestrictionsForOrgRequestBodySchema, + t_InteractionsSetRestrictionsForRepoParamSchema, + t_InteractionsSetRestrictionsForRepoRequestBodySchema, + t_IssuesAddAssigneesParamSchema, + t_IssuesAddAssigneesRequestBodySchema, + t_IssuesAddLabelsParamSchema, + t_IssuesAddLabelsRequestBodySchema, + t_IssuesAddSubIssueParamSchema, + t_IssuesAddSubIssueRequestBodySchema, + t_IssuesCheckUserCanBeAssignedParamSchema, + t_IssuesCheckUserCanBeAssignedToIssueParamSchema, + t_IssuesCreateCommentParamSchema, + t_IssuesCreateCommentRequestBodySchema, + t_IssuesCreateLabelParamSchema, + t_IssuesCreateLabelRequestBodySchema, + t_IssuesCreateMilestoneParamSchema, + t_IssuesCreateMilestoneRequestBodySchema, + t_IssuesCreateParamSchema, + t_IssuesCreateRequestBodySchema, + t_IssuesDeleteCommentParamSchema, + t_IssuesDeleteLabelParamSchema, + t_IssuesDeleteMilestoneParamSchema, + t_IssuesGetCommentParamSchema, + t_IssuesGetEventParamSchema, + t_IssuesGetLabelParamSchema, + t_IssuesGetMilestoneParamSchema, + t_IssuesGetParamSchema, + t_IssuesListAssigneesParamSchema, + t_IssuesListAssigneesQuerySchema, + t_IssuesListCommentsForRepoParamSchema, + t_IssuesListCommentsForRepoQuerySchema, + t_IssuesListCommentsParamSchema, + t_IssuesListCommentsQuerySchema, + t_IssuesListEventsForRepoParamSchema, + t_IssuesListEventsForRepoQuerySchema, + t_IssuesListEventsForTimelineParamSchema, + t_IssuesListEventsForTimelineQuerySchema, + t_IssuesListEventsParamSchema, + t_IssuesListEventsQuerySchema, + t_IssuesListForAuthenticatedUserQuerySchema, + t_IssuesListForOrgParamSchema, + t_IssuesListForOrgQuerySchema, + t_IssuesListForRepoParamSchema, + t_IssuesListForRepoQuerySchema, + t_IssuesListLabelsForMilestoneParamSchema, + t_IssuesListLabelsForMilestoneQuerySchema, + t_IssuesListLabelsForRepoParamSchema, + t_IssuesListLabelsForRepoQuerySchema, + t_IssuesListLabelsOnIssueParamSchema, + t_IssuesListLabelsOnIssueQuerySchema, + t_IssuesListMilestonesParamSchema, + t_IssuesListMilestonesQuerySchema, + t_IssuesListQuerySchema, + t_IssuesListSubIssuesParamSchema, + t_IssuesListSubIssuesQuerySchema, + t_IssuesLockParamSchema, + t_IssuesLockRequestBodySchema, + t_IssuesRemoveAllLabelsParamSchema, + t_IssuesRemoveAssigneesParamSchema, + t_IssuesRemoveAssigneesRequestBodySchema, + t_IssuesRemoveLabelParamSchema, + t_IssuesRemoveSubIssueParamSchema, + t_IssuesRemoveSubIssueRequestBodySchema, + t_IssuesReprioritizeSubIssueParamSchema, + t_IssuesReprioritizeSubIssueRequestBodySchema, + t_IssuesSetLabelsParamSchema, + t_IssuesSetLabelsRequestBodySchema, + t_IssuesUnlockParamSchema, + t_IssuesUpdateCommentParamSchema, + t_IssuesUpdateCommentRequestBodySchema, + t_IssuesUpdateLabelParamSchema, + t_IssuesUpdateLabelRequestBodySchema, + t_IssuesUpdateMilestoneParamSchema, + t_IssuesUpdateMilestoneRequestBodySchema, + t_IssuesUpdateParamSchema, + t_IssuesUpdateRequestBodySchema, + t_LicensesGetAllCommonlyUsedQuerySchema, + t_LicensesGetForRepoParamSchema, + t_LicensesGetForRepoQuerySchema, + t_LicensesGetParamSchema, + t_MarkdownRenderRawRequestBodySchema, + t_MarkdownRenderRequestBodySchema, + t_MetaGetOctocatQuerySchema, + t_MigrationsCancelImportParamSchema, + t_MigrationsDeleteArchiveForAuthenticatedUserParamSchema, + t_MigrationsDeleteArchiveForOrgParamSchema, + t_MigrationsDownloadArchiveForOrgParamSchema, + t_MigrationsGetArchiveForAuthenticatedUserParamSchema, + t_MigrationsGetCommitAuthorsParamSchema, + t_MigrationsGetCommitAuthorsQuerySchema, + t_MigrationsGetImportStatusParamSchema, + t_MigrationsGetLargeFilesParamSchema, + t_MigrationsGetStatusForAuthenticatedUserParamSchema, + t_MigrationsGetStatusForAuthenticatedUserQuerySchema, + t_MigrationsGetStatusForOrgParamSchema, + t_MigrationsGetStatusForOrgQuerySchema, + t_MigrationsListForAuthenticatedUserQuerySchema, + t_MigrationsListForOrgParamSchema, + t_MigrationsListForOrgQuerySchema, + t_MigrationsListReposForAuthenticatedUserParamSchema, + t_MigrationsListReposForAuthenticatedUserQuerySchema, + t_MigrationsListReposForOrgParamSchema, + t_MigrationsListReposForOrgQuerySchema, + t_MigrationsMapCommitAuthorParamSchema, + t_MigrationsMapCommitAuthorRequestBodySchema, + t_MigrationsSetLfsPreferenceParamSchema, + t_MigrationsSetLfsPreferenceRequestBodySchema, + t_MigrationsStartForAuthenticatedUserRequestBodySchema, + t_MigrationsStartForOrgParamSchema, + t_MigrationsStartForOrgRequestBodySchema, + t_MigrationsStartImportParamSchema, + t_MigrationsStartImportRequestBodySchema, + t_MigrationsUnlockRepoForAuthenticatedUserParamSchema, + t_MigrationsUnlockRepoForOrgParamSchema, + t_MigrationsUpdateImportParamSchema, + t_MigrationsUpdateImportRequestBodySchema, + t_OidcGetOidcCustomSubTemplateForOrgParamSchema, + t_OidcUpdateOidcCustomSubTemplateForOrgParamSchema, + t_OidcUpdateOidcCustomSubTemplateForOrgRequestBodySchema, + t_OrgsAddSecurityManagerTeamParamSchema, + t_OrgsAssignTeamToOrgRoleParamSchema, + t_OrgsAssignUserToOrgRoleParamSchema, + t_OrgsBlockUserParamSchema, + t_OrgsCancelInvitationParamSchema, + t_OrgsCheckBlockedUserParamSchema, + t_OrgsCheckMembershipForUserParamSchema, + t_OrgsCheckPublicMembershipForUserParamSchema, + t_OrgsConvertMemberToOutsideCollaboratorParamSchema, + t_OrgsConvertMemberToOutsideCollaboratorRequestBodySchema, + t_OrgsCreateInvitationParamSchema, + t_OrgsCreateInvitationRequestBodySchema, + t_OrgsCreateIssueTypeParamSchema, + t_OrgsCreateIssueTypeRequestBodySchema, + t_OrgsCreateOrUpdateCustomPropertiesParamSchema, + t_OrgsCreateOrUpdateCustomPropertiesRequestBodySchema, + t_OrgsCreateOrUpdateCustomPropertiesValuesForReposParamSchema, + t_OrgsCreateOrUpdateCustomPropertiesValuesForReposRequestBodySchema, + t_OrgsCreateOrUpdateCustomPropertyParamSchema, + t_OrgsCreateOrUpdateCustomPropertyRequestBodySchema, + t_OrgsCreateWebhookParamSchema, + t_OrgsCreateWebhookRequestBodySchema, + t_OrgsDeleteIssueTypeParamSchema, + t_OrgsDeleteParamSchema, + t_OrgsDeleteWebhookParamSchema, + t_OrgsEnableOrDisableSecurityProductOnAllOrgReposParamSchema, + t_OrgsEnableOrDisableSecurityProductOnAllOrgReposRequestBodySchema, + t_OrgsGetAllCustomPropertiesParamSchema, + t_OrgsGetCustomPropertyParamSchema, + t_OrgsGetMembershipForAuthenticatedUserParamSchema, + t_OrgsGetMembershipForUserParamSchema, + t_OrgsGetOrgRoleParamSchema, + t_OrgsGetOrgRulesetHistoryParamSchema, + t_OrgsGetOrgRulesetHistoryQuerySchema, + t_OrgsGetOrgRulesetVersionParamSchema, + t_OrgsGetParamSchema, + t_OrgsGetWebhookConfigForOrgParamSchema, + t_OrgsGetWebhookDeliveryParamSchema, + t_OrgsGetWebhookParamSchema, + t_OrgsListAppInstallationsParamSchema, + t_OrgsListAppInstallationsQuerySchema, + t_OrgsListAttestationsParamSchema, + t_OrgsListAttestationsQuerySchema, + t_OrgsListBlockedUsersParamSchema, + t_OrgsListBlockedUsersQuerySchema, + t_OrgsListCustomPropertiesValuesForReposParamSchema, + t_OrgsListCustomPropertiesValuesForReposQuerySchema, + t_OrgsListFailedInvitationsParamSchema, + t_OrgsListFailedInvitationsQuerySchema, + t_OrgsListForAuthenticatedUserQuerySchema, + t_OrgsListForUserParamSchema, + t_OrgsListForUserQuerySchema, + t_OrgsListInvitationTeamsParamSchema, + t_OrgsListInvitationTeamsQuerySchema, + t_OrgsListIssueTypesParamSchema, + t_OrgsListMembersParamSchema, + t_OrgsListMembersQuerySchema, + t_OrgsListMembershipsForAuthenticatedUserQuerySchema, + t_OrgsListOrgRoleTeamsParamSchema, + t_OrgsListOrgRoleTeamsQuerySchema, + t_OrgsListOrgRoleUsersParamSchema, + t_OrgsListOrgRoleUsersQuerySchema, + t_OrgsListOrgRolesParamSchema, + t_OrgsListOutsideCollaboratorsParamSchema, + t_OrgsListOutsideCollaboratorsQuerySchema, + t_OrgsListPatGrantRepositoriesParamSchema, + t_OrgsListPatGrantRepositoriesQuerySchema, + t_OrgsListPatGrantRequestRepositoriesParamSchema, + t_OrgsListPatGrantRequestRepositoriesQuerySchema, + t_OrgsListPatGrantRequestsParamSchema, + t_OrgsListPatGrantRequestsQuerySchema, + t_OrgsListPatGrantsParamSchema, + t_OrgsListPatGrantsQuerySchema, + t_OrgsListPendingInvitationsParamSchema, + t_OrgsListPendingInvitationsQuerySchema, + t_OrgsListPublicMembersParamSchema, + t_OrgsListPublicMembersQuerySchema, + t_OrgsListQuerySchema, + t_OrgsListSecurityManagerTeamsParamSchema, + t_OrgsListWebhookDeliveriesParamSchema, + t_OrgsListWebhookDeliveriesQuerySchema, + t_OrgsListWebhooksParamSchema, + t_OrgsListWebhooksQuerySchema, + t_OrgsPingWebhookParamSchema, + t_OrgsRedeliverWebhookDeliveryParamSchema, + t_OrgsRemoveCustomPropertyParamSchema, + t_OrgsRemoveMemberParamSchema, + t_OrgsRemoveMembershipForUserParamSchema, + t_OrgsRemoveOutsideCollaboratorParamSchema, + t_OrgsRemovePublicMembershipForAuthenticatedUserParamSchema, + t_OrgsRemoveSecurityManagerTeamParamSchema, + t_OrgsReviewPatGrantRequestParamSchema, + t_OrgsReviewPatGrantRequestRequestBodySchema, + t_OrgsReviewPatGrantRequestsInBulkParamSchema, + t_OrgsReviewPatGrantRequestsInBulkRequestBodySchema, + t_OrgsRevokeAllOrgRolesTeamParamSchema, + t_OrgsRevokeAllOrgRolesUserParamSchema, + t_OrgsRevokeOrgRoleTeamParamSchema, + t_OrgsRevokeOrgRoleUserParamSchema, + t_OrgsSetMembershipForUserParamSchema, + t_OrgsSetMembershipForUserRequestBodySchema, + t_OrgsSetPublicMembershipForAuthenticatedUserParamSchema, + t_OrgsUnblockUserParamSchema, + t_OrgsUpdateIssueTypeParamSchema, + t_OrgsUpdateIssueTypeRequestBodySchema, + t_OrgsUpdateMembershipForAuthenticatedUserParamSchema, + t_OrgsUpdateMembershipForAuthenticatedUserRequestBodySchema, + t_OrgsUpdateParamSchema, + t_OrgsUpdatePatAccessParamSchema, + t_OrgsUpdatePatAccessRequestBodySchema, + t_OrgsUpdatePatAccessesParamSchema, + t_OrgsUpdatePatAccessesRequestBodySchema, + t_OrgsUpdateRequestBodySchema, + t_OrgsUpdateWebhookConfigForOrgParamSchema, + t_OrgsUpdateWebhookConfigForOrgRequestBodySchema, + t_OrgsUpdateWebhookParamSchema, + t_OrgsUpdateWebhookRequestBodySchema, + t_PackagesDeletePackageForAuthenticatedUserParamSchema, + t_PackagesDeletePackageForOrgParamSchema, + t_PackagesDeletePackageForUserParamSchema, + t_PackagesDeletePackageVersionForAuthenticatedUserParamSchema, + t_PackagesDeletePackageVersionForOrgParamSchema, + t_PackagesDeletePackageVersionForUserParamSchema, + t_PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserParamSchema, + t_PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserQuerySchema, + t_PackagesGetAllPackageVersionsForPackageOwnedByOrgParamSchema, + t_PackagesGetAllPackageVersionsForPackageOwnedByOrgQuerySchema, + t_PackagesGetAllPackageVersionsForPackageOwnedByUserParamSchema, + t_PackagesGetPackageForAuthenticatedUserParamSchema, + t_PackagesGetPackageForOrganizationParamSchema, + t_PackagesGetPackageForUserParamSchema, + t_PackagesGetPackageVersionForAuthenticatedUserParamSchema, + t_PackagesGetPackageVersionForOrganizationParamSchema, + t_PackagesGetPackageVersionForUserParamSchema, + t_PackagesListDockerMigrationConflictingPackagesForOrganizationParamSchema, + t_PackagesListDockerMigrationConflictingPackagesForUserParamSchema, + t_PackagesListPackagesForAuthenticatedUserQuerySchema, + t_PackagesListPackagesForOrganizationParamSchema, + t_PackagesListPackagesForOrganizationQuerySchema, + t_PackagesListPackagesForUserParamSchema, + t_PackagesListPackagesForUserQuerySchema, + t_PackagesRestorePackageForAuthenticatedUserParamSchema, + t_PackagesRestorePackageForAuthenticatedUserQuerySchema, + t_PackagesRestorePackageForOrgParamSchema, + t_PackagesRestorePackageForOrgQuerySchema, + t_PackagesRestorePackageForUserParamSchema, + t_PackagesRestorePackageForUserQuerySchema, + t_PackagesRestorePackageVersionForAuthenticatedUserParamSchema, + t_PackagesRestorePackageVersionForOrgParamSchema, + t_PackagesRestorePackageVersionForUserParamSchema, + t_PrivateRegistriesCreateOrgPrivateRegistryParamSchema, + t_PrivateRegistriesCreateOrgPrivateRegistryRequestBodySchema, + t_PrivateRegistriesDeleteOrgPrivateRegistryParamSchema, + t_PrivateRegistriesGetOrgPrivateRegistryParamSchema, + t_PrivateRegistriesGetOrgPublicKeyParamSchema, + t_PrivateRegistriesListOrgPrivateRegistriesParamSchema, + t_PrivateRegistriesListOrgPrivateRegistriesQuerySchema, + t_PrivateRegistriesUpdateOrgPrivateRegistryParamSchema, + t_PrivateRegistriesUpdateOrgPrivateRegistryRequestBodySchema, + t_ProjectsAddCollaboratorParamSchema, + t_ProjectsAddCollaboratorRequestBodySchema, + t_ProjectsCreateCardParamSchema, + t_ProjectsCreateCardRequestBodySchema, + t_ProjectsCreateColumnParamSchema, + t_ProjectsCreateColumnRequestBodySchema, + t_ProjectsCreateForAuthenticatedUserRequestBodySchema, + t_ProjectsCreateForOrgParamSchema, + t_ProjectsCreateForOrgRequestBodySchema, + t_ProjectsCreateForRepoParamSchema, + t_ProjectsCreateForRepoRequestBodySchema, + t_ProjectsDeleteCardParamSchema, + t_ProjectsDeleteColumnParamSchema, + t_ProjectsDeleteParamSchema, + t_ProjectsGetCardParamSchema, + t_ProjectsGetColumnParamSchema, + t_ProjectsGetParamSchema, + t_ProjectsGetPermissionForUserParamSchema, + t_ProjectsListCardsParamSchema, + t_ProjectsListCardsQuerySchema, + t_ProjectsListCollaboratorsParamSchema, + t_ProjectsListCollaboratorsQuerySchema, + t_ProjectsListColumnsParamSchema, + t_ProjectsListColumnsQuerySchema, + t_ProjectsListForOrgParamSchema, + t_ProjectsListForOrgQuerySchema, + t_ProjectsListForRepoParamSchema, + t_ProjectsListForRepoQuerySchema, + t_ProjectsListForUserParamSchema, + t_ProjectsListForUserQuerySchema, + t_ProjectsMoveCardParamSchema, + t_ProjectsMoveCardRequestBodySchema, + t_ProjectsMoveColumnParamSchema, + t_ProjectsMoveColumnRequestBodySchema, + t_ProjectsRemoveCollaboratorParamSchema, + t_ProjectsUpdateCardParamSchema, + t_ProjectsUpdateCardRequestBodySchema, + t_ProjectsUpdateColumnParamSchema, + t_ProjectsUpdateColumnRequestBodySchema, + t_ProjectsUpdateParamSchema, + t_ProjectsUpdateRequestBodySchema, + t_PullsCheckIfMergedParamSchema, + t_PullsCreateParamSchema, + t_PullsCreateReplyForReviewCommentParamSchema, + t_PullsCreateReplyForReviewCommentRequestBodySchema, + t_PullsCreateRequestBodySchema, + t_PullsCreateReviewCommentParamSchema, + t_PullsCreateReviewCommentRequestBodySchema, + t_PullsCreateReviewParamSchema, + t_PullsCreateReviewRequestBodySchema, + t_PullsDeletePendingReviewParamSchema, + t_PullsDeleteReviewCommentParamSchema, + t_PullsDismissReviewParamSchema, + t_PullsDismissReviewRequestBodySchema, + t_PullsGetParamSchema, + t_PullsGetReviewCommentParamSchema, + t_PullsGetReviewParamSchema, + t_PullsListCommentsForReviewParamSchema, + t_PullsListCommentsForReviewQuerySchema, + t_PullsListCommitsParamSchema, + t_PullsListCommitsQuerySchema, + t_PullsListFilesParamSchema, + t_PullsListFilesQuerySchema, + t_PullsListParamSchema, + t_PullsListQuerySchema, + t_PullsListRequestedReviewersParamSchema, + t_PullsListReviewCommentsForRepoParamSchema, + t_PullsListReviewCommentsForRepoQuerySchema, + t_PullsListReviewCommentsParamSchema, + t_PullsListReviewCommentsQuerySchema, + t_PullsListReviewsParamSchema, + t_PullsListReviewsQuerySchema, + t_PullsMergeParamSchema, + t_PullsMergeRequestBodySchema, + t_PullsRemoveRequestedReviewersParamSchema, + t_PullsRemoveRequestedReviewersRequestBodySchema, + t_PullsRequestReviewersParamSchema, + t_PullsRequestReviewersRequestBodySchema, + t_PullsSubmitReviewParamSchema, + t_PullsSubmitReviewRequestBodySchema, + t_PullsUpdateBranchParamSchema, + t_PullsUpdateBranchRequestBodySchema, + t_PullsUpdateParamSchema, + t_PullsUpdateRequestBodySchema, + t_PullsUpdateReviewCommentParamSchema, + t_PullsUpdateReviewCommentRequestBodySchema, + t_PullsUpdateReviewParamSchema, + t_PullsUpdateReviewRequestBodySchema, + t_ReactionsCreateForCommitCommentParamSchema, + t_ReactionsCreateForCommitCommentRequestBodySchema, + t_ReactionsCreateForIssueCommentParamSchema, + t_ReactionsCreateForIssueCommentRequestBodySchema, + t_ReactionsCreateForIssueParamSchema, + t_ReactionsCreateForIssueRequestBodySchema, + t_ReactionsCreateForPullRequestReviewCommentParamSchema, + t_ReactionsCreateForPullRequestReviewCommentRequestBodySchema, + t_ReactionsCreateForReleaseParamSchema, + t_ReactionsCreateForReleaseRequestBodySchema, + t_ReactionsCreateForTeamDiscussionCommentInOrgParamSchema, + t_ReactionsCreateForTeamDiscussionCommentInOrgRequestBodySchema, + t_ReactionsCreateForTeamDiscussionCommentLegacyParamSchema, + t_ReactionsCreateForTeamDiscussionCommentLegacyRequestBodySchema, + t_ReactionsCreateForTeamDiscussionInOrgParamSchema, + t_ReactionsCreateForTeamDiscussionInOrgRequestBodySchema, + t_ReactionsCreateForTeamDiscussionLegacyParamSchema, + t_ReactionsCreateForTeamDiscussionLegacyRequestBodySchema, + t_ReactionsDeleteForCommitCommentParamSchema, + t_ReactionsDeleteForIssueCommentParamSchema, + t_ReactionsDeleteForIssueParamSchema, + t_ReactionsDeleteForPullRequestCommentParamSchema, + t_ReactionsDeleteForReleaseParamSchema, + t_ReactionsDeleteForTeamDiscussionCommentParamSchema, + t_ReactionsDeleteForTeamDiscussionParamSchema, + t_ReactionsListForCommitCommentParamSchema, + t_ReactionsListForCommitCommentQuerySchema, + t_ReactionsListForIssueCommentParamSchema, + t_ReactionsListForIssueCommentQuerySchema, + t_ReactionsListForIssueParamSchema, + t_ReactionsListForIssueQuerySchema, + t_ReactionsListForPullRequestReviewCommentParamSchema, + t_ReactionsListForPullRequestReviewCommentQuerySchema, + t_ReactionsListForReleaseParamSchema, + t_ReactionsListForReleaseQuerySchema, + t_ReactionsListForTeamDiscussionCommentInOrgParamSchema, + t_ReactionsListForTeamDiscussionCommentInOrgQuerySchema, + t_ReactionsListForTeamDiscussionCommentLegacyParamSchema, + t_ReactionsListForTeamDiscussionCommentLegacyQuerySchema, + t_ReactionsListForTeamDiscussionInOrgParamSchema, + t_ReactionsListForTeamDiscussionInOrgQuerySchema, + t_ReactionsListForTeamDiscussionLegacyParamSchema, + t_ReactionsListForTeamDiscussionLegacyQuerySchema, + t_ReposAcceptInvitationForAuthenticatedUserParamSchema, + t_ReposAddAppAccessRestrictionsParamSchema, + t_ReposAddAppAccessRestrictionsRequestBodySchema, + t_ReposAddCollaboratorParamSchema, + t_ReposAddCollaboratorRequestBodySchema, + t_ReposAddStatusCheckContextsParamSchema, + t_ReposAddStatusCheckContextsRequestBodySchema, + t_ReposAddTeamAccessRestrictionsParamSchema, + t_ReposAddTeamAccessRestrictionsRequestBodySchema, + t_ReposAddUserAccessRestrictionsParamSchema, + t_ReposAddUserAccessRestrictionsRequestBodySchema, + t_ReposCancelPagesDeploymentParamSchema, + t_ReposCheckAutomatedSecurityFixesParamSchema, + t_ReposCheckCollaboratorParamSchema, + t_ReposCheckPrivateVulnerabilityReportingParamSchema, + t_ReposCheckVulnerabilityAlertsParamSchema, + t_ReposCodeownersErrorsParamSchema, + t_ReposCodeownersErrorsQuerySchema, + t_ReposCompareCommitsParamSchema, + t_ReposCompareCommitsQuerySchema, + t_ReposCreateAttestationParamSchema, + t_ReposCreateAttestationRequestBodySchema, + t_ReposCreateAutolinkParamSchema, + t_ReposCreateAutolinkRequestBodySchema, + t_ReposCreateCommitCommentParamSchema, + t_ReposCreateCommitCommentRequestBodySchema, + t_ReposCreateCommitSignatureProtectionParamSchema, + t_ReposCreateCommitStatusParamSchema, + t_ReposCreateCommitStatusRequestBodySchema, + t_ReposCreateDeployKeyParamSchema, + t_ReposCreateDeployKeyRequestBodySchema, + t_ReposCreateDeploymentBranchPolicyParamSchema, + t_ReposCreateDeploymentBranchPolicyRequestBodySchema, + t_ReposCreateDeploymentParamSchema, + t_ReposCreateDeploymentProtectionRuleParamSchema, + t_ReposCreateDeploymentProtectionRuleRequestBodySchema, + t_ReposCreateDeploymentRequestBodySchema, + t_ReposCreateDeploymentStatusParamSchema, + t_ReposCreateDeploymentStatusRequestBodySchema, + t_ReposCreateDispatchEventParamSchema, + t_ReposCreateDispatchEventRequestBodySchema, + t_ReposCreateForAuthenticatedUserRequestBodySchema, + t_ReposCreateForkParamSchema, + t_ReposCreateForkRequestBodySchema, + t_ReposCreateInOrgParamSchema, + t_ReposCreateInOrgRequestBodySchema, + t_ReposCreateOrUpdateCustomPropertiesValuesParamSchema, + t_ReposCreateOrUpdateCustomPropertiesValuesRequestBodySchema, + t_ReposCreateOrUpdateEnvironmentParamSchema, + t_ReposCreateOrUpdateEnvironmentRequestBodySchema, + t_ReposCreateOrUpdateFileContentsParamSchema, + t_ReposCreateOrUpdateFileContentsRequestBodySchema, + t_ReposCreateOrgRulesetParamSchema, + t_ReposCreateOrgRulesetRequestBodySchema, + t_ReposCreatePagesDeploymentParamSchema, + t_ReposCreatePagesDeploymentRequestBodySchema, + t_ReposCreatePagesSiteParamSchema, + t_ReposCreatePagesSiteRequestBodySchema, + t_ReposCreateReleaseParamSchema, + t_ReposCreateReleaseRequestBodySchema, + t_ReposCreateRepoRulesetParamSchema, + t_ReposCreateRepoRulesetRequestBodySchema, + t_ReposCreateTagProtectionParamSchema, + t_ReposCreateTagProtectionRequestBodySchema, + t_ReposCreateUsingTemplateParamSchema, + t_ReposCreateUsingTemplateRequestBodySchema, + t_ReposCreateWebhookParamSchema, + t_ReposCreateWebhookRequestBodySchema, + t_ReposDeclineInvitationForAuthenticatedUserParamSchema, + t_ReposDeleteAccessRestrictionsParamSchema, + t_ReposDeleteAdminBranchProtectionParamSchema, + t_ReposDeleteAnEnvironmentParamSchema, + t_ReposDeleteAutolinkParamSchema, + t_ReposDeleteBranchProtectionParamSchema, + t_ReposDeleteCommitCommentParamSchema, + t_ReposDeleteCommitSignatureProtectionParamSchema, + t_ReposDeleteDeployKeyParamSchema, + t_ReposDeleteDeploymentBranchPolicyParamSchema, + t_ReposDeleteDeploymentParamSchema, + t_ReposDeleteFileParamSchema, + t_ReposDeleteFileRequestBodySchema, + t_ReposDeleteInvitationParamSchema, + t_ReposDeleteOrgRulesetParamSchema, + t_ReposDeletePagesSiteParamSchema, + t_ReposDeleteParamSchema, + t_ReposDeletePullRequestReviewProtectionParamSchema, + t_ReposDeleteReleaseAssetParamSchema, + t_ReposDeleteReleaseParamSchema, + t_ReposDeleteRepoRulesetParamSchema, + t_ReposDeleteTagProtectionParamSchema, + t_ReposDeleteWebhookParamSchema, + t_ReposDisableAutomatedSecurityFixesParamSchema, + t_ReposDisableDeploymentProtectionRuleParamSchema, + t_ReposDisablePrivateVulnerabilityReportingParamSchema, + t_ReposDisableVulnerabilityAlertsParamSchema, + t_ReposDownloadTarballArchiveParamSchema, + t_ReposDownloadZipballArchiveParamSchema, + t_ReposEnableAutomatedSecurityFixesParamSchema, + t_ReposEnablePrivateVulnerabilityReportingParamSchema, + t_ReposEnableVulnerabilityAlertsParamSchema, + t_ReposGenerateReleaseNotesParamSchema, + t_ReposGenerateReleaseNotesRequestBodySchema, + t_ReposGetAccessRestrictionsParamSchema, + t_ReposGetAdminBranchProtectionParamSchema, + t_ReposGetAllDeploymentProtectionRulesParamSchema, + t_ReposGetAllEnvironmentsParamSchema, + t_ReposGetAllEnvironmentsQuerySchema, + t_ReposGetAllStatusCheckContextsParamSchema, + t_ReposGetAllTopicsParamSchema, + t_ReposGetAllTopicsQuerySchema, + t_ReposGetAppsWithAccessToProtectedBranchParamSchema, + t_ReposGetAutolinkParamSchema, + t_ReposGetBranchParamSchema, + t_ReposGetBranchProtectionParamSchema, + t_ReposGetBranchRulesParamSchema, + t_ReposGetBranchRulesQuerySchema, + t_ReposGetClonesParamSchema, + t_ReposGetClonesQuerySchema, + t_ReposGetCodeFrequencyStatsParamSchema, + t_ReposGetCollaboratorPermissionLevelParamSchema, + t_ReposGetCombinedStatusForRefParamSchema, + t_ReposGetCombinedStatusForRefQuerySchema, + t_ReposGetCommitActivityStatsParamSchema, + t_ReposGetCommitCommentParamSchema, + t_ReposGetCommitParamSchema, + t_ReposGetCommitQuerySchema, + t_ReposGetCommitSignatureProtectionParamSchema, + t_ReposGetCommunityProfileMetricsParamSchema, + t_ReposGetContentParamSchema, + t_ReposGetContentQuerySchema, + t_ReposGetContributorsStatsParamSchema, + t_ReposGetCustomDeploymentProtectionRuleParamSchema, + t_ReposGetCustomPropertiesValuesParamSchema, + t_ReposGetDeployKeyParamSchema, + t_ReposGetDeploymentBranchPolicyParamSchema, + t_ReposGetDeploymentParamSchema, + t_ReposGetDeploymentStatusParamSchema, + t_ReposGetEnvironmentParamSchema, + t_ReposGetLatestPagesBuildParamSchema, + t_ReposGetLatestReleaseParamSchema, + t_ReposGetOrgRuleSuiteParamSchema, + t_ReposGetOrgRuleSuitesParamSchema, + t_ReposGetOrgRuleSuitesQuerySchema, + t_ReposGetOrgRulesetParamSchema, + t_ReposGetOrgRulesetsParamSchema, + t_ReposGetOrgRulesetsQuerySchema, + t_ReposGetPagesBuildParamSchema, + t_ReposGetPagesDeploymentParamSchema, + t_ReposGetPagesHealthCheckParamSchema, + t_ReposGetPagesParamSchema, + t_ReposGetParamSchema, + t_ReposGetParticipationStatsParamSchema, + t_ReposGetPullRequestReviewProtectionParamSchema, + t_ReposGetPunchCardStatsParamSchema, + t_ReposGetReadmeInDirectoryParamSchema, + t_ReposGetReadmeInDirectoryQuerySchema, + t_ReposGetReadmeParamSchema, + t_ReposGetReadmeQuerySchema, + t_ReposGetReleaseAssetParamSchema, + t_ReposGetReleaseByTagParamSchema, + t_ReposGetReleaseParamSchema, + t_ReposGetRepoRuleSuiteParamSchema, + t_ReposGetRepoRuleSuitesParamSchema, + t_ReposGetRepoRuleSuitesQuerySchema, + t_ReposGetRepoRulesetHistoryParamSchema, + t_ReposGetRepoRulesetHistoryQuerySchema, + t_ReposGetRepoRulesetParamSchema, + t_ReposGetRepoRulesetQuerySchema, + t_ReposGetRepoRulesetVersionParamSchema, + t_ReposGetRepoRulesetsParamSchema, + t_ReposGetRepoRulesetsQuerySchema, + t_ReposGetStatusChecksProtectionParamSchema, + t_ReposGetTeamsWithAccessToProtectedBranchParamSchema, + t_ReposGetTopPathsParamSchema, + t_ReposGetTopReferrersParamSchema, + t_ReposGetUsersWithAccessToProtectedBranchParamSchema, + t_ReposGetViewsParamSchema, + t_ReposGetViewsQuerySchema, + t_ReposGetWebhookConfigForRepoParamSchema, + t_ReposGetWebhookDeliveryParamSchema, + t_ReposGetWebhookParamSchema, + t_ReposListActivitiesParamSchema, + t_ReposListActivitiesQuerySchema, + t_ReposListAttestationsParamSchema, + t_ReposListAttestationsQuerySchema, + t_ReposListAutolinksParamSchema, + t_ReposListBranchesForHeadCommitParamSchema, + t_ReposListBranchesParamSchema, + t_ReposListBranchesQuerySchema, + t_ReposListCollaboratorsParamSchema, + t_ReposListCollaboratorsQuerySchema, + t_ReposListCommentsForCommitParamSchema, + t_ReposListCommentsForCommitQuerySchema, + t_ReposListCommitCommentsForRepoParamSchema, + t_ReposListCommitCommentsForRepoQuerySchema, + t_ReposListCommitStatusesForRefParamSchema, + t_ReposListCommitStatusesForRefQuerySchema, + t_ReposListCommitsParamSchema, + t_ReposListCommitsQuerySchema, + t_ReposListContributorsParamSchema, + t_ReposListContributorsQuerySchema, + t_ReposListCustomDeploymentRuleIntegrationsParamSchema, + t_ReposListCustomDeploymentRuleIntegrationsQuerySchema, + t_ReposListDeployKeysParamSchema, + t_ReposListDeployKeysQuerySchema, + t_ReposListDeploymentBranchPoliciesParamSchema, + t_ReposListDeploymentBranchPoliciesQuerySchema, + t_ReposListDeploymentStatusesParamSchema, + t_ReposListDeploymentStatusesQuerySchema, + t_ReposListDeploymentsParamSchema, + t_ReposListDeploymentsQuerySchema, + t_ReposListForAuthenticatedUserQuerySchema, + t_ReposListForOrgParamSchema, + t_ReposListForOrgQuerySchema, + t_ReposListForUserParamSchema, + t_ReposListForUserQuerySchema, + t_ReposListForksParamSchema, + t_ReposListForksQuerySchema, + t_ReposListInvitationsForAuthenticatedUserQuerySchema, + t_ReposListInvitationsParamSchema, + t_ReposListInvitationsQuerySchema, + t_ReposListLanguagesParamSchema, + t_ReposListPagesBuildsParamSchema, + t_ReposListPagesBuildsQuerySchema, + t_ReposListPublicQuerySchema, + t_ReposListPullRequestsAssociatedWithCommitParamSchema, + t_ReposListPullRequestsAssociatedWithCommitQuerySchema, + t_ReposListReleaseAssetsParamSchema, + t_ReposListReleaseAssetsQuerySchema, + t_ReposListReleasesParamSchema, + t_ReposListReleasesQuerySchema, + t_ReposListTagProtectionParamSchema, + t_ReposListTagsParamSchema, + t_ReposListTagsQuerySchema, + t_ReposListTeamsParamSchema, + t_ReposListTeamsQuerySchema, + t_ReposListWebhookDeliveriesParamSchema, + t_ReposListWebhookDeliveriesQuerySchema, + t_ReposListWebhooksParamSchema, + t_ReposListWebhooksQuerySchema, + t_ReposMergeParamSchema, + t_ReposMergeRequestBodySchema, + t_ReposMergeUpstreamParamSchema, + t_ReposMergeUpstreamRequestBodySchema, + t_ReposPingWebhookParamSchema, + t_ReposRedeliverWebhookDeliveryParamSchema, + t_ReposRemoveAppAccessRestrictionsParamSchema, + t_ReposRemoveAppAccessRestrictionsRequestBodySchema, + t_ReposRemoveCollaboratorParamSchema, + t_ReposRemoveStatusCheckContextsParamSchema, + t_ReposRemoveStatusCheckContextsRequestBodySchema, + t_ReposRemoveStatusCheckProtectionParamSchema, + t_ReposRemoveTeamAccessRestrictionsParamSchema, + t_ReposRemoveTeamAccessRestrictionsRequestBodySchema, + t_ReposRemoveUserAccessRestrictionsParamSchema, + t_ReposRemoveUserAccessRestrictionsRequestBodySchema, + t_ReposRenameBranchParamSchema, + t_ReposRenameBranchRequestBodySchema, + t_ReposReplaceAllTopicsParamSchema, + t_ReposReplaceAllTopicsRequestBodySchema, + t_ReposRequestPagesBuildParamSchema, + t_ReposSetAdminBranchProtectionParamSchema, + t_ReposSetAppAccessRestrictionsParamSchema, + t_ReposSetAppAccessRestrictionsRequestBodySchema, + t_ReposSetStatusCheckContextsParamSchema, + t_ReposSetStatusCheckContextsRequestBodySchema, + t_ReposSetTeamAccessRestrictionsParamSchema, + t_ReposSetTeamAccessRestrictionsRequestBodySchema, + t_ReposSetUserAccessRestrictionsParamSchema, + t_ReposSetUserAccessRestrictionsRequestBodySchema, + t_ReposTestPushWebhookParamSchema, + t_ReposTransferParamSchema, + t_ReposTransferRequestBodySchema, + t_ReposUpdateBranchProtectionParamSchema, + t_ReposUpdateBranchProtectionRequestBodySchema, + t_ReposUpdateCommitCommentParamSchema, + t_ReposUpdateCommitCommentRequestBodySchema, + t_ReposUpdateDeploymentBranchPolicyParamSchema, + t_ReposUpdateDeploymentBranchPolicyRequestBodySchema, + t_ReposUpdateInformationAboutPagesSiteParamSchema, + t_ReposUpdateInformationAboutPagesSiteRequestBodySchema, + t_ReposUpdateInvitationParamSchema, + t_ReposUpdateInvitationRequestBodySchema, + t_ReposUpdateOrgRulesetParamSchema, + t_ReposUpdateOrgRulesetRequestBodySchema, + t_ReposUpdateParamSchema, + t_ReposUpdatePullRequestReviewProtectionParamSchema, + t_ReposUpdatePullRequestReviewProtectionRequestBodySchema, + t_ReposUpdateReleaseAssetParamSchema, + t_ReposUpdateReleaseAssetRequestBodySchema, + t_ReposUpdateReleaseParamSchema, + t_ReposUpdateReleaseRequestBodySchema, + t_ReposUpdateRepoRulesetParamSchema, + t_ReposUpdateRepoRulesetRequestBodySchema, + t_ReposUpdateRequestBodySchema, + t_ReposUpdateStatusCheckProtectionParamSchema, + t_ReposUpdateStatusCheckProtectionRequestBodySchema, + t_ReposUpdateWebhookConfigForRepoParamSchema, + t_ReposUpdateWebhookConfigForRepoRequestBodySchema, + t_ReposUpdateWebhookParamSchema, + t_ReposUpdateWebhookRequestBodySchema, + t_ReposUploadReleaseAssetParamSchema, + t_ReposUploadReleaseAssetQuerySchema, + t_ReposUploadReleaseAssetRequestBodySchema, + t_SearchCodeQuerySchema, + t_SearchCommitsQuerySchema, + t_SearchIssuesAndPullRequestsQuerySchema, + t_SearchLabelsQuerySchema, + t_SearchReposQuerySchema, + t_SearchTopicsQuerySchema, + t_SearchUsersQuerySchema, + t_SecretScanningCreatePushProtectionBypassParamSchema, + t_SecretScanningCreatePushProtectionBypassRequestBodySchema, + t_SecretScanningGetAlertParamSchema, + t_SecretScanningGetScanHistoryParamSchema, + t_SecretScanningListAlertsForEnterpriseParamSchema, + t_SecretScanningListAlertsForEnterpriseQuerySchema, + t_SecretScanningListAlertsForOrgParamSchema, + t_SecretScanningListAlertsForOrgQuerySchema, + t_SecretScanningListAlertsForRepoParamSchema, + t_SecretScanningListAlertsForRepoQuerySchema, + t_SecretScanningListLocationsForAlertParamSchema, + t_SecretScanningListLocationsForAlertQuerySchema, + t_SecretScanningUpdateAlertParamSchema, + t_SecretScanningUpdateAlertRequestBodySchema, + t_SecurityAdvisoriesCreateForkParamSchema, + t_SecurityAdvisoriesCreatePrivateVulnerabilityReportParamSchema, + t_SecurityAdvisoriesCreatePrivateVulnerabilityReportRequestBodySchema, + t_SecurityAdvisoriesCreateRepositoryAdvisoryCveRequestParamSchema, + t_SecurityAdvisoriesCreateRepositoryAdvisoryParamSchema, + t_SecurityAdvisoriesCreateRepositoryAdvisoryRequestBodySchema, + t_SecurityAdvisoriesGetGlobalAdvisoryParamSchema, + t_SecurityAdvisoriesGetRepositoryAdvisoryParamSchema, + t_SecurityAdvisoriesListGlobalAdvisoriesQuerySchema, + t_SecurityAdvisoriesListOrgRepositoryAdvisoriesParamSchema, + t_SecurityAdvisoriesListOrgRepositoryAdvisoriesQuerySchema, + t_SecurityAdvisoriesListRepositoryAdvisoriesParamSchema, + t_SecurityAdvisoriesListRepositoryAdvisoriesQuerySchema, + t_SecurityAdvisoriesUpdateRepositoryAdvisoryParamSchema, + t_SecurityAdvisoriesUpdateRepositoryAdvisoryRequestBodySchema, + t_TeamsAddMemberLegacyParamSchema, + t_TeamsAddOrUpdateMembershipForUserInOrgParamSchema, + t_TeamsAddOrUpdateMembershipForUserInOrgRequestBodySchema, + t_TeamsAddOrUpdateMembershipForUserLegacyParamSchema, + t_TeamsAddOrUpdateMembershipForUserLegacyRequestBodySchema, + t_TeamsAddOrUpdateProjectPermissionsInOrgParamSchema, + t_TeamsAddOrUpdateProjectPermissionsInOrgRequestBodySchema, + t_TeamsAddOrUpdateProjectPermissionsLegacyParamSchema, + t_TeamsAddOrUpdateProjectPermissionsLegacyRequestBodySchema, + t_TeamsAddOrUpdateRepoPermissionsInOrgParamSchema, + t_TeamsAddOrUpdateRepoPermissionsInOrgRequestBodySchema, + t_TeamsAddOrUpdateRepoPermissionsLegacyParamSchema, + t_TeamsAddOrUpdateRepoPermissionsLegacyRequestBodySchema, + t_TeamsCheckPermissionsForProjectInOrgParamSchema, + t_TeamsCheckPermissionsForProjectLegacyParamSchema, + t_TeamsCheckPermissionsForRepoInOrgParamSchema, + t_TeamsCheckPermissionsForRepoLegacyParamSchema, + t_TeamsCreateDiscussionCommentInOrgParamSchema, + t_TeamsCreateDiscussionCommentInOrgRequestBodySchema, + t_TeamsCreateDiscussionCommentLegacyParamSchema, + t_TeamsCreateDiscussionCommentLegacyRequestBodySchema, + t_TeamsCreateDiscussionInOrgParamSchema, + t_TeamsCreateDiscussionInOrgRequestBodySchema, + t_TeamsCreateDiscussionLegacyParamSchema, + t_TeamsCreateDiscussionLegacyRequestBodySchema, + t_TeamsCreateParamSchema, + t_TeamsCreateRequestBodySchema, + t_TeamsDeleteDiscussionCommentInOrgParamSchema, + t_TeamsDeleteDiscussionCommentLegacyParamSchema, + t_TeamsDeleteDiscussionInOrgParamSchema, + t_TeamsDeleteDiscussionLegacyParamSchema, + t_TeamsDeleteInOrgParamSchema, + t_TeamsDeleteLegacyParamSchema, + t_TeamsGetByNameParamSchema, + t_TeamsGetDiscussionCommentInOrgParamSchema, + t_TeamsGetDiscussionCommentLegacyParamSchema, + t_TeamsGetDiscussionInOrgParamSchema, + t_TeamsGetDiscussionLegacyParamSchema, + t_TeamsGetLegacyParamSchema, + t_TeamsGetMemberLegacyParamSchema, + t_TeamsGetMembershipForUserInOrgParamSchema, + t_TeamsGetMembershipForUserLegacyParamSchema, + t_TeamsListChildInOrgParamSchema, + t_TeamsListChildInOrgQuerySchema, + t_TeamsListChildLegacyParamSchema, + t_TeamsListChildLegacyQuerySchema, + t_TeamsListDiscussionCommentsInOrgParamSchema, + t_TeamsListDiscussionCommentsInOrgQuerySchema, + t_TeamsListDiscussionCommentsLegacyParamSchema, + t_TeamsListDiscussionCommentsLegacyQuerySchema, + t_TeamsListDiscussionsInOrgParamSchema, + t_TeamsListDiscussionsInOrgQuerySchema, + t_TeamsListDiscussionsLegacyParamSchema, + t_TeamsListDiscussionsLegacyQuerySchema, + t_TeamsListForAuthenticatedUserQuerySchema, + t_TeamsListMembersInOrgParamSchema, + t_TeamsListMembersInOrgQuerySchema, + t_TeamsListMembersLegacyParamSchema, + t_TeamsListMembersLegacyQuerySchema, + t_TeamsListParamSchema, + t_TeamsListPendingInvitationsInOrgParamSchema, + t_TeamsListPendingInvitationsInOrgQuerySchema, + t_TeamsListPendingInvitationsLegacyParamSchema, + t_TeamsListPendingInvitationsLegacyQuerySchema, + t_TeamsListProjectsInOrgParamSchema, + t_TeamsListProjectsInOrgQuerySchema, + t_TeamsListProjectsLegacyParamSchema, + t_TeamsListProjectsLegacyQuerySchema, + t_TeamsListQuerySchema, + t_TeamsListReposInOrgParamSchema, + t_TeamsListReposInOrgQuerySchema, + t_TeamsListReposLegacyParamSchema, + t_TeamsListReposLegacyQuerySchema, + t_TeamsRemoveMemberLegacyParamSchema, + t_TeamsRemoveMembershipForUserInOrgParamSchema, + t_TeamsRemoveMembershipForUserLegacyParamSchema, + t_TeamsRemoveProjectInOrgParamSchema, + t_TeamsRemoveProjectLegacyParamSchema, + t_TeamsRemoveRepoInOrgParamSchema, + t_TeamsRemoveRepoLegacyParamSchema, + t_TeamsUpdateDiscussionCommentInOrgParamSchema, + t_TeamsUpdateDiscussionCommentInOrgRequestBodySchema, + t_TeamsUpdateDiscussionCommentLegacyParamSchema, + t_TeamsUpdateDiscussionCommentLegacyRequestBodySchema, + t_TeamsUpdateDiscussionInOrgParamSchema, + t_TeamsUpdateDiscussionInOrgRequestBodySchema, + t_TeamsUpdateDiscussionLegacyParamSchema, + t_TeamsUpdateDiscussionLegacyRequestBodySchema, + t_TeamsUpdateInOrgParamSchema, + t_TeamsUpdateInOrgRequestBodySchema, + t_TeamsUpdateLegacyParamSchema, + t_TeamsUpdateLegacyRequestBodySchema, + t_UsersAddEmailForAuthenticatedUserRequestBodySchema, + t_UsersAddSocialAccountForAuthenticatedUserRequestBodySchema, + t_UsersBlockParamSchema, + t_UsersCheckBlockedParamSchema, + t_UsersCheckFollowingForUserParamSchema, + t_UsersCheckPersonIsFollowedByAuthenticatedParamSchema, + t_UsersCreateGpgKeyForAuthenticatedUserRequestBodySchema, + t_UsersCreatePublicSshKeyForAuthenticatedUserRequestBodySchema, + t_UsersCreateSshSigningKeyForAuthenticatedUserRequestBodySchema, + t_UsersDeleteEmailForAuthenticatedUserRequestBodySchema, + t_UsersDeleteGpgKeyForAuthenticatedUserParamSchema, + t_UsersDeletePublicSshKeyForAuthenticatedUserParamSchema, + t_UsersDeleteSocialAccountForAuthenticatedUserRequestBodySchema, + t_UsersDeleteSshSigningKeyForAuthenticatedUserParamSchema, + t_UsersFollowParamSchema, + t_UsersGetByIdParamSchema, + t_UsersGetByUsernameParamSchema, + t_UsersGetContextForUserParamSchema, + t_UsersGetContextForUserQuerySchema, + t_UsersGetGpgKeyForAuthenticatedUserParamSchema, + t_UsersGetPublicSshKeyForAuthenticatedUserParamSchema, + t_UsersGetSshSigningKeyForAuthenticatedUserParamSchema, + t_UsersListAttestationsParamSchema, + t_UsersListAttestationsQuerySchema, + t_UsersListBlockedByAuthenticatedUserQuerySchema, + t_UsersListEmailsForAuthenticatedUserQuerySchema, + t_UsersListFollowedByAuthenticatedUserQuerySchema, + t_UsersListFollowersForAuthenticatedUserQuerySchema, + t_UsersListFollowersForUserParamSchema, + t_UsersListFollowersForUserQuerySchema, + t_UsersListFollowingForUserParamSchema, + t_UsersListFollowingForUserQuerySchema, + t_UsersListGpgKeysForAuthenticatedUserQuerySchema, + t_UsersListGpgKeysForUserParamSchema, + t_UsersListGpgKeysForUserQuerySchema, + t_UsersListPublicEmailsForAuthenticatedUserQuerySchema, + t_UsersListPublicKeysForUserParamSchema, + t_UsersListPublicKeysForUserQuerySchema, + t_UsersListPublicSshKeysForAuthenticatedUserQuerySchema, + t_UsersListQuerySchema, + t_UsersListSocialAccountsForAuthenticatedUserQuerySchema, + t_UsersListSocialAccountsForUserParamSchema, + t_UsersListSocialAccountsForUserQuerySchema, + t_UsersListSshSigningKeysForAuthenticatedUserQuerySchema, + t_UsersListSshSigningKeysForUserParamSchema, + t_UsersListSshSigningKeysForUserQuerySchema, + t_UsersSetPrimaryEmailVisibilityForAuthenticatedUserRequestBodySchema, + t_UsersUnblockParamSchema, + t_UsersUnfollowParamSchema, + t_UsersUpdateAuthenticatedRequestBodySchema, + t_actions_billing_usage, + t_actions_cache_list, + t_actions_cache_usage_by_repository, + t_actions_cache_usage_org_enterprise, + t_actions_get_default_workflow_permissions, + t_actions_hosted_runner, + t_actions_hosted_runner_image, + t_actions_hosted_runner_limits, + t_actions_hosted_runner_machine_spec, + t_actions_organization_permissions, + t_actions_public_key, + t_actions_repository_permissions, + t_actions_secret, + t_actions_variable, + t_actions_workflow_access_to_repository, + t_activity, + t_api_insights_route_stats, + t_api_insights_subject_stats, + t_api_insights_summary_stats, + t_api_insights_time_stats, + t_api_insights_user_stats, + t_api_overview, + t_artifact, + t_authentication_token, + t_authorization, + t_autolink, + t_base_gist, + t_basic_error, + t_billing_usage_report, + t_blob, + t_branch_protection, + t_branch_restriction_policy, + t_branch_short, + t_branch_with_protection, + t_campaign_summary, + t_check_annotation, + t_check_automated_security_fixes, + t_check_run, + t_check_suite, + t_check_suite_preference, + t_classroom, + t_classroom_accepted_assignment, + t_classroom_assignment, + t_classroom_assignment_grade, + t_clone_traffic, + t_code_frequency_stat, + t_code_of_conduct, + t_code_scanning_alert, + t_code_scanning_alert_instance, + t_code_scanning_alert_items, + t_code_scanning_analysis, + t_code_scanning_analysis_deletion, + t_code_scanning_autofix, + t_code_scanning_autofix_commits_response, + t_code_scanning_codeql_database, + t_code_scanning_default_setup, + t_code_scanning_default_setup_update_response, + t_code_scanning_organization_alert_items, + t_code_scanning_sarifs_receipt, + t_code_scanning_sarifs_status, + t_code_scanning_variant_analysis, + t_code_scanning_variant_analysis_repo_task, + t_code_search_result_item, + t_code_security_configuration, + t_code_security_configuration_for_repository, + t_code_security_configuration_repositories, + t_code_security_default_configurations, + t_codeowners_errors, + t_codespace, + t_codespace_export_details, + t_codespace_machine, + t_codespace_with_full_repository, + t_codespaces_org_secret, + t_codespaces_permissions_check_for_devcontainer, + t_codespaces_public_key, + t_codespaces_secret, + t_codespaces_user_public_key, + t_collaborator, + t_combined_billing_usage, + t_combined_commit_status, + t_commit, + t_commit_activity, + t_commit_comment, + t_commit_comparison, + t_commit_search_result_item, + t_community_profile, + t_content_directory, + t_content_file, + t_content_submodule, + t_content_symlink, + t_content_traffic, + t_contributor, + t_contributor_activity, + t_copilot_organization_details, + t_copilot_seat_details, + t_copilot_usage_metrics_day, + t_custom_deployment_rule_app, + t_custom_property, + t_custom_property_value, + t_dependabot_alert, + t_dependabot_alert_with_repository, + t_dependabot_public_key, + t_dependabot_secret, + t_dependency_graph_diff, + t_dependency_graph_spdx_sbom, + t_deploy_key, + t_deployment, + t_deployment_branch_policy, + t_deployment_protection_rule, + t_deployment_status, + t_diff_entry, + t_email, + t_empty_object, + t_environment, + t_environment_approvals, + t_event, + t_feed, + t_file_commit, + t_full_repository, + t_gist_comment, + t_gist_commit, + t_gist_simple, + t_git_commit, + t_git_ref, + t_git_tag, + t_git_tree, + t_gitignore_template, + t_global_advisory, + t_gpg_key, + t_hook, + t_hook_delivery, + t_hook_delivery_item, + t_hovercard, + t_import, + t_installation, + t_installation_token, + t_integration, + t_integration_installation_request, + t_interaction_limit_response, + t_issue, + t_issue_comment, + t_issue_event, + t_issue_event_for_issue, + t_issue_search_result_item, + t_issue_type, + t_job, + t_key, + t_key_simple, + t_label, + t_label_search_result_item, + t_language, + t_license, + t_license_content, + t_license_simple, + t_marketplace_listing_plan, + t_marketplace_purchase, + t_merged_upstream, + t_migration, + t_milestone, + t_minimal_repository, + t_network_configuration, + t_network_settings, + t_oidc_custom_sub, + t_oidc_custom_sub_repo, + t_org_hook, + t_org_membership, + t_org_private_registry_configuration, + t_org_private_registry_configuration_with_selected_repositories, + t_org_repo_custom_property_values, + t_organization_actions_secret, + t_organization_actions_variable, + t_organization_dependabot_secret, + t_organization_full, + t_organization_invitation, + t_organization_programmatic_access_grant, + t_organization_programmatic_access_grant_request, + t_organization_role, + t_organization_secret_scanning_alert, + t_organization_simple, + t_package, + t_package_version, + t_packages_billing_usage, + t_page, + t_page_build, + t_page_build_status, + t_page_deployment, + t_pages_deployment_status, + t_pages_health_check, + t_participation_stats, + t_pending_deployment, + t_porter_author, + t_porter_large_file, + t_private_user, + t_project, + t_project_card, + t_project_collaborator_permission, + t_project_column, + t_protected_branch, + t_protected_branch_admin_enforced, + t_protected_branch_pull_request_review, + t_public_user, + t_pull_request, + t_pull_request_merge_result, + t_pull_request_review, + t_pull_request_review_comment, + t_pull_request_review_request, + t_pull_request_simple, + t_rate_limit_overview, + t_reaction, + t_referrer_traffic, + t_release, + t_release_asset, + t_release_notes_content, + t_repo_codespaces_secret, + t_repo_search_result_item, + t_repository, + t_repository_advisory, + t_repository_collaborator_permission, + t_repository_invitation, + t_repository_rule_detailed, + t_repository_rule_violation_error, + t_repository_ruleset, + t_repository_subscription, + t_review_comment, + t_root, + t_rule_suite, + t_rule_suites, + t_ruleset_version, + t_ruleset_version_with_state, + t_runner, + t_runner_application, + t_runner_groups_org, + t_runner_label, + t_scim_error, + t_secret_scanning_alert, + t_secret_scanning_location, + t_secret_scanning_push_protection_bypass, + t_secret_scanning_scan_history, + t_selected_actions, + t_short_blob, + t_short_branch, + t_simple_classroom, + t_simple_classroom_assignment, + t_simple_user, + t_social_account, + t_ssh_signing_key, + t_stargazer, + t_starred_repository, + t_status, + t_status_check_policy, + t_tag, + t_tag_protection, + t_team, + t_team_discussion, + t_team_discussion_comment, + t_team_full, + t_team_membership, + t_team_project, + t_team_repository, + t_team_role_assignment, + t_team_simple, + t_thread, + t_thread_subscription, + t_timeline_issue_events, + t_topic, + t_topic_search_result_item, + t_user_marketplace_purchase, + t_user_role_assignment, + t_user_search_result_item, + t_validation_error, + t_validation_error_simple, + t_view_traffic, + t_webhook_config, + t_workflow, + t_workflow_run, + t_workflow_run_usage, + t_workflow_usage, +} from "./models" +import { + PermissiveBoolean, + s_actions_billing_usage, + s_actions_cache_list, + s_actions_cache_usage_by_repository, + s_actions_cache_usage_org_enterprise, + s_actions_enabled, + s_actions_get_default_workflow_permissions, + s_actions_hosted_runner, + s_actions_hosted_runner_image, + s_actions_hosted_runner_limits, + s_actions_hosted_runner_machine_spec, + s_actions_organization_permissions, + s_actions_public_key, + s_actions_repository_permissions, + s_actions_secret, + s_actions_set_default_workflow_permissions, + s_actions_variable, + s_actions_workflow_access_to_repository, + s_activity, + s_alert_number, + s_allowed_actions, + s_api_insights_route_stats, + s_api_insights_subject_stats, + s_api_insights_summary_stats, + s_api_insights_time_stats, + s_api_insights_user_stats, + s_api_overview, + s_app_permissions, + s_artifact, + s_authentication_token, + s_authorization, + s_autolink, + s_base_gist, + s_basic_error, + s_billing_usage_report, + s_blob, + s_branch_protection, + s_branch_restriction_policy, + s_branch_short, + s_branch_with_protection, + s_campaign_state, + s_campaign_summary, + s_check_annotation, + s_check_automated_security_fixes, + s_check_run, + s_check_suite, + s_check_suite_preference, + s_classroom, + s_classroom_accepted_assignment, + s_classroom_assignment, + s_classroom_assignment_grade, + s_clone_traffic, + s_code_frequency_stat, + s_code_of_conduct, + s_code_scanning_alert, + s_code_scanning_alert_create_request, + s_code_scanning_alert_dismissed_comment, + s_code_scanning_alert_dismissed_reason, + s_code_scanning_alert_instance, + s_code_scanning_alert_items, + s_code_scanning_alert_set_state, + s_code_scanning_alert_severity, + s_code_scanning_alert_state_query, + s_code_scanning_analysis, + s_code_scanning_analysis_commit_sha, + s_code_scanning_analysis_deletion, + s_code_scanning_analysis_sarif_file, + s_code_scanning_analysis_sarif_id, + s_code_scanning_analysis_tool_guid, + s_code_scanning_analysis_tool_name, + s_code_scanning_autofix, + s_code_scanning_autofix_commits, + s_code_scanning_autofix_commits_response, + s_code_scanning_codeql_database, + s_code_scanning_default_setup, + s_code_scanning_default_setup_options, + s_code_scanning_default_setup_update, + s_code_scanning_default_setup_update_response, + s_code_scanning_organization_alert_items, + s_code_scanning_ref, + s_code_scanning_ref_full, + s_code_scanning_sarifs_receipt, + s_code_scanning_sarifs_status, + s_code_scanning_variant_analysis, + s_code_scanning_variant_analysis_repo_task, + s_code_search_result_item, + s_code_security_configuration, + s_code_security_configuration_for_repository, + s_code_security_configuration_repositories, + s_code_security_default_configurations, + s_codeowners_errors, + s_codespace, + s_codespace_export_details, + s_codespace_machine, + s_codespace_with_full_repository, + s_codespaces_org_secret, + s_codespaces_permissions_check_for_devcontainer, + s_codespaces_public_key, + s_codespaces_secret, + s_codespaces_user_public_key, + s_collaborator, + s_combined_billing_usage, + s_combined_commit_status, + s_commit, + s_commit_activity, + s_commit_comment, + s_commit_comparison, + s_commit_search_result_item, + s_community_profile, + s_content_directory, + s_content_file, + s_content_submodule, + s_content_symlink, + s_content_traffic, + s_contributor, + s_contributor_activity, + s_copilot_organization_details, + s_copilot_seat_details, + s_copilot_usage_metrics_day, + s_custom_deployment_rule_app, + s_custom_property, + s_custom_property_set_payload, + s_custom_property_value, + s_dependabot_alert, + s_dependabot_alert_with_repository, + s_dependabot_public_key, + s_dependabot_secret, + s_dependency_graph_diff, + s_dependency_graph_spdx_sbom, + s_deploy_key, + s_deployment, + s_deployment_branch_policy, + s_deployment_branch_policy_name_pattern, + s_deployment_branch_policy_name_pattern_with_type, + s_deployment_branch_policy_settings, + s_deployment_protection_rule, + s_deployment_reviewer_type, + s_deployment_status, + s_diff_entry, + s_email, + s_empty_object, + s_enabled_repositories, + s_environment, + s_environment_approvals, + s_event, + s_feed, + s_file_commit, + s_full_repository, + s_gist_comment, + s_gist_commit, + s_gist_simple, + s_git_commit, + s_git_ref, + s_git_tag, + s_git_tree, + s_gitignore_template, + s_global_advisory, + s_gpg_key, + s_hook, + s_hook_delivery, + s_hook_delivery_item, + s_hovercard, + s_import, + s_installation, + s_installation_token, + s_integration, + s_integration_installation_request, + s_interaction_limit, + s_interaction_limit_response, + s_issue, + s_issue_comment, + s_issue_event, + s_issue_event_for_issue, + s_issue_search_result_item, + s_issue_type, + s_job, + s_key, + s_key_simple, + s_label, + s_label_search_result_item, + s_language, + s_license, + s_license_content, + s_license_simple, + s_marketplace_listing_plan, + s_marketplace_purchase, + s_merged_upstream, + s_migration, + s_milestone, + s_minimal_repository, + s_network_configuration, + s_network_settings, + s_oidc_custom_sub, + s_oidc_custom_sub_repo, + s_org_hook, + s_org_membership, + s_org_private_registry_configuration, + s_org_private_registry_configuration_with_selected_repositories, + s_org_repo_custom_property_values, + s_org_ruleset_conditions, + s_organization_actions_secret, + s_organization_actions_variable, + s_organization_create_issue_type, + s_organization_dependabot_secret, + s_organization_full, + s_organization_invitation, + s_organization_programmatic_access_grant, + s_organization_programmatic_access_grant_request, + s_organization_role, + s_organization_secret_scanning_alert, + s_organization_simple, + s_organization_update_issue_type, + s_package, + s_package_version, + s_packages_billing_usage, + s_page, + s_page_build, + s_page_build_status, + s_page_deployment, + s_pages_deployment_status, + s_pages_health_check, + s_participation_stats, + s_pending_deployment, + s_porter_author, + s_porter_large_file, + s_prevent_self_review, + s_private_user, + s_private_vulnerability_report_create, + s_project, + s_project_card, + s_project_collaborator_permission, + s_project_column, + s_protected_branch, + s_protected_branch_admin_enforced, + s_protected_branch_pull_request_review, + s_public_user, + s_pull_request, + s_pull_request_merge_result, + s_pull_request_review, + s_pull_request_review_comment, + s_pull_request_review_request, + s_pull_request_simple, + s_rate_limit_overview, + s_reaction, + s_referrer_traffic, + s_release, + s_release_asset, + s_release_notes_content, + s_repo_codespaces_secret, + s_repo_search_result_item, + s_repository, + s_repository_advisory, + s_repository_advisory_create, + s_repository_advisory_update, + s_repository_collaborator_permission, + s_repository_invitation, + s_repository_rule, + s_repository_rule_detailed, + s_repository_rule_enforcement, + s_repository_rule_violation_error, + s_repository_ruleset, + s_repository_ruleset_bypass_actor, + s_repository_ruleset_conditions, + s_repository_subscription, + s_review_comment, + s_review_custom_gates_comment_required, + s_review_custom_gates_state_required, + s_root, + s_rule_suite, + s_rule_suites, + s_ruleset_version, + s_ruleset_version_with_state, + s_runner, + s_runner_application, + s_runner_groups_org, + s_runner_label, + s_scim_error, + s_secret_scanning_alert, + s_secret_scanning_alert_resolution, + s_secret_scanning_alert_resolution_comment, + s_secret_scanning_alert_state, + s_secret_scanning_location, + s_secret_scanning_push_protection_bypass, + s_secret_scanning_push_protection_bypass_placeholder_id, + s_secret_scanning_push_protection_bypass_reason, + s_secret_scanning_scan_history, + s_security_advisory_ecosystems, + s_selected_actions, + s_short_blob, + s_short_branch, + s_simple_classroom, + s_simple_classroom_assignment, + s_simple_user, + s_snapshot, + s_social_account, + s_ssh_signing_key, + s_stargazer, + s_starred_repository, + s_status, + s_status_check_policy, + s_tag, + s_tag_protection, + s_team, + s_team_discussion, + s_team_discussion_comment, + s_team_full, + s_team_membership, + s_team_project, + s_team_repository, + s_team_role_assignment, + s_team_simple, + s_thread, + s_thread_subscription, + s_timeline_issue_events, + s_topic, + s_topic_search_result_item, + s_user_marketplace_purchase, + s_user_role_assignment, + s_user_search_result_item, + s_validation_error, + s_validation_error_simple, + s_view_traffic, + s_wait_timer, + s_webhook_config, + s_webhook_config_content_type, + s_webhook_config_insecure_ssl, + s_webhook_config_secret, + s_webhook_config_url, + s_workflow, + s_workflow_run, + s_workflow_run_usage, + s_workflow_usage, +} from "./schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + ServerConfig, + SkipResponse, + StatusCode, + startServer, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type MetaRootResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MetaRoot = ( + params: Params, + respond: MetaRootResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesListGlobalAdvisoriesResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesListGlobalAdvisories = ( + params: Params< + void, + t_SecurityAdvisoriesListGlobalAdvisoriesQuerySchema, + void, + void + >, + respond: SecurityAdvisoriesListGlobalAdvisoriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesGetGlobalAdvisoryResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesGetGlobalAdvisory = ( + params: Params< + t_SecurityAdvisoriesGetGlobalAdvisoryParamSchema, + void, + void, + void + >, + respond: SecurityAdvisoriesGetGlobalAdvisoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetAuthenticatedResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetAuthenticated = ( + params: Params, + respond: AppsGetAuthenticatedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsCreateFromManifestResponder = { + with201(): ExpressRuntimeResponse< + t_integration & { + client_id: string + client_secret: string + pem: string + webhook_secret: string | null + [key: string]: unknown | undefined + } + > + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsCreateFromManifest = ( + params: Params, + respond: AppsCreateFromManifestResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetWebhookConfigForAppResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetWebhookConfigForApp = ( + params: Params, + respond: AppsGetWebhookConfigForAppResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsUpdateWebhookConfigForAppResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsUpdateWebhookConfigForApp = ( + params: Params< + void, + void, + t_AppsUpdateWebhookConfigForAppRequestBodySchema, + void + >, + respond: AppsUpdateWebhookConfigForAppResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListWebhookDeliveriesResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListWebhookDeliveries = ( + params: Params, + respond: AppsListWebhookDeliveriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetWebhookDeliveryResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetWebhookDelivery = ( + params: Params, + respond: AppsGetWebhookDeliveryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsRedeliverWebhookDeliveryResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsRedeliverWebhookDelivery = ( + params: Params, + respond: AppsRedeliverWebhookDeliveryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListInstallationRequestsForAuthenticatedAppResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListInstallationRequestsForAuthenticatedApp = ( + params: Params< + void, + t_AppsListInstallationRequestsForAuthenticatedAppQuerySchema, + void, + void + >, + respond: AppsListInstallationRequestsForAuthenticatedAppResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListInstallationsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListInstallations = ( + params: Params, + respond: AppsListInstallationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetInstallationResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetInstallation = ( + params: Params, + respond: AppsGetInstallationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsDeleteInstallationResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsDeleteInstallation = ( + params: Params, + respond: AppsDeleteInstallationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsCreateInstallationAccessTokenResponder = { + with201(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsCreateInstallationAccessToken = ( + params: Params< + t_AppsCreateInstallationAccessTokenParamSchema, + void, + t_AppsCreateInstallationAccessTokenRequestBodySchema | undefined, + void + >, + respond: AppsCreateInstallationAccessTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsSuspendInstallationResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsSuspendInstallation = ( + params: Params, + respond: AppsSuspendInstallationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsUnsuspendInstallationResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsUnsuspendInstallation = ( + params: Params, + respond: AppsUnsuspendInstallationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsDeleteAuthorizationResponder = { + with204(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsDeleteAuthorization = ( + params: Params< + t_AppsDeleteAuthorizationParamSchema, + void, + t_AppsDeleteAuthorizationRequestBodySchema, + void + >, + respond: AppsDeleteAuthorizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsCheckTokenResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsCheckToken = ( + params: Params< + t_AppsCheckTokenParamSchema, + void, + t_AppsCheckTokenRequestBodySchema, + void + >, + respond: AppsCheckTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsResetTokenResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsResetToken = ( + params: Params< + t_AppsResetTokenParamSchema, + void, + t_AppsResetTokenRequestBodySchema, + void + >, + respond: AppsResetTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsDeleteTokenResponder = { + with204(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsDeleteToken = ( + params: Params< + t_AppsDeleteTokenParamSchema, + void, + t_AppsDeleteTokenRequestBodySchema, + void + >, + respond: AppsDeleteTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsScopeTokenResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsScopeToken = ( + params: Params< + t_AppsScopeTokenParamSchema, + void, + t_AppsScopeTokenRequestBodySchema, + void + >, + respond: AppsScopeTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetBySlugResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetBySlug = ( + params: Params, + respond: AppsGetBySlugResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ClassroomGetAnAssignmentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ClassroomGetAnAssignment = ( + params: Params, + respond: ClassroomGetAnAssignmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ClassroomListAcceptedAssignmentsForAnAssignmentResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ClassroomListAcceptedAssignmentsForAnAssignment = ( + params: Params< + t_ClassroomListAcceptedAssignmentsForAnAssignmentParamSchema, + t_ClassroomListAcceptedAssignmentsForAnAssignmentQuerySchema, + void, + void + >, + respond: ClassroomListAcceptedAssignmentsForAnAssignmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ClassroomGetAssignmentGradesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ClassroomGetAssignmentGrades = ( + params: Params, + respond: ClassroomGetAssignmentGradesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ClassroomListClassroomsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ClassroomListClassrooms = ( + params: Params, + respond: ClassroomListClassroomsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ClassroomGetAClassroomResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ClassroomGetAClassroom = ( + params: Params, + respond: ClassroomGetAClassroomResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ClassroomListAssignmentsForAClassroomResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ClassroomListAssignmentsForAClassroom = ( + params: Params< + t_ClassroomListAssignmentsForAClassroomParamSchema, + t_ClassroomListAssignmentsForAClassroomQuerySchema, + void, + void + >, + respond: ClassroomListAssignmentsForAClassroomResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodesOfConductGetAllCodesOfConductResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodesOfConductGetAllCodesOfConduct = ( + params: Params, + respond: CodesOfConductGetAllCodesOfConductResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodesOfConductGetConductCodeResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodesOfConductGetConductCode = ( + params: Params, + respond: CodesOfConductGetConductCodeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmojisGetResponder = { + with200(): ExpressRuntimeResponse<{ + [key: string]: string | undefined + }> + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmojisGet = ( + params: Params, + respond: EmojisGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetConfigurationsForEnterpriseResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetConfigurationsForEnterprise = ( + params: Params< + t_CodeSecurityGetConfigurationsForEnterpriseParamSchema, + t_CodeSecurityGetConfigurationsForEnterpriseQuerySchema, + void, + void + >, + respond: CodeSecurityGetConfigurationsForEnterpriseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityCreateConfigurationForEnterpriseResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityCreateConfigurationForEnterprise = ( + params: Params< + t_CodeSecurityCreateConfigurationForEnterpriseParamSchema, + void, + t_CodeSecurityCreateConfigurationForEnterpriseRequestBodySchema, + void + >, + respond: CodeSecurityCreateConfigurationForEnterpriseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetDefaultConfigurationsForEnterpriseResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetDefaultConfigurationsForEnterprise = ( + params: Params< + t_CodeSecurityGetDefaultConfigurationsForEnterpriseParamSchema, + void, + void, + void + >, + respond: CodeSecurityGetDefaultConfigurationsForEnterpriseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetSingleConfigurationForEnterpriseResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetSingleConfigurationForEnterprise = ( + params: Params< + t_CodeSecurityGetSingleConfigurationForEnterpriseParamSchema, + void, + void, + void + >, + respond: CodeSecurityGetSingleConfigurationForEnterpriseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityUpdateEnterpriseConfigurationResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityUpdateEnterpriseConfiguration = ( + params: Params< + t_CodeSecurityUpdateEnterpriseConfigurationParamSchema, + void, + t_CodeSecurityUpdateEnterpriseConfigurationRequestBodySchema, + void + >, + respond: CodeSecurityUpdateEnterpriseConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityDeleteConfigurationForEnterpriseResponder = { + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityDeleteConfigurationForEnterprise = ( + params: Params< + t_CodeSecurityDeleteConfigurationForEnterpriseParamSchema, + void, + void, + void + >, + respond: CodeSecurityDeleteConfigurationForEnterpriseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityAttachEnterpriseConfigurationResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityAttachEnterpriseConfiguration = ( + params: Params< + t_CodeSecurityAttachEnterpriseConfigurationParamSchema, + void, + t_CodeSecurityAttachEnterpriseConfigurationRequestBodySchema, + void + >, + respond: CodeSecurityAttachEnterpriseConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecuritySetConfigurationAsDefaultForEnterpriseResponder = { + with200(): ExpressRuntimeResponse<{ + configuration?: t_code_security_configuration | undefined + default_for_new_repos?: + | ("all" | "none" | "private_and_internal" | "public") + | undefined + }> + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecuritySetConfigurationAsDefaultForEnterprise = ( + params: Params< + t_CodeSecuritySetConfigurationAsDefaultForEnterpriseParamSchema, + void, + t_CodeSecuritySetConfigurationAsDefaultForEnterpriseRequestBodySchema, + void + >, + respond: CodeSecuritySetConfigurationAsDefaultForEnterpriseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetRepositoriesForEnterpriseConfigurationResponder = { + with200(): ExpressRuntimeResponse< + t_code_security_configuration_repositories[] + > + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetRepositoriesForEnterpriseConfiguration = ( + params: Params< + t_CodeSecurityGetRepositoriesForEnterpriseConfigurationParamSchema, + t_CodeSecurityGetRepositoriesForEnterpriseConfigurationQuerySchema, + void, + void + >, + respond: CodeSecurityGetRepositoriesForEnterpriseConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotListAlertsForEnterpriseResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotListAlertsForEnterprise = ( + params: Params< + t_DependabotListAlertsForEnterpriseParamSchema, + t_DependabotListAlertsForEnterpriseQuerySchema, + void, + void + >, + respond: DependabotListAlertsForEnterpriseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecretScanningListAlertsForEnterpriseResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SecretScanningListAlertsForEnterprise = ( + params: Params< + t_SecretScanningListAlertsForEnterpriseParamSchema, + t_SecretScanningListAlertsForEnterpriseQuerySchema, + void, + void + >, + respond: SecretScanningListAlertsForEnterpriseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListPublicEventsResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type ActivityListPublicEvents = ( + params: Params, + respond: ActivityListPublicEventsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityGetFeedsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityGetFeeds = ( + params: Params, + respond: ActivityGetFeedsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsListResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsList = ( + params: Params, + respond: GistsListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsCreateResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsCreate = ( + params: Params, + respond: GistsCreateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsListPublicResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsListPublic = ( + params: Params, + respond: GistsListPublicResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsListStarredResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsListStarred = ( + params: Params, + respond: GistsListStarredResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsGetResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + block?: + | { + created_at?: string | undefined + html_url?: (string | null) | undefined + reason?: string | undefined + } + | undefined + documentation_url?: string | undefined + message?: string | undefined + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsGet = ( + params: Params, + respond: GistsGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsUpdateResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsUpdate = ( + params: Params< + t_GistsUpdateParamSchema, + void, + t_GistsUpdateRequestBodySchema, + void + >, + respond: GistsUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsDeleteResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsDelete = ( + params: Params, + respond: GistsDeleteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsListCommentsResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsListComments = ( + params: Params< + t_GistsListCommentsParamSchema, + t_GistsListCommentsQuerySchema, + void, + void + >, + respond: GistsListCommentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsCreateCommentResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsCreateComment = ( + params: Params< + t_GistsCreateCommentParamSchema, + void, + t_GistsCreateCommentRequestBodySchema, + void + >, + respond: GistsCreateCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsGetCommentResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + block?: + | { + created_at?: string | undefined + html_url?: (string | null) | undefined + reason?: string | undefined + } + | undefined + documentation_url?: string | undefined + message?: string | undefined + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsGetComment = ( + params: Params, + respond: GistsGetCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsUpdateCommentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsUpdateComment = ( + params: Params< + t_GistsUpdateCommentParamSchema, + void, + t_GistsUpdateCommentRequestBodySchema, + void + >, + respond: GistsUpdateCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsDeleteCommentResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsDeleteComment = ( + params: Params, + respond: GistsDeleteCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsListCommitsResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsListCommits = ( + params: Params< + t_GistsListCommitsParamSchema, + t_GistsListCommitsQuerySchema, + void, + void + >, + respond: GistsListCommitsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsListForksResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsListForks = ( + params: Params< + t_GistsListForksParamSchema, + t_GistsListForksQuerySchema, + void, + void + >, + respond: GistsListForksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsForkResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsFork = ( + params: Params, + respond: GistsForkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsCheckIsStarredResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsCheckIsStarred = ( + params: Params, + respond: GistsCheckIsStarredResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsStarResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsStar = ( + params: Params, + respond: GistsStarResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsUnstarResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsUnstar = ( + params: Params, + respond: GistsUnstarResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsGetRevisionResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsGetRevision = ( + params: Params, + respond: GistsGetRevisionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitignoreGetAllTemplatesResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitignoreGetAllTemplates = ( + params: Params, + respond: GitignoreGetAllTemplatesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitignoreGetTemplateResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitignoreGetTemplate = ( + params: Params, + respond: GitignoreGetTemplateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListReposAccessibleToInstallationResponder = { + with200(): ExpressRuntimeResponse<{ + repositories: t_repository[] + repository_selection?: string | undefined + total_count: number + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListReposAccessibleToInstallation = ( + params: Params< + void, + t_AppsListReposAccessibleToInstallationQuerySchema, + void, + void + >, + respond: AppsListReposAccessibleToInstallationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsRevokeInstallationAccessTokenResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsRevokeInstallationAccessToken = ( + params: Params, + respond: AppsRevokeInstallationAccessTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesList = ( + params: Params, + respond: IssuesListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type LicensesGetAllCommonlyUsedResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type LicensesGetAllCommonlyUsed = ( + params: Params, + respond: LicensesGetAllCommonlyUsedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type LicensesGetResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type LicensesGet = ( + params: Params, + respond: LicensesGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MarkdownRenderResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MarkdownRender = ( + params: Params, + respond: MarkdownRenderResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MarkdownRenderRawResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MarkdownRenderRaw = ( + params: Params< + void, + void, + t_MarkdownRenderRawRequestBodySchema | undefined, + void + >, + respond: MarkdownRenderRawResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetSubscriptionPlanForAccountResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetSubscriptionPlanForAccount = ( + params: Params< + t_AppsGetSubscriptionPlanForAccountParamSchema, + void, + void, + void + >, + respond: AppsGetSubscriptionPlanForAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListPlansResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListPlans = ( + params: Params, + respond: AppsListPlansResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListAccountsForPlanResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListAccountsForPlan = ( + params: Params< + t_AppsListAccountsForPlanParamSchema, + t_AppsListAccountsForPlanQuerySchema, + void, + void + >, + respond: AppsListAccountsForPlanResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetSubscriptionPlanForAccountStubbedResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetSubscriptionPlanForAccountStubbed = ( + params: Params< + t_AppsGetSubscriptionPlanForAccountStubbedParamSchema, + void, + void, + void + >, + respond: AppsGetSubscriptionPlanForAccountStubbedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListPlansStubbedResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListPlansStubbed = ( + params: Params, + respond: AppsListPlansStubbedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListAccountsForPlanStubbedResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListAccountsForPlanStubbed = ( + params: Params< + t_AppsListAccountsForPlanStubbedParamSchema, + t_AppsListAccountsForPlanStubbedQuerySchema, + void, + void + >, + respond: AppsListAccountsForPlanStubbedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MetaGetResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MetaGet = ( + params: Params, + respond: MetaGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListPublicEventsForRepoNetworkResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListPublicEventsForRepoNetwork = ( + params: Params< + t_ActivityListPublicEventsForRepoNetworkParamSchema, + t_ActivityListPublicEventsForRepoNetworkQuerySchema, + void, + void + >, + respond: ActivityListPublicEventsForRepoNetworkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListNotificationsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListNotificationsForAuthenticatedUser = ( + params: Params< + void, + t_ActivityListNotificationsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: ActivityListNotificationsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityMarkNotificationsAsReadResponder = { + with202(): ExpressRuntimeResponse<{ + message?: string | undefined + }> + with205(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityMarkNotificationsAsRead = ( + params: Params< + void, + void, + t_ActivityMarkNotificationsAsReadRequestBodySchema | undefined, + void + >, + respond: ActivityMarkNotificationsAsReadResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityGetThreadResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityGetThread = ( + params: Params, + respond: ActivityGetThreadResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityMarkThreadAsReadResponder = { + with205(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityMarkThreadAsRead = ( + params: Params, + respond: ActivityMarkThreadAsReadResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityMarkThreadAsDoneResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityMarkThreadAsDone = ( + params: Params, + respond: ActivityMarkThreadAsDoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityGetThreadSubscriptionForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityGetThreadSubscriptionForAuthenticatedUser = ( + params: Params< + t_ActivityGetThreadSubscriptionForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: ActivityGetThreadSubscriptionForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivitySetThreadSubscriptionResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivitySetThreadSubscription = ( + params: Params< + t_ActivitySetThreadSubscriptionParamSchema, + void, + t_ActivitySetThreadSubscriptionRequestBodySchema | undefined, + void + >, + respond: ActivitySetThreadSubscriptionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityDeleteThreadSubscriptionResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityDeleteThreadSubscription = ( + params: Params< + t_ActivityDeleteThreadSubscriptionParamSchema, + void, + void, + void + >, + respond: ActivityDeleteThreadSubscriptionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MetaGetOctocatResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MetaGetOctocat = ( + params: Params, + respond: MetaGetOctocatResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsList = ( + params: Params, + respond: OrgsListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BillingGetGithubBillingUsageReportOrgResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type BillingGetGithubBillingUsageReportOrg = ( + params: Params< + t_BillingGetGithubBillingUsageReportOrgParamSchema, + t_BillingGetGithubBillingUsageReportOrgQuerySchema, + void, + void + >, + respond: BillingGetGithubBillingUsageReportOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGet = ( + params: Params, + respond: OrgsGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsUpdateResponder = { + with200(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse< + t_validation_error | t_validation_error_simple + > +} & ExpressRuntimeResponder + +export type OrgsUpdate = ( + params: Params< + t_OrgsUpdateParamSchema, + void, + t_OrgsUpdateRequestBodySchema | undefined, + void + >, + respond: OrgsUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsDeleteResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsDelete = ( + params: Params, + respond: OrgsDeleteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetActionsCacheUsageForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetActionsCacheUsageForOrg = ( + params: Params< + t_ActionsGetActionsCacheUsageForOrgParamSchema, + void, + void, + void + >, + respond: ActionsGetActionsCacheUsageForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetActionsCacheUsageByRepoForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + repository_cache_usages: t_actions_cache_usage_by_repository[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsGetActionsCacheUsageByRepoForOrg = ( + params: Params< + t_ActionsGetActionsCacheUsageByRepoForOrgParamSchema, + t_ActionsGetActionsCacheUsageByRepoForOrgQuerySchema, + void, + void + >, + respond: ActionsGetActionsCacheUsageByRepoForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListHostedRunnersForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + runners: t_actions_hosted_runner[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListHostedRunnersForOrg = ( + params: Params< + t_ActionsListHostedRunnersForOrgParamSchema, + t_ActionsListHostedRunnersForOrgQuerySchema, + void, + void + >, + respond: ActionsListHostedRunnersForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateHostedRunnerForOrgResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateHostedRunnerForOrg = ( + params: Params< + t_ActionsCreateHostedRunnerForOrgParamSchema, + void, + t_ActionsCreateHostedRunnerForOrgRequestBodySchema, + void + >, + respond: ActionsCreateHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetHostedRunnersGithubOwnedImagesForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + images: t_actions_hosted_runner_image[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsGetHostedRunnersGithubOwnedImagesForOrg = ( + params: Params< + t_ActionsGetHostedRunnersGithubOwnedImagesForOrgParamSchema, + void, + void, + void + >, + respond: ActionsGetHostedRunnersGithubOwnedImagesForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetHostedRunnersPartnerImagesForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + images: t_actions_hosted_runner_image[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsGetHostedRunnersPartnerImagesForOrg = ( + params: Params< + t_ActionsGetHostedRunnersPartnerImagesForOrgParamSchema, + void, + void, + void + >, + respond: ActionsGetHostedRunnersPartnerImagesForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetHostedRunnersLimitsForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetHostedRunnersLimitsForOrg = ( + params: Params< + t_ActionsGetHostedRunnersLimitsForOrgParamSchema, + void, + void, + void + >, + respond: ActionsGetHostedRunnersLimitsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetHostedRunnersMachineSpecsForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + machine_specs: t_actions_hosted_runner_machine_spec[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsGetHostedRunnersMachineSpecsForOrg = ( + params: Params< + t_ActionsGetHostedRunnersMachineSpecsForOrgParamSchema, + void, + void, + void + >, + respond: ActionsGetHostedRunnersMachineSpecsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetHostedRunnersPlatformsForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + platforms: string[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsGetHostedRunnersPlatformsForOrg = ( + params: Params< + t_ActionsGetHostedRunnersPlatformsForOrgParamSchema, + void, + void, + void + >, + respond: ActionsGetHostedRunnersPlatformsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetHostedRunnerForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetHostedRunnerForOrg = ( + params: Params, + respond: ActionsGetHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsUpdateHostedRunnerForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsUpdateHostedRunnerForOrg = ( + params: Params< + t_ActionsUpdateHostedRunnerForOrgParamSchema, + void, + t_ActionsUpdateHostedRunnerForOrgRequestBodySchema, + void + >, + respond: ActionsUpdateHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteHostedRunnerForOrgResponder = { + with202(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteHostedRunnerForOrg = ( + params: Params< + t_ActionsDeleteHostedRunnerForOrgParamSchema, + void, + void, + void + >, + respond: ActionsDeleteHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OidcGetOidcCustomSubTemplateForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OidcGetOidcCustomSubTemplateForOrg = ( + params: Params< + t_OidcGetOidcCustomSubTemplateForOrgParamSchema, + void, + void, + void + >, + respond: OidcGetOidcCustomSubTemplateForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OidcUpdateOidcCustomSubTemplateForOrgResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OidcUpdateOidcCustomSubTemplateForOrg = ( + params: Params< + t_OidcUpdateOidcCustomSubTemplateForOrgParamSchema, + void, + t_OidcUpdateOidcCustomSubTemplateForOrgRequestBodySchema, + void + >, + respond: OidcUpdateOidcCustomSubTemplateForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetGithubActionsPermissionsOrganizationResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetGithubActionsPermissionsOrganization = ( + params: Params< + t_ActionsGetGithubActionsPermissionsOrganizationParamSchema, + void, + void, + void + >, + respond: ActionsGetGithubActionsPermissionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetGithubActionsPermissionsOrganizationResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetGithubActionsPermissionsOrganization = ( + params: Params< + t_ActionsSetGithubActionsPermissionsOrganizationParamSchema, + void, + t_ActionsSetGithubActionsPermissionsOrganizationRequestBodySchema, + void + >, + respond: ActionsSetGithubActionsPermissionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponder = + { + with200(): ExpressRuntimeResponse<{ + repositories: t_repository[] + total_count: number + }> + } & ExpressRuntimeResponder + +export type ActionsListSelectedRepositoriesEnabledGithubActionsOrganization = ( + params: Params< + t_ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema, + t_ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationQuerySchema, + void, + void + >, + respond: ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationResponder = + { + with204(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type ActionsSetSelectedRepositoriesEnabledGithubActionsOrganization = ( + params: Params< + t_ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema, + void, + t_ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationRequestBodySchema, + void + >, + respond: ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsEnableSelectedRepositoryGithubActionsOrganizationResponder = + { + with204(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type ActionsEnableSelectedRepositoryGithubActionsOrganization = ( + params: Params< + t_ActionsEnableSelectedRepositoryGithubActionsOrganizationParamSchema, + void, + void, + void + >, + respond: ActionsEnableSelectedRepositoryGithubActionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDisableSelectedRepositoryGithubActionsOrganizationResponder = + { + with204(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type ActionsDisableSelectedRepositoryGithubActionsOrganization = ( + params: Params< + t_ActionsDisableSelectedRepositoryGithubActionsOrganizationParamSchema, + void, + void, + void + >, + respond: ActionsDisableSelectedRepositoryGithubActionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetAllowedActionsOrganizationResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetAllowedActionsOrganization = ( + params: Params< + t_ActionsGetAllowedActionsOrganizationParamSchema, + void, + void, + void + >, + respond: ActionsGetAllowedActionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetAllowedActionsOrganizationResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetAllowedActionsOrganization = ( + params: Params< + t_ActionsSetAllowedActionsOrganizationParamSchema, + void, + t_ActionsSetAllowedActionsOrganizationRequestBodySchema | undefined, + void + >, + respond: ActionsSetAllowedActionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationResponder = + { + with200(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type ActionsGetGithubActionsDefaultWorkflowPermissionsOrganization = ( + params: Params< + t_ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema, + void, + void, + void + >, + respond: ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationResponder = + { + with204(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type ActionsSetGithubActionsDefaultWorkflowPermissionsOrganization = ( + params: Params< + t_ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema, + void, + | t_ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationRequestBodySchema + | undefined, + void + >, + respond: ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListSelfHostedRunnerGroupsForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + runner_groups: t_runner_groups_org[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListSelfHostedRunnerGroupsForOrg = ( + params: Params< + t_ActionsListSelfHostedRunnerGroupsForOrgParamSchema, + t_ActionsListSelfHostedRunnerGroupsForOrgQuerySchema, + void, + void + >, + respond: ActionsListSelfHostedRunnerGroupsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateSelfHostedRunnerGroupForOrgResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateSelfHostedRunnerGroupForOrg = ( + params: Params< + t_ActionsCreateSelfHostedRunnerGroupForOrgParamSchema, + void, + t_ActionsCreateSelfHostedRunnerGroupForOrgRequestBodySchema, + void + >, + respond: ActionsCreateSelfHostedRunnerGroupForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetSelfHostedRunnerGroupForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetSelfHostedRunnerGroupForOrg = ( + params: Params< + t_ActionsGetSelfHostedRunnerGroupForOrgParamSchema, + void, + void, + void + >, + respond: ActionsGetSelfHostedRunnerGroupForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsUpdateSelfHostedRunnerGroupForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsUpdateSelfHostedRunnerGroupForOrg = ( + params: Params< + t_ActionsUpdateSelfHostedRunnerGroupForOrgParamSchema, + void, + t_ActionsUpdateSelfHostedRunnerGroupForOrgRequestBodySchema, + void + >, + respond: ActionsUpdateSelfHostedRunnerGroupForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteSelfHostedRunnerGroupFromOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteSelfHostedRunnerGroupFromOrg = ( + params: Params< + t_ActionsDeleteSelfHostedRunnerGroupFromOrgParamSchema, + void, + void, + void + >, + respond: ActionsDeleteSelfHostedRunnerGroupFromOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListGithubHostedRunnersInGroupForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + runners: t_actions_hosted_runner[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListGithubHostedRunnersInGroupForOrg = ( + params: Params< + t_ActionsListGithubHostedRunnersInGroupForOrgParamSchema, + t_ActionsListGithubHostedRunnersInGroupForOrgQuerySchema, + void, + void + >, + respond: ActionsListGithubHostedRunnersInGroupForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponder = { + with200(): ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListRepoAccessToSelfHostedRunnerGroupInOrg = ( + params: Params< + t_ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + t_ActionsListRepoAccessToSelfHostedRunnerGroupInOrgQuerySchema, + void, + void + >, + respond: ActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetRepoAccessToSelfHostedRunnerGroupInOrg = ( + params: Params< + t_ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + void, + t_ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgRequestBodySchema, + void + >, + respond: ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsAddRepoAccessToSelfHostedRunnerGroupInOrg = ( + params: Params< + t_ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + void, + void, + void + >, + respond: ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg = ( + params: Params< + t_ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + void, + void, + void + >, + respond: ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListSelfHostedRunnersInGroupForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + runners: t_runner[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListSelfHostedRunnersInGroupForOrg = ( + params: Params< + t_ActionsListSelfHostedRunnersInGroupForOrgParamSchema, + t_ActionsListSelfHostedRunnersInGroupForOrgQuerySchema, + void, + void + >, + respond: ActionsListSelfHostedRunnersInGroupForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetSelfHostedRunnersInGroupForOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetSelfHostedRunnersInGroupForOrg = ( + params: Params< + t_ActionsSetSelfHostedRunnersInGroupForOrgParamSchema, + void, + t_ActionsSetSelfHostedRunnersInGroupForOrgRequestBodySchema, + void + >, + respond: ActionsSetSelfHostedRunnersInGroupForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsAddSelfHostedRunnerToGroupForOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsAddSelfHostedRunnerToGroupForOrg = ( + params: Params< + t_ActionsAddSelfHostedRunnerToGroupForOrgParamSchema, + void, + void, + void + >, + respond: ActionsAddSelfHostedRunnerToGroupForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsRemoveSelfHostedRunnerFromGroupForOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsRemoveSelfHostedRunnerFromGroupForOrg = ( + params: Params< + t_ActionsRemoveSelfHostedRunnerFromGroupForOrgParamSchema, + void, + void, + void + >, + respond: ActionsRemoveSelfHostedRunnerFromGroupForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListSelfHostedRunnersForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + runners: t_runner[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListSelfHostedRunnersForOrg = ( + params: Params< + t_ActionsListSelfHostedRunnersForOrgParamSchema, + t_ActionsListSelfHostedRunnersForOrgQuerySchema, + void, + void + >, + respond: ActionsListSelfHostedRunnersForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListRunnerApplicationsForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsListRunnerApplicationsForOrg = ( + params: Params< + t_ActionsListRunnerApplicationsForOrgParamSchema, + void, + void, + void + >, + respond: ActionsListRunnerApplicationsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGenerateRunnerJitconfigForOrgResponder = { + with201(): ExpressRuntimeResponse<{ + encoded_jit_config: string + runner: t_runner + }> + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGenerateRunnerJitconfigForOrg = ( + params: Params< + t_ActionsGenerateRunnerJitconfigForOrgParamSchema, + void, + t_ActionsGenerateRunnerJitconfigForOrgRequestBodySchema, + void + >, + respond: ActionsGenerateRunnerJitconfigForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateRegistrationTokenForOrgResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateRegistrationTokenForOrg = ( + params: Params< + t_ActionsCreateRegistrationTokenForOrgParamSchema, + void, + void, + void + >, + respond: ActionsCreateRegistrationTokenForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateRemoveTokenForOrgResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateRemoveTokenForOrg = ( + params: Params, + respond: ActionsCreateRemoveTokenForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetSelfHostedRunnerForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetSelfHostedRunnerForOrg = ( + params: Params< + t_ActionsGetSelfHostedRunnerForOrgParamSchema, + void, + void, + void + >, + respond: ActionsGetSelfHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteSelfHostedRunnerFromOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteSelfHostedRunnerFromOrg = ( + params: Params< + t_ActionsDeleteSelfHostedRunnerFromOrgParamSchema, + void, + void, + void + >, + respond: ActionsDeleteSelfHostedRunnerFromOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListLabelsForSelfHostedRunnerForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsListLabelsForSelfHostedRunnerForOrg = ( + params: Params< + t_ActionsListLabelsForSelfHostedRunnerForOrgParamSchema, + void, + void, + void + >, + respond: ActionsListLabelsForSelfHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsAddCustomLabelsToSelfHostedRunnerForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsAddCustomLabelsToSelfHostedRunnerForOrg = ( + params: Params< + t_ActionsAddCustomLabelsToSelfHostedRunnerForOrgParamSchema, + void, + t_ActionsAddCustomLabelsToSelfHostedRunnerForOrgRequestBodySchema, + void + >, + respond: ActionsAddCustomLabelsToSelfHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetCustomLabelsForSelfHostedRunnerForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetCustomLabelsForSelfHostedRunnerForOrg = ( + params: Params< + t_ActionsSetCustomLabelsForSelfHostedRunnerForOrgParamSchema, + void, + t_ActionsSetCustomLabelsForSelfHostedRunnerForOrgRequestBodySchema, + void + >, + respond: ActionsSetCustomLabelsForSelfHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrg = ( + params: Params< + t_ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgParamSchema, + void, + void, + void + >, + respond: ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsRemoveCustomLabelFromSelfHostedRunnerForOrg = ( + params: Params< + t_ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgParamSchema, + void, + void, + void + >, + respond: ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListOrgSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_organization_actions_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListOrgSecrets = ( + params: Params< + t_ActionsListOrgSecretsParamSchema, + t_ActionsListOrgSecretsQuerySchema, + void, + void + >, + respond: ActionsListOrgSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetOrgPublicKeyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetOrgPublicKey = ( + params: Params, + respond: ActionsGetOrgPublicKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetOrgSecretResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetOrgSecret = ( + params: Params, + respond: ActionsGetOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateOrUpdateOrgSecretResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateOrUpdateOrgSecret = ( + params: Params< + t_ActionsCreateOrUpdateOrgSecretParamSchema, + void, + t_ActionsCreateOrUpdateOrgSecretRequestBodySchema, + void + >, + respond: ActionsCreateOrUpdateOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteOrgSecretResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteOrgSecret = ( + params: Params, + respond: ActionsDeleteOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListSelectedReposForOrgSecretResponder = { + with200(): ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListSelectedReposForOrgSecret = ( + params: Params< + t_ActionsListSelectedReposForOrgSecretParamSchema, + t_ActionsListSelectedReposForOrgSecretQuerySchema, + void, + void + >, + respond: ActionsListSelectedReposForOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetSelectedReposForOrgSecretResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetSelectedReposForOrgSecret = ( + params: Params< + t_ActionsSetSelectedReposForOrgSecretParamSchema, + void, + t_ActionsSetSelectedReposForOrgSecretRequestBodySchema, + void + >, + respond: ActionsSetSelectedReposForOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsAddSelectedRepoToOrgSecretResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsAddSelectedRepoToOrgSecret = ( + params: Params< + t_ActionsAddSelectedRepoToOrgSecretParamSchema, + void, + void, + void + >, + respond: ActionsAddSelectedRepoToOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsRemoveSelectedRepoFromOrgSecretResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsRemoveSelectedRepoFromOrgSecret = ( + params: Params< + t_ActionsRemoveSelectedRepoFromOrgSecretParamSchema, + void, + void, + void + >, + respond: ActionsRemoveSelectedRepoFromOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListOrgVariablesResponder = { + with200(): ExpressRuntimeResponse<{ + total_count: number + variables: t_organization_actions_variable[] + }> +} & ExpressRuntimeResponder + +export type ActionsListOrgVariables = ( + params: Params< + t_ActionsListOrgVariablesParamSchema, + t_ActionsListOrgVariablesQuerySchema, + void, + void + >, + respond: ActionsListOrgVariablesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateOrgVariableResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateOrgVariable = ( + params: Params< + t_ActionsCreateOrgVariableParamSchema, + void, + t_ActionsCreateOrgVariableRequestBodySchema, + void + >, + respond: ActionsCreateOrgVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetOrgVariableResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetOrgVariable = ( + params: Params, + respond: ActionsGetOrgVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsUpdateOrgVariableResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsUpdateOrgVariable = ( + params: Params< + t_ActionsUpdateOrgVariableParamSchema, + void, + t_ActionsUpdateOrgVariableRequestBodySchema, + void + >, + respond: ActionsUpdateOrgVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteOrgVariableResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteOrgVariable = ( + params: Params, + respond: ActionsDeleteOrgVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListSelectedReposForOrgVariableResponder = { + with200(): ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }> + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsListSelectedReposForOrgVariable = ( + params: Params< + t_ActionsListSelectedReposForOrgVariableParamSchema, + t_ActionsListSelectedReposForOrgVariableQuerySchema, + void, + void + >, + respond: ActionsListSelectedReposForOrgVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetSelectedReposForOrgVariableResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetSelectedReposForOrgVariable = ( + params: Params< + t_ActionsSetSelectedReposForOrgVariableParamSchema, + void, + t_ActionsSetSelectedReposForOrgVariableRequestBodySchema, + void + >, + respond: ActionsSetSelectedReposForOrgVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsAddSelectedRepoToOrgVariableResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsAddSelectedRepoToOrgVariable = ( + params: Params< + t_ActionsAddSelectedRepoToOrgVariableParamSchema, + void, + void, + void + >, + respond: ActionsAddSelectedRepoToOrgVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsRemoveSelectedRepoFromOrgVariableResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsRemoveSelectedRepoFromOrgVariable = ( + params: Params< + t_ActionsRemoveSelectedRepoFromOrgVariableParamSchema, + void, + void, + void + >, + respond: ActionsRemoveSelectedRepoFromOrgVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListAttestationsResponder = { + with200(): ExpressRuntimeResponse<{ + attestations?: + | { + bundle?: + | { + dsseEnvelope?: + | { + [key: string]: unknown | undefined + } + | undefined + mediaType?: string | undefined + verificationMaterial?: + | { + [key: string]: unknown | undefined + } + | undefined + } + | undefined + bundle_url?: string | undefined + repository_id?: number | undefined + }[] + | undefined + }> +} & ExpressRuntimeResponder + +export type OrgsListAttestations = ( + params: Params< + t_OrgsListAttestationsParamSchema, + t_OrgsListAttestationsQuerySchema, + void, + void + >, + respond: OrgsListAttestationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListBlockedUsersResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListBlockedUsers = ( + params: Params< + t_OrgsListBlockedUsersParamSchema, + t_OrgsListBlockedUsersQuerySchema, + void, + void + >, + respond: OrgsListBlockedUsersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCheckBlockedUserResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCheckBlockedUser = ( + params: Params, + respond: OrgsCheckBlockedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsBlockUserResponder = { + with204(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsBlockUser = ( + params: Params, + respond: OrgsBlockUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsUnblockUserResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsUnblockUser = ( + params: Params, + respond: OrgsUnblockUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CampaignsListOrgCampaignsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CampaignsListOrgCampaigns = ( + params: Params< + t_CampaignsListOrgCampaignsParamSchema, + t_CampaignsListOrgCampaignsQuerySchema, + void, + void + >, + respond: CampaignsListOrgCampaignsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CampaignsCreateCampaignResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CampaignsCreateCampaign = ( + params: Params< + t_CampaignsCreateCampaignParamSchema, + void, + t_CampaignsCreateCampaignRequestBodySchema, + void + >, + respond: CampaignsCreateCampaignResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CampaignsGetCampaignSummaryResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CampaignsGetCampaignSummary = ( + params: Params, + respond: CampaignsGetCampaignSummaryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CampaignsUpdateCampaignResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CampaignsUpdateCampaign = ( + params: Params< + t_CampaignsUpdateCampaignParamSchema, + void, + t_CampaignsUpdateCampaignRequestBodySchema, + void + >, + respond: CampaignsUpdateCampaignResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CampaignsDeleteCampaignResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CampaignsDeleteCampaign = ( + params: Params, + respond: CampaignsDeleteCampaignResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningListAlertsForOrgResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningListAlertsForOrg = ( + params: Params< + t_CodeScanningListAlertsForOrgParamSchema, + t_CodeScanningListAlertsForOrgQuerySchema, + void, + void + >, + respond: CodeScanningListAlertsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetConfigurationsForOrgResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetConfigurationsForOrg = ( + params: Params< + t_CodeSecurityGetConfigurationsForOrgParamSchema, + t_CodeSecurityGetConfigurationsForOrgQuerySchema, + void, + void + >, + respond: CodeSecurityGetConfigurationsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityCreateConfigurationResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityCreateConfiguration = ( + params: Params< + t_CodeSecurityCreateConfigurationParamSchema, + void, + t_CodeSecurityCreateConfigurationRequestBodySchema, + void + >, + respond: CodeSecurityCreateConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetDefaultConfigurationsResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetDefaultConfigurations = ( + params: Params< + t_CodeSecurityGetDefaultConfigurationsParamSchema, + void, + void, + void + >, + respond: CodeSecurityGetDefaultConfigurationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityDetachConfigurationResponder = { + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityDetachConfiguration = ( + params: Params< + t_CodeSecurityDetachConfigurationParamSchema, + void, + t_CodeSecurityDetachConfigurationRequestBodySchema, + void + >, + respond: CodeSecurityDetachConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetConfigurationResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetConfiguration = ( + params: Params, + respond: CodeSecurityGetConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityUpdateConfigurationResponder = { + with200(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityUpdateConfiguration = ( + params: Params< + t_CodeSecurityUpdateConfigurationParamSchema, + void, + t_CodeSecurityUpdateConfigurationRequestBodySchema, + void + >, + respond: CodeSecurityUpdateConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityDeleteConfigurationResponder = { + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityDeleteConfiguration = ( + params: Params< + t_CodeSecurityDeleteConfigurationParamSchema, + void, + void, + void + >, + respond: CodeSecurityDeleteConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityAttachConfigurationResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> +} & ExpressRuntimeResponder + +export type CodeSecurityAttachConfiguration = ( + params: Params< + t_CodeSecurityAttachConfigurationParamSchema, + void, + t_CodeSecurityAttachConfigurationRequestBodySchema, + void + >, + respond: CodeSecurityAttachConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecuritySetConfigurationAsDefaultResponder = { + with200(): ExpressRuntimeResponse<{ + configuration?: t_code_security_configuration | undefined + default_for_new_repos?: + | ("all" | "none" | "private_and_internal" | "public") + | undefined + }> + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecuritySetConfigurationAsDefault = ( + params: Params< + t_CodeSecuritySetConfigurationAsDefaultParamSchema, + void, + t_CodeSecuritySetConfigurationAsDefaultRequestBodySchema, + void + >, + respond: CodeSecuritySetConfigurationAsDefaultResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetRepositoriesForConfigurationResponder = { + with200(): ExpressRuntimeResponse< + t_code_security_configuration_repositories[] + > + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetRepositoriesForConfiguration = ( + params: Params< + t_CodeSecurityGetRepositoriesForConfigurationParamSchema, + t_CodeSecurityGetRepositoriesForConfigurationQuerySchema, + void, + void + >, + respond: CodeSecurityGetRepositoriesForConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListInOrganizationResponder = { + with200(): ExpressRuntimeResponse<{ + codespaces: t_codespace[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesListInOrganization = ( + params: Params< + t_CodespacesListInOrganizationParamSchema, + t_CodespacesListInOrganizationQuerySchema, + void, + void + >, + respond: CodespacesListInOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesSetCodespacesAccessResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesSetCodespacesAccess = ( + params: Params< + t_CodespacesSetCodespacesAccessParamSchema, + void, + t_CodespacesSetCodespacesAccessRequestBodySchema, + void + >, + respond: CodespacesSetCodespacesAccessResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesSetCodespacesAccessUsersResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesSetCodespacesAccessUsers = ( + params: Params< + t_CodespacesSetCodespacesAccessUsersParamSchema, + void, + t_CodespacesSetCodespacesAccessUsersRequestBodySchema, + void + >, + respond: CodespacesSetCodespacesAccessUsersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesDeleteCodespacesAccessUsersResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesDeleteCodespacesAccessUsers = ( + params: Params< + t_CodespacesDeleteCodespacesAccessUsersParamSchema, + void, + t_CodespacesDeleteCodespacesAccessUsersRequestBodySchema, + void + >, + respond: CodespacesDeleteCodespacesAccessUsersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListOrgSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_codespaces_org_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type CodespacesListOrgSecrets = ( + params: Params< + t_CodespacesListOrgSecretsParamSchema, + t_CodespacesListOrgSecretsQuerySchema, + void, + void + >, + respond: CodespacesListOrgSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetOrgPublicKeyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetOrgPublicKey = ( + params: Params, + respond: CodespacesGetOrgPublicKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetOrgSecretResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetOrgSecret = ( + params: Params, + respond: CodespacesGetOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesCreateOrUpdateOrgSecretResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesCreateOrUpdateOrgSecret = ( + params: Params< + t_CodespacesCreateOrUpdateOrgSecretParamSchema, + void, + t_CodespacesCreateOrUpdateOrgSecretRequestBodySchema, + void + >, + respond: CodespacesCreateOrUpdateOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesDeleteOrgSecretResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesDeleteOrgSecret = ( + params: Params, + respond: CodespacesDeleteOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListSelectedReposForOrgSecretResponder = { + with200(): ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesListSelectedReposForOrgSecret = ( + params: Params< + t_CodespacesListSelectedReposForOrgSecretParamSchema, + t_CodespacesListSelectedReposForOrgSecretQuerySchema, + void, + void + >, + respond: CodespacesListSelectedReposForOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesSetSelectedReposForOrgSecretResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesSetSelectedReposForOrgSecret = ( + params: Params< + t_CodespacesSetSelectedReposForOrgSecretParamSchema, + void, + t_CodespacesSetSelectedReposForOrgSecretRequestBodySchema, + void + >, + respond: CodespacesSetSelectedReposForOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesAddSelectedRepoToOrgSecretResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesAddSelectedRepoToOrgSecret = ( + params: Params< + t_CodespacesAddSelectedRepoToOrgSecretParamSchema, + void, + void, + void + >, + respond: CodespacesAddSelectedRepoToOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesRemoveSelectedRepoFromOrgSecretResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesRemoveSelectedRepoFromOrgSecret = ( + params: Params< + t_CodespacesRemoveSelectedRepoFromOrgSecretParamSchema, + void, + void, + void + >, + respond: CodespacesRemoveSelectedRepoFromOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotGetCopilotOrganizationDetailsResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotGetCopilotOrganizationDetails = ( + params: Params< + t_CopilotGetCopilotOrganizationDetailsParamSchema, + void, + void, + void + >, + respond: CopilotGetCopilotOrganizationDetailsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotListCopilotSeatsResponder = { + with200(): ExpressRuntimeResponse<{ + seats?: t_copilot_seat_details[] | undefined + total_seats?: number | undefined + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotListCopilotSeats = ( + params: Params< + t_CopilotListCopilotSeatsParamSchema, + t_CopilotListCopilotSeatsQuerySchema, + void, + void + >, + respond: CopilotListCopilotSeatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotAddCopilotSeatsForTeamsResponder = { + with201(): ExpressRuntimeResponse<{ + seats_created: number + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotAddCopilotSeatsForTeams = ( + params: Params< + t_CopilotAddCopilotSeatsForTeamsParamSchema, + void, + t_CopilotAddCopilotSeatsForTeamsRequestBodySchema, + void + >, + respond: CopilotAddCopilotSeatsForTeamsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotCancelCopilotSeatAssignmentForTeamsResponder = { + with200(): ExpressRuntimeResponse<{ + seats_cancelled: number + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotCancelCopilotSeatAssignmentForTeams = ( + params: Params< + t_CopilotCancelCopilotSeatAssignmentForTeamsParamSchema, + void, + t_CopilotCancelCopilotSeatAssignmentForTeamsRequestBodySchema, + void + >, + respond: CopilotCancelCopilotSeatAssignmentForTeamsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotAddCopilotSeatsForUsersResponder = { + with201(): ExpressRuntimeResponse<{ + seats_created: number + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotAddCopilotSeatsForUsers = ( + params: Params< + t_CopilotAddCopilotSeatsForUsersParamSchema, + void, + t_CopilotAddCopilotSeatsForUsersRequestBodySchema, + void + >, + respond: CopilotAddCopilotSeatsForUsersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotCancelCopilotSeatAssignmentForUsersResponder = { + with200(): ExpressRuntimeResponse<{ + seats_cancelled: number + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotCancelCopilotSeatAssignmentForUsers = ( + params: Params< + t_CopilotCancelCopilotSeatAssignmentForUsersParamSchema, + void, + t_CopilotCancelCopilotSeatAssignmentForUsersRequestBodySchema, + void + >, + respond: CopilotCancelCopilotSeatAssignmentForUsersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotCopilotMetricsForOrganizationResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotCopilotMetricsForOrganization = ( + params: Params< + t_CopilotCopilotMetricsForOrganizationParamSchema, + t_CopilotCopilotMetricsForOrganizationQuerySchema, + void, + void + >, + respond: CopilotCopilotMetricsForOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotListAlertsForOrgResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotListAlertsForOrg = ( + params: Params< + t_DependabotListAlertsForOrgParamSchema, + t_DependabotListAlertsForOrgQuerySchema, + void, + void + >, + respond: DependabotListAlertsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotListOrgSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_organization_dependabot_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type DependabotListOrgSecrets = ( + params: Params< + t_DependabotListOrgSecretsParamSchema, + t_DependabotListOrgSecretsQuerySchema, + void, + void + >, + respond: DependabotListOrgSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotGetOrgPublicKeyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotGetOrgPublicKey = ( + params: Params, + respond: DependabotGetOrgPublicKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotGetOrgSecretResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotGetOrgSecret = ( + params: Params, + respond: DependabotGetOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotCreateOrUpdateOrgSecretResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotCreateOrUpdateOrgSecret = ( + params: Params< + t_DependabotCreateOrUpdateOrgSecretParamSchema, + void, + t_DependabotCreateOrUpdateOrgSecretRequestBodySchema, + void + >, + respond: DependabotCreateOrUpdateOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotDeleteOrgSecretResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotDeleteOrgSecret = ( + params: Params, + respond: DependabotDeleteOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotListSelectedReposForOrgSecretResponder = { + with200(): ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type DependabotListSelectedReposForOrgSecret = ( + params: Params< + t_DependabotListSelectedReposForOrgSecretParamSchema, + t_DependabotListSelectedReposForOrgSecretQuerySchema, + void, + void + >, + respond: DependabotListSelectedReposForOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotSetSelectedReposForOrgSecretResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotSetSelectedReposForOrgSecret = ( + params: Params< + t_DependabotSetSelectedReposForOrgSecretParamSchema, + void, + t_DependabotSetSelectedReposForOrgSecretRequestBodySchema, + void + >, + respond: DependabotSetSelectedReposForOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotAddSelectedRepoToOrgSecretResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotAddSelectedRepoToOrgSecret = ( + params: Params< + t_DependabotAddSelectedRepoToOrgSecretParamSchema, + void, + void, + void + >, + respond: DependabotAddSelectedRepoToOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotRemoveSelectedRepoFromOrgSecretResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotRemoveSelectedRepoFromOrgSecret = ( + params: Params< + t_DependabotRemoveSelectedRepoFromOrgSecretParamSchema, + void, + void, + void + >, + respond: DependabotRemoveSelectedRepoFromOrgSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesListDockerMigrationConflictingPackagesForOrganizationResponder = + { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PackagesListDockerMigrationConflictingPackagesForOrganization = ( + params: Params< + t_PackagesListDockerMigrationConflictingPackagesForOrganizationParamSchema, + void, + void, + void + >, + respond: PackagesListDockerMigrationConflictingPackagesForOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListPublicOrgEventsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListPublicOrgEvents = ( + params: Params< + t_ActivityListPublicOrgEventsParamSchema, + t_ActivityListPublicOrgEventsQuerySchema, + void, + void + >, + respond: ActivityListPublicOrgEventsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListFailedInvitationsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListFailedInvitations = ( + params: Params< + t_OrgsListFailedInvitationsParamSchema, + t_OrgsListFailedInvitationsQuerySchema, + void, + void + >, + respond: OrgsListFailedInvitationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListWebhooksResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListWebhooks = ( + params: Params< + t_OrgsListWebhooksParamSchema, + t_OrgsListWebhooksQuerySchema, + void, + void + >, + respond: OrgsListWebhooksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCreateWebhookResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCreateWebhook = ( + params: Params< + t_OrgsCreateWebhookParamSchema, + void, + t_OrgsCreateWebhookRequestBodySchema, + void + >, + respond: OrgsCreateWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetWebhookResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetWebhook = ( + params: Params, + respond: OrgsGetWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsUpdateWebhookResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsUpdateWebhook = ( + params: Params< + t_OrgsUpdateWebhookParamSchema, + void, + t_OrgsUpdateWebhookRequestBodySchema | undefined, + void + >, + respond: OrgsUpdateWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsDeleteWebhookResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsDeleteWebhook = ( + params: Params, + respond: OrgsDeleteWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetWebhookConfigForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetWebhookConfigForOrg = ( + params: Params, + respond: OrgsGetWebhookConfigForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsUpdateWebhookConfigForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsUpdateWebhookConfigForOrg = ( + params: Params< + t_OrgsUpdateWebhookConfigForOrgParamSchema, + void, + t_OrgsUpdateWebhookConfigForOrgRequestBodySchema | undefined, + void + >, + respond: OrgsUpdateWebhookConfigForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListWebhookDeliveriesResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListWebhookDeliveries = ( + params: Params< + t_OrgsListWebhookDeliveriesParamSchema, + t_OrgsListWebhookDeliveriesQuerySchema, + void, + void + >, + respond: OrgsListWebhookDeliveriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetWebhookDeliveryResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetWebhookDelivery = ( + params: Params, + respond: OrgsGetWebhookDeliveryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRedeliverWebhookDeliveryResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRedeliverWebhookDelivery = ( + params: Params, + respond: OrgsRedeliverWebhookDeliveryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsPingWebhookResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsPingWebhook = ( + params: Params, + respond: OrgsPingWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetRouteStatsByActorResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetRouteStatsByActor = ( + params: Params< + t_ApiInsightsGetRouteStatsByActorParamSchema, + t_ApiInsightsGetRouteStatsByActorQuerySchema, + void, + void + >, + respond: ApiInsightsGetRouteStatsByActorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetSubjectStatsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetSubjectStats = ( + params: Params< + t_ApiInsightsGetSubjectStatsParamSchema, + t_ApiInsightsGetSubjectStatsQuerySchema, + void, + void + >, + respond: ApiInsightsGetSubjectStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetSummaryStatsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetSummaryStats = ( + params: Params< + t_ApiInsightsGetSummaryStatsParamSchema, + t_ApiInsightsGetSummaryStatsQuerySchema, + void, + void + >, + respond: ApiInsightsGetSummaryStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetSummaryStatsByUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetSummaryStatsByUser = ( + params: Params< + t_ApiInsightsGetSummaryStatsByUserParamSchema, + t_ApiInsightsGetSummaryStatsByUserQuerySchema, + void, + void + >, + respond: ApiInsightsGetSummaryStatsByUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetSummaryStatsByActorResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetSummaryStatsByActor = ( + params: Params< + t_ApiInsightsGetSummaryStatsByActorParamSchema, + t_ApiInsightsGetSummaryStatsByActorQuerySchema, + void, + void + >, + respond: ApiInsightsGetSummaryStatsByActorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetTimeStatsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetTimeStats = ( + params: Params< + t_ApiInsightsGetTimeStatsParamSchema, + t_ApiInsightsGetTimeStatsQuerySchema, + void, + void + >, + respond: ApiInsightsGetTimeStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetTimeStatsByUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetTimeStatsByUser = ( + params: Params< + t_ApiInsightsGetTimeStatsByUserParamSchema, + t_ApiInsightsGetTimeStatsByUserQuerySchema, + void, + void + >, + respond: ApiInsightsGetTimeStatsByUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetTimeStatsByActorResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetTimeStatsByActor = ( + params: Params< + t_ApiInsightsGetTimeStatsByActorParamSchema, + t_ApiInsightsGetTimeStatsByActorQuerySchema, + void, + void + >, + respond: ApiInsightsGetTimeStatsByActorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ApiInsightsGetUserStatsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ApiInsightsGetUserStats = ( + params: Params< + t_ApiInsightsGetUserStatsParamSchema, + t_ApiInsightsGetUserStatsQuerySchema, + void, + void + >, + respond: ApiInsightsGetUserStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetOrgInstallationResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetOrgInstallation = ( + params: Params, + respond: AppsGetOrgInstallationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListAppInstallationsResponder = { + with200(): ExpressRuntimeResponse<{ + installations: t_installation[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type OrgsListAppInstallations = ( + params: Params< + t_OrgsListAppInstallationsParamSchema, + t_OrgsListAppInstallationsQuerySchema, + void, + void + >, + respond: OrgsListAppInstallationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsGetRestrictionsForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsGetRestrictionsForOrg = ( + params: Params< + t_InteractionsGetRestrictionsForOrgParamSchema, + void, + void, + void + >, + respond: InteractionsGetRestrictionsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsSetRestrictionsForOrgResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsSetRestrictionsForOrg = ( + params: Params< + t_InteractionsSetRestrictionsForOrgParamSchema, + void, + t_InteractionsSetRestrictionsForOrgRequestBodySchema, + void + >, + respond: InteractionsSetRestrictionsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsRemoveRestrictionsForOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsRemoveRestrictionsForOrg = ( + params: Params< + t_InteractionsRemoveRestrictionsForOrgParamSchema, + void, + void, + void + >, + respond: InteractionsRemoveRestrictionsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListPendingInvitationsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListPendingInvitations = ( + params: Params< + t_OrgsListPendingInvitationsParamSchema, + t_OrgsListPendingInvitationsQuerySchema, + void, + void + >, + respond: OrgsListPendingInvitationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCreateInvitationResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCreateInvitation = ( + params: Params< + t_OrgsCreateInvitationParamSchema, + void, + t_OrgsCreateInvitationRequestBodySchema | undefined, + void + >, + respond: OrgsCreateInvitationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCancelInvitationResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCancelInvitation = ( + params: Params, + respond: OrgsCancelInvitationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListInvitationTeamsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListInvitationTeams = ( + params: Params< + t_OrgsListInvitationTeamsParamSchema, + t_OrgsListInvitationTeamsQuerySchema, + void, + void + >, + respond: OrgsListInvitationTeamsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListIssueTypesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListIssueTypes = ( + params: Params, + respond: OrgsListIssueTypesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCreateIssueTypeResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCreateIssueType = ( + params: Params< + t_OrgsCreateIssueTypeParamSchema, + void, + t_OrgsCreateIssueTypeRequestBodySchema, + void + >, + respond: OrgsCreateIssueTypeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsUpdateIssueTypeResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsUpdateIssueType = ( + params: Params< + t_OrgsUpdateIssueTypeParamSchema, + void, + t_OrgsUpdateIssueTypeRequestBodySchema, + void + >, + respond: OrgsUpdateIssueTypeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsDeleteIssueTypeResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsDeleteIssueType = ( + params: Params, + respond: OrgsDeleteIssueTypeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListForOrgResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListForOrg = ( + params: Params< + t_IssuesListForOrgParamSchema, + t_IssuesListForOrgQuerySchema, + void, + void + >, + respond: IssuesListForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListMembersResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListMembers = ( + params: Params< + t_OrgsListMembersParamSchema, + t_OrgsListMembersQuerySchema, + void, + void + >, + respond: OrgsListMembersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCheckMembershipForUserResponder = { + with204(): ExpressRuntimeResponse + with302(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCheckMembershipForUser = ( + params: Params, + respond: OrgsCheckMembershipForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRemoveMemberResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRemoveMember = ( + params: Params, + respond: OrgsRemoveMemberResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetCodespacesForUserInOrgResponder = { + with200(): ExpressRuntimeResponse<{ + codespaces: t_codespace[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetCodespacesForUserInOrg = ( + params: Params< + t_CodespacesGetCodespacesForUserInOrgParamSchema, + t_CodespacesGetCodespacesForUserInOrgQuerySchema, + void, + void + >, + respond: CodespacesGetCodespacesForUserInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesDeleteFromOrganizationResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesDeleteFromOrganization = ( + params: Params< + t_CodespacesDeleteFromOrganizationParamSchema, + void, + void, + void + >, + respond: CodespacesDeleteFromOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesStopInOrganizationResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesStopInOrganization = ( + params: Params, + respond: CodespacesStopInOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotGetCopilotSeatDetailsForUserResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotGetCopilotSeatDetailsForUser = ( + params: Params< + t_CopilotGetCopilotSeatDetailsForUserParamSchema, + void, + void, + void + >, + respond: CopilotGetCopilotSeatDetailsForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetMembershipForUserResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetMembershipForUser = ( + params: Params, + respond: OrgsGetMembershipForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsSetMembershipForUserResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsSetMembershipForUser = ( + params: Params< + t_OrgsSetMembershipForUserParamSchema, + void, + t_OrgsSetMembershipForUserRequestBodySchema | undefined, + void + >, + respond: OrgsSetMembershipForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRemoveMembershipForUserResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRemoveMembershipForUser = ( + params: Params, + respond: OrgsRemoveMembershipForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsListForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsListForOrg = ( + params: Params< + t_MigrationsListForOrgParamSchema, + t_MigrationsListForOrgQuerySchema, + void, + void + >, + respond: MigrationsListForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsStartForOrgResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsStartForOrg = ( + params: Params< + t_MigrationsStartForOrgParamSchema, + void, + t_MigrationsStartForOrgRequestBodySchema, + void + >, + respond: MigrationsStartForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsGetStatusForOrgResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsGetStatusForOrg = ( + params: Params< + t_MigrationsGetStatusForOrgParamSchema, + t_MigrationsGetStatusForOrgQuerySchema, + void, + void + >, + respond: MigrationsGetStatusForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsDownloadArchiveForOrgResponder = { + with302(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsDownloadArchiveForOrg = ( + params: Params< + t_MigrationsDownloadArchiveForOrgParamSchema, + void, + void, + void + >, + respond: MigrationsDownloadArchiveForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsDeleteArchiveForOrgResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsDeleteArchiveForOrg = ( + params: Params, + respond: MigrationsDeleteArchiveForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsUnlockRepoForOrgResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsUnlockRepoForOrg = ( + params: Params, + respond: MigrationsUnlockRepoForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsListReposForOrgResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsListReposForOrg = ( + params: Params< + t_MigrationsListReposForOrgParamSchema, + t_MigrationsListReposForOrgQuerySchema, + void, + void + >, + respond: MigrationsListReposForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListOrgRolesResponder = { + with200(): ExpressRuntimeResponse<{ + roles?: t_organization_role[] | undefined + total_count?: number | undefined + }> + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListOrgRoles = ( + params: Params, + respond: OrgsListOrgRolesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRevokeAllOrgRolesTeamResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRevokeAllOrgRolesTeam = ( + params: Params, + respond: OrgsRevokeAllOrgRolesTeamResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsAssignTeamToOrgRoleResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsAssignTeamToOrgRole = ( + params: Params, + respond: OrgsAssignTeamToOrgRoleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRevokeOrgRoleTeamResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRevokeOrgRoleTeam = ( + params: Params, + respond: OrgsRevokeOrgRoleTeamResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRevokeAllOrgRolesUserResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRevokeAllOrgRolesUser = ( + params: Params, + respond: OrgsRevokeAllOrgRolesUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsAssignUserToOrgRoleResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsAssignUserToOrgRole = ( + params: Params, + respond: OrgsAssignUserToOrgRoleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRevokeOrgRoleUserResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRevokeOrgRoleUser = ( + params: Params, + respond: OrgsRevokeOrgRoleUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetOrgRoleResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetOrgRole = ( + params: Params, + respond: OrgsGetOrgRoleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListOrgRoleTeamsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListOrgRoleTeams = ( + params: Params< + t_OrgsListOrgRoleTeamsParamSchema, + t_OrgsListOrgRoleTeamsQuerySchema, + void, + void + >, + respond: OrgsListOrgRoleTeamsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListOrgRoleUsersResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListOrgRoleUsers = ( + params: Params< + t_OrgsListOrgRoleUsersParamSchema, + t_OrgsListOrgRoleUsersQuerySchema, + void, + void + >, + respond: OrgsListOrgRoleUsersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListOutsideCollaboratorsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListOutsideCollaborators = ( + params: Params< + t_OrgsListOutsideCollaboratorsParamSchema, + t_OrgsListOutsideCollaboratorsQuerySchema, + void, + void + >, + respond: OrgsListOutsideCollaboratorsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsConvertMemberToOutsideCollaboratorResponder = { + with202(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsConvertMemberToOutsideCollaborator = ( + params: Params< + t_OrgsConvertMemberToOutsideCollaboratorParamSchema, + void, + t_OrgsConvertMemberToOutsideCollaboratorRequestBodySchema | undefined, + void + >, + respond: OrgsConvertMemberToOutsideCollaboratorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRemoveOutsideCollaboratorResponder = { + with204(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type OrgsRemoveOutsideCollaborator = ( + params: Params, + respond: OrgsRemoveOutsideCollaboratorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesListPackagesForOrganizationResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesListPackagesForOrganization = ( + params: Params< + t_PackagesListPackagesForOrganizationParamSchema, + t_PackagesListPackagesForOrganizationQuerySchema, + void, + void + >, + respond: PackagesListPackagesForOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetPackageForOrganizationResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesGetPackageForOrganization = ( + params: Params< + t_PackagesGetPackageForOrganizationParamSchema, + void, + void, + void + >, + respond: PackagesGetPackageForOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesDeletePackageForOrgResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesDeletePackageForOrg = ( + params: Params, + respond: PackagesDeletePackageForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesRestorePackageForOrgResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesRestorePackageForOrg = ( + params: Params< + t_PackagesRestorePackageForOrgParamSchema, + t_PackagesRestorePackageForOrgQuerySchema, + void, + void + >, + respond: PackagesRestorePackageForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetAllPackageVersionsForPackageOwnedByOrgResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesGetAllPackageVersionsForPackageOwnedByOrg = ( + params: Params< + t_PackagesGetAllPackageVersionsForPackageOwnedByOrgParamSchema, + t_PackagesGetAllPackageVersionsForPackageOwnedByOrgQuerySchema, + void, + void + >, + respond: PackagesGetAllPackageVersionsForPackageOwnedByOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetPackageVersionForOrganizationResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesGetPackageVersionForOrganization = ( + params: Params< + t_PackagesGetPackageVersionForOrganizationParamSchema, + void, + void, + void + >, + respond: PackagesGetPackageVersionForOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesDeletePackageVersionForOrgResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesDeletePackageVersionForOrg = ( + params: Params< + t_PackagesDeletePackageVersionForOrgParamSchema, + void, + void, + void + >, + respond: PackagesDeletePackageVersionForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesRestorePackageVersionForOrgResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesRestorePackageVersionForOrg = ( + params: Params< + t_PackagesRestorePackageVersionForOrgParamSchema, + void, + void, + void + >, + respond: PackagesRestorePackageVersionForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListPatGrantRequestsResponder = { + with200(): ExpressRuntimeResponse< + t_organization_programmatic_access_grant_request[] + > + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListPatGrantRequests = ( + params: Params< + t_OrgsListPatGrantRequestsParamSchema, + t_OrgsListPatGrantRequestsQuerySchema, + void, + void + >, + respond: OrgsListPatGrantRequestsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsReviewPatGrantRequestsInBulkResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsReviewPatGrantRequestsInBulk = ( + params: Params< + t_OrgsReviewPatGrantRequestsInBulkParamSchema, + void, + t_OrgsReviewPatGrantRequestsInBulkRequestBodySchema, + void + >, + respond: OrgsReviewPatGrantRequestsInBulkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsReviewPatGrantRequestResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsReviewPatGrantRequest = ( + params: Params< + t_OrgsReviewPatGrantRequestParamSchema, + void, + t_OrgsReviewPatGrantRequestRequestBodySchema, + void + >, + respond: OrgsReviewPatGrantRequestResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListPatGrantRequestRepositoriesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListPatGrantRequestRepositories = ( + params: Params< + t_OrgsListPatGrantRequestRepositoriesParamSchema, + t_OrgsListPatGrantRequestRepositoriesQuerySchema, + void, + void + >, + respond: OrgsListPatGrantRequestRepositoriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListPatGrantsResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListPatGrants = ( + params: Params< + t_OrgsListPatGrantsParamSchema, + t_OrgsListPatGrantsQuerySchema, + void, + void + >, + respond: OrgsListPatGrantsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsUpdatePatAccessesResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsUpdatePatAccesses = ( + params: Params< + t_OrgsUpdatePatAccessesParamSchema, + void, + t_OrgsUpdatePatAccessesRequestBodySchema, + void + >, + respond: OrgsUpdatePatAccessesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsUpdatePatAccessResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsUpdatePatAccess = ( + params: Params< + t_OrgsUpdatePatAccessParamSchema, + void, + t_OrgsUpdatePatAccessRequestBodySchema, + void + >, + respond: OrgsUpdatePatAccessResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListPatGrantRepositoriesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListPatGrantRepositories = ( + params: Params< + t_OrgsListPatGrantRepositoriesParamSchema, + t_OrgsListPatGrantRepositoriesQuerySchema, + void, + void + >, + respond: OrgsListPatGrantRepositoriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PrivateRegistriesListOrgPrivateRegistriesResponder = { + with200(): ExpressRuntimeResponse<{ + configurations: t_org_private_registry_configuration[] + total_count: number + }> + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PrivateRegistriesListOrgPrivateRegistries = ( + params: Params< + t_PrivateRegistriesListOrgPrivateRegistriesParamSchema, + t_PrivateRegistriesListOrgPrivateRegistriesQuerySchema, + void, + void + >, + respond: PrivateRegistriesListOrgPrivateRegistriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PrivateRegistriesCreateOrgPrivateRegistryResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PrivateRegistriesCreateOrgPrivateRegistry = ( + params: Params< + t_PrivateRegistriesCreateOrgPrivateRegistryParamSchema, + void, + t_PrivateRegistriesCreateOrgPrivateRegistryRequestBodySchema, + void + >, + respond: PrivateRegistriesCreateOrgPrivateRegistryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PrivateRegistriesGetOrgPublicKeyResponder = { + with200(): ExpressRuntimeResponse<{ + key: string + key_id: string + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PrivateRegistriesGetOrgPublicKey = ( + params: Params< + t_PrivateRegistriesGetOrgPublicKeyParamSchema, + void, + void, + void + >, + respond: PrivateRegistriesGetOrgPublicKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PrivateRegistriesGetOrgPrivateRegistryResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PrivateRegistriesGetOrgPrivateRegistry = ( + params: Params< + t_PrivateRegistriesGetOrgPrivateRegistryParamSchema, + void, + void, + void + >, + respond: PrivateRegistriesGetOrgPrivateRegistryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PrivateRegistriesUpdateOrgPrivateRegistryResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PrivateRegistriesUpdateOrgPrivateRegistry = ( + params: Params< + t_PrivateRegistriesUpdateOrgPrivateRegistryParamSchema, + void, + t_PrivateRegistriesUpdateOrgPrivateRegistryRequestBodySchema, + void + >, + respond: PrivateRegistriesUpdateOrgPrivateRegistryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PrivateRegistriesDeleteOrgPrivateRegistryResponder = { + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PrivateRegistriesDeleteOrgPrivateRegistry = ( + params: Params< + t_PrivateRegistriesDeleteOrgPrivateRegistryParamSchema, + void, + void, + void + >, + respond: PrivateRegistriesDeleteOrgPrivateRegistryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsListForOrgResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsListForOrg = ( + params: Params< + t_ProjectsListForOrgParamSchema, + t_ProjectsListForOrgQuerySchema, + void, + void + >, + respond: ProjectsListForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsCreateForOrgResponder = { + with201(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsCreateForOrg = ( + params: Params< + t_ProjectsCreateForOrgParamSchema, + void, + t_ProjectsCreateForOrgRequestBodySchema, + void + >, + respond: ProjectsCreateForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetAllCustomPropertiesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetAllCustomProperties = ( + params: Params, + respond: OrgsGetAllCustomPropertiesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCreateOrUpdateCustomPropertiesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCreateOrUpdateCustomProperties = ( + params: Params< + t_OrgsCreateOrUpdateCustomPropertiesParamSchema, + void, + t_OrgsCreateOrUpdateCustomPropertiesRequestBodySchema, + void + >, + respond: OrgsCreateOrUpdateCustomPropertiesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetCustomPropertyResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetCustomProperty = ( + params: Params, + respond: OrgsGetCustomPropertyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCreateOrUpdateCustomPropertyResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCreateOrUpdateCustomProperty = ( + params: Params< + t_OrgsCreateOrUpdateCustomPropertyParamSchema, + void, + t_OrgsCreateOrUpdateCustomPropertyRequestBodySchema, + void + >, + respond: OrgsCreateOrUpdateCustomPropertyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRemoveCustomPropertyResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRemoveCustomProperty = ( + params: Params, + respond: OrgsRemoveCustomPropertyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListCustomPropertiesValuesForReposResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListCustomPropertiesValuesForRepos = ( + params: Params< + t_OrgsListCustomPropertiesValuesForReposParamSchema, + t_OrgsListCustomPropertiesValuesForReposQuerySchema, + void, + void + >, + respond: OrgsListCustomPropertiesValuesForReposResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCreateOrUpdateCustomPropertiesValuesForReposResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCreateOrUpdateCustomPropertiesValuesForRepos = ( + params: Params< + t_OrgsCreateOrUpdateCustomPropertiesValuesForReposParamSchema, + void, + t_OrgsCreateOrUpdateCustomPropertiesValuesForReposRequestBodySchema, + void + >, + respond: OrgsCreateOrUpdateCustomPropertiesValuesForReposResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListPublicMembersResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListPublicMembers = ( + params: Params< + t_OrgsListPublicMembersParamSchema, + t_OrgsListPublicMembersQuerySchema, + void, + void + >, + respond: OrgsListPublicMembersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsCheckPublicMembershipForUserResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsCheckPublicMembershipForUser = ( + params: Params< + t_OrgsCheckPublicMembershipForUserParamSchema, + void, + void, + void + >, + respond: OrgsCheckPublicMembershipForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsSetPublicMembershipForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsSetPublicMembershipForAuthenticatedUser = ( + params: Params< + t_OrgsSetPublicMembershipForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: OrgsSetPublicMembershipForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRemovePublicMembershipForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRemovePublicMembershipForAuthenticatedUser = ( + params: Params< + t_OrgsRemovePublicMembershipForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: OrgsRemovePublicMembershipForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListForOrg = ( + params: Params< + t_ReposListForOrgParamSchema, + t_ReposListForOrgQuerySchema, + void, + void + >, + respond: ReposListForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateInOrgResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateInOrg = ( + params: Params< + t_ReposCreateInOrgParamSchema, + void, + t_ReposCreateInOrgRequestBodySchema, + void + >, + respond: ReposCreateInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetOrgRulesetsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetOrgRulesets = ( + params: Params< + t_ReposGetOrgRulesetsParamSchema, + t_ReposGetOrgRulesetsQuerySchema, + void, + void + >, + respond: ReposGetOrgRulesetsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateOrgRulesetResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateOrgRuleset = ( + params: Params< + t_ReposCreateOrgRulesetParamSchema, + void, + t_ReposCreateOrgRulesetRequestBodySchema, + void + >, + respond: ReposCreateOrgRulesetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetOrgRuleSuitesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetOrgRuleSuites = ( + params: Params< + t_ReposGetOrgRuleSuitesParamSchema, + t_ReposGetOrgRuleSuitesQuerySchema, + void, + void + >, + respond: ReposGetOrgRuleSuitesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetOrgRuleSuiteResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetOrgRuleSuite = ( + params: Params, + respond: ReposGetOrgRuleSuiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetOrgRulesetResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetOrgRuleset = ( + params: Params, + respond: ReposGetOrgRulesetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateOrgRulesetResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateOrgRuleset = ( + params: Params< + t_ReposUpdateOrgRulesetParamSchema, + void, + t_ReposUpdateOrgRulesetRequestBodySchema | undefined, + void + >, + respond: ReposUpdateOrgRulesetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteOrgRulesetResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteOrgRuleset = ( + params: Params, + respond: ReposDeleteOrgRulesetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetOrgRulesetHistoryResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetOrgRulesetHistory = ( + params: Params< + t_OrgsGetOrgRulesetHistoryParamSchema, + t_OrgsGetOrgRulesetHistoryQuerySchema, + void, + void + >, + respond: OrgsGetOrgRulesetHistoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetOrgRulesetVersionResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetOrgRulesetVersion = ( + params: Params, + respond: OrgsGetOrgRulesetVersionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecretScanningListAlertsForOrgResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SecretScanningListAlertsForOrg = ( + params: Params< + t_SecretScanningListAlertsForOrgParamSchema, + t_SecretScanningListAlertsForOrgQuerySchema, + void, + void + >, + respond: SecretScanningListAlertsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesListOrgRepositoryAdvisoriesResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesListOrgRepositoryAdvisories = ( + params: Params< + t_SecurityAdvisoriesListOrgRepositoryAdvisoriesParamSchema, + t_SecurityAdvisoriesListOrgRepositoryAdvisoriesQuerySchema, + void, + void + >, + respond: SecurityAdvisoriesListOrgRepositoryAdvisoriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListSecurityManagerTeamsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListSecurityManagerTeams = ( + params: Params, + respond: OrgsListSecurityManagerTeamsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsAddSecurityManagerTeamResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsAddSecurityManagerTeam = ( + params: Params, + respond: OrgsAddSecurityManagerTeamResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsRemoveSecurityManagerTeamResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsRemoveSecurityManagerTeam = ( + params: Params, + respond: OrgsRemoveSecurityManagerTeamResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BillingGetGithubActionsBillingOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type BillingGetGithubActionsBillingOrg = ( + params: Params< + t_BillingGetGithubActionsBillingOrgParamSchema, + void, + void, + void + >, + respond: BillingGetGithubActionsBillingOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BillingGetGithubPackagesBillingOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type BillingGetGithubPackagesBillingOrg = ( + params: Params< + t_BillingGetGithubPackagesBillingOrgParamSchema, + void, + void, + void + >, + respond: BillingGetGithubPackagesBillingOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BillingGetSharedStorageBillingOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type BillingGetSharedStorageBillingOrg = ( + params: Params< + t_BillingGetSharedStorageBillingOrgParamSchema, + void, + void, + void + >, + respond: BillingGetSharedStorageBillingOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type HostedComputeListNetworkConfigurationsForOrgResponder = { + with200(): ExpressRuntimeResponse<{ + network_configurations: t_network_configuration[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type HostedComputeListNetworkConfigurationsForOrg = ( + params: Params< + t_HostedComputeListNetworkConfigurationsForOrgParamSchema, + t_HostedComputeListNetworkConfigurationsForOrgQuerySchema, + void, + void + >, + respond: HostedComputeListNetworkConfigurationsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type HostedComputeCreateNetworkConfigurationForOrgResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type HostedComputeCreateNetworkConfigurationForOrg = ( + params: Params< + t_HostedComputeCreateNetworkConfigurationForOrgParamSchema, + void, + t_HostedComputeCreateNetworkConfigurationForOrgRequestBodySchema, + void + >, + respond: HostedComputeCreateNetworkConfigurationForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type HostedComputeGetNetworkConfigurationForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type HostedComputeGetNetworkConfigurationForOrg = ( + params: Params< + t_HostedComputeGetNetworkConfigurationForOrgParamSchema, + void, + void, + void + >, + respond: HostedComputeGetNetworkConfigurationForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type HostedComputeUpdateNetworkConfigurationForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type HostedComputeUpdateNetworkConfigurationForOrg = ( + params: Params< + t_HostedComputeUpdateNetworkConfigurationForOrgParamSchema, + void, + t_HostedComputeUpdateNetworkConfigurationForOrgRequestBodySchema, + void + >, + respond: HostedComputeUpdateNetworkConfigurationForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type HostedComputeDeleteNetworkConfigurationFromOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type HostedComputeDeleteNetworkConfigurationFromOrg = ( + params: Params< + t_HostedComputeDeleteNetworkConfigurationFromOrgParamSchema, + void, + void, + void + >, + respond: HostedComputeDeleteNetworkConfigurationFromOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type HostedComputeGetNetworkSettingsForOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type HostedComputeGetNetworkSettingsForOrg = ( + params: Params< + t_HostedComputeGetNetworkSettingsForOrgParamSchema, + void, + void, + void + >, + respond: HostedComputeGetNetworkSettingsForOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CopilotCopilotMetricsForTeamResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CopilotCopilotMetricsForTeam = ( + params: Params< + t_CopilotCopilotMetricsForTeamParamSchema, + t_CopilotCopilotMetricsForTeamQuerySchema, + void, + void + >, + respond: CopilotCopilotMetricsForTeamResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsList = ( + params: Params, + respond: TeamsListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCreateResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCreate = ( + params: Params< + t_TeamsCreateParamSchema, + void, + t_TeamsCreateRequestBodySchema, + void + >, + respond: TeamsCreateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetByNameResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetByName = ( + params: Params, + respond: TeamsGetByNameResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsUpdateInOrgResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsUpdateInOrg = ( + params: Params< + t_TeamsUpdateInOrgParamSchema, + void, + t_TeamsUpdateInOrgRequestBodySchema | undefined, + void + >, + respond: TeamsUpdateInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsDeleteInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsDeleteInOrg = ( + params: Params, + respond: TeamsDeleteInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListDiscussionsInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListDiscussionsInOrg = ( + params: Params< + t_TeamsListDiscussionsInOrgParamSchema, + t_TeamsListDiscussionsInOrgQuerySchema, + void, + void + >, + respond: TeamsListDiscussionsInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCreateDiscussionInOrgResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCreateDiscussionInOrg = ( + params: Params< + t_TeamsCreateDiscussionInOrgParamSchema, + void, + t_TeamsCreateDiscussionInOrgRequestBodySchema, + void + >, + respond: TeamsCreateDiscussionInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetDiscussionInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetDiscussionInOrg = ( + params: Params, + respond: TeamsGetDiscussionInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsUpdateDiscussionInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsUpdateDiscussionInOrg = ( + params: Params< + t_TeamsUpdateDiscussionInOrgParamSchema, + void, + t_TeamsUpdateDiscussionInOrgRequestBodySchema | undefined, + void + >, + respond: TeamsUpdateDiscussionInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsDeleteDiscussionInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsDeleteDiscussionInOrg = ( + params: Params, + respond: TeamsDeleteDiscussionInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListDiscussionCommentsInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListDiscussionCommentsInOrg = ( + params: Params< + t_TeamsListDiscussionCommentsInOrgParamSchema, + t_TeamsListDiscussionCommentsInOrgQuerySchema, + void, + void + >, + respond: TeamsListDiscussionCommentsInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCreateDiscussionCommentInOrgResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCreateDiscussionCommentInOrg = ( + params: Params< + t_TeamsCreateDiscussionCommentInOrgParamSchema, + void, + t_TeamsCreateDiscussionCommentInOrgRequestBodySchema, + void + >, + respond: TeamsCreateDiscussionCommentInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetDiscussionCommentInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetDiscussionCommentInOrg = ( + params: Params, + respond: TeamsGetDiscussionCommentInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsUpdateDiscussionCommentInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsUpdateDiscussionCommentInOrg = ( + params: Params< + t_TeamsUpdateDiscussionCommentInOrgParamSchema, + void, + t_TeamsUpdateDiscussionCommentInOrgRequestBodySchema, + void + >, + respond: TeamsUpdateDiscussionCommentInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsDeleteDiscussionCommentInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsDeleteDiscussionCommentInOrg = ( + params: Params< + t_TeamsDeleteDiscussionCommentInOrgParamSchema, + void, + void, + void + >, + respond: TeamsDeleteDiscussionCommentInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForTeamDiscussionCommentInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForTeamDiscussionCommentInOrg = ( + params: Params< + t_ReactionsListForTeamDiscussionCommentInOrgParamSchema, + t_ReactionsListForTeamDiscussionCommentInOrgQuerySchema, + void, + void + >, + respond: ReactionsListForTeamDiscussionCommentInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForTeamDiscussionCommentInOrgResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForTeamDiscussionCommentInOrg = ( + params: Params< + t_ReactionsCreateForTeamDiscussionCommentInOrgParamSchema, + void, + t_ReactionsCreateForTeamDiscussionCommentInOrgRequestBodySchema, + void + >, + respond: ReactionsCreateForTeamDiscussionCommentInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsDeleteForTeamDiscussionCommentResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsDeleteForTeamDiscussionComment = ( + params: Params< + t_ReactionsDeleteForTeamDiscussionCommentParamSchema, + void, + void, + void + >, + respond: ReactionsDeleteForTeamDiscussionCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForTeamDiscussionInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForTeamDiscussionInOrg = ( + params: Params< + t_ReactionsListForTeamDiscussionInOrgParamSchema, + t_ReactionsListForTeamDiscussionInOrgQuerySchema, + void, + void + >, + respond: ReactionsListForTeamDiscussionInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForTeamDiscussionInOrgResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForTeamDiscussionInOrg = ( + params: Params< + t_ReactionsCreateForTeamDiscussionInOrgParamSchema, + void, + t_ReactionsCreateForTeamDiscussionInOrgRequestBodySchema, + void + >, + respond: ReactionsCreateForTeamDiscussionInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsDeleteForTeamDiscussionResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsDeleteForTeamDiscussion = ( + params: Params< + t_ReactionsDeleteForTeamDiscussionParamSchema, + void, + void, + void + >, + respond: ReactionsDeleteForTeamDiscussionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListPendingInvitationsInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListPendingInvitationsInOrg = ( + params: Params< + t_TeamsListPendingInvitationsInOrgParamSchema, + t_TeamsListPendingInvitationsInOrgQuerySchema, + void, + void + >, + respond: TeamsListPendingInvitationsInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListMembersInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListMembersInOrg = ( + params: Params< + t_TeamsListMembersInOrgParamSchema, + t_TeamsListMembersInOrgQuerySchema, + void, + void + >, + respond: TeamsListMembersInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetMembershipForUserInOrgResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetMembershipForUserInOrg = ( + params: Params, + respond: TeamsGetMembershipForUserInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsAddOrUpdateMembershipForUserInOrgResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsAddOrUpdateMembershipForUserInOrg = ( + params: Params< + t_TeamsAddOrUpdateMembershipForUserInOrgParamSchema, + void, + t_TeamsAddOrUpdateMembershipForUserInOrgRequestBodySchema | undefined, + void + >, + respond: TeamsAddOrUpdateMembershipForUserInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsRemoveMembershipForUserInOrgResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsRemoveMembershipForUserInOrg = ( + params: Params< + t_TeamsRemoveMembershipForUserInOrgParamSchema, + void, + void, + void + >, + respond: TeamsRemoveMembershipForUserInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListProjectsInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListProjectsInOrg = ( + params: Params< + t_TeamsListProjectsInOrgParamSchema, + t_TeamsListProjectsInOrgQuerySchema, + void, + void + >, + respond: TeamsListProjectsInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCheckPermissionsForProjectInOrgResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCheckPermissionsForProjectInOrg = ( + params: Params< + t_TeamsCheckPermissionsForProjectInOrgParamSchema, + void, + void, + void + >, + respond: TeamsCheckPermissionsForProjectInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsAddOrUpdateProjectPermissionsInOrgResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type TeamsAddOrUpdateProjectPermissionsInOrg = ( + params: Params< + t_TeamsAddOrUpdateProjectPermissionsInOrgParamSchema, + void, + t_TeamsAddOrUpdateProjectPermissionsInOrgRequestBodySchema | undefined, + void + >, + respond: TeamsAddOrUpdateProjectPermissionsInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsRemoveProjectInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsRemoveProjectInOrg = ( + params: Params, + respond: TeamsRemoveProjectInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListReposInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListReposInOrg = ( + params: Params< + t_TeamsListReposInOrgParamSchema, + t_TeamsListReposInOrgQuerySchema, + void, + void + >, + respond: TeamsListReposInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCheckPermissionsForRepoInOrgResponder = { + with200(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCheckPermissionsForRepoInOrg = ( + params: Params< + t_TeamsCheckPermissionsForRepoInOrgParamSchema, + void, + void, + void + >, + respond: TeamsCheckPermissionsForRepoInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsAddOrUpdateRepoPermissionsInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsAddOrUpdateRepoPermissionsInOrg = ( + params: Params< + t_TeamsAddOrUpdateRepoPermissionsInOrgParamSchema, + void, + t_TeamsAddOrUpdateRepoPermissionsInOrgRequestBodySchema | undefined, + void + >, + respond: TeamsAddOrUpdateRepoPermissionsInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsRemoveRepoInOrgResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsRemoveRepoInOrg = ( + params: Params, + respond: TeamsRemoveRepoInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListChildInOrgResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListChildInOrg = ( + params: Params< + t_TeamsListChildInOrgParamSchema, + t_TeamsListChildInOrgQuerySchema, + void, + void + >, + respond: TeamsListChildInOrgResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsEnableOrDisableSecurityProductOnAllOrgReposResponder = { + with204(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsEnableOrDisableSecurityProductOnAllOrgRepos = ( + params: Params< + t_OrgsEnableOrDisableSecurityProductOnAllOrgReposParamSchema, + void, + | t_OrgsEnableOrDisableSecurityProductOnAllOrgReposRequestBodySchema + | undefined, + void + >, + respond: OrgsEnableOrDisableSecurityProductOnAllOrgReposResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsGetCardResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsGetCard = ( + params: Params, + respond: ProjectsGetCardResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsUpdateCardResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsUpdateCard = ( + params: Params< + t_ProjectsUpdateCardParamSchema, + void, + t_ProjectsUpdateCardRequestBodySchema | undefined, + void + >, + respond: ProjectsUpdateCardResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsDeleteCardResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + errors?: string[] | undefined + message?: string | undefined + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsDeleteCard = ( + params: Params, + respond: ProjectsDeleteCardResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsMoveCardResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + errors?: + | { + code?: string | undefined + field?: string | undefined + message?: string | undefined + resource?: string | undefined + }[] + | undefined + message?: string | undefined + }> + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + errors?: + | { + code?: string | undefined + message?: string | undefined + }[] + | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type ProjectsMoveCard = ( + params: Params< + t_ProjectsMoveCardParamSchema, + void, + t_ProjectsMoveCardRequestBodySchema, + void + >, + respond: ProjectsMoveCardResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsGetColumnResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsGetColumn = ( + params: Params, + respond: ProjectsGetColumnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsUpdateColumnResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsUpdateColumn = ( + params: Params< + t_ProjectsUpdateColumnParamSchema, + void, + t_ProjectsUpdateColumnRequestBodySchema, + void + >, + respond: ProjectsUpdateColumnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsDeleteColumnResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsDeleteColumn = ( + params: Params, + respond: ProjectsDeleteColumnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsListCardsResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsListCards = ( + params: Params< + t_ProjectsListCardsParamSchema, + t_ProjectsListCardsQuerySchema, + void, + void + >, + respond: ProjectsListCardsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsCreateCardResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse< + t_validation_error | t_validation_error_simple + > + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + errors?: + | { + code?: string | undefined + message?: string | undefined + }[] + | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type ProjectsCreateCard = ( + params: Params< + t_ProjectsCreateCardParamSchema, + void, + t_ProjectsCreateCardRequestBodySchema, + void + >, + respond: ProjectsCreateCardResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsMoveColumnResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsMoveColumn = ( + params: Params< + t_ProjectsMoveColumnParamSchema, + void, + t_ProjectsMoveColumnRequestBodySchema, + void + >, + respond: ProjectsMoveColumnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsGetResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsGet = ( + params: Params, + respond: ProjectsGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsUpdateResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + errors?: string[] | undefined + message?: string | undefined + }> + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsUpdate = ( + params: Params< + t_ProjectsUpdateParamSchema, + void, + t_ProjectsUpdateRequestBodySchema | undefined, + void + >, + respond: ProjectsUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsDeleteResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + errors?: string[] | undefined + message?: string | undefined + }> + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsDelete = ( + params: Params, + respond: ProjectsDeleteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsListCollaboratorsResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsListCollaborators = ( + params: Params< + t_ProjectsListCollaboratorsParamSchema, + t_ProjectsListCollaboratorsQuerySchema, + void, + void + >, + respond: ProjectsListCollaboratorsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsAddCollaboratorResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsAddCollaborator = ( + params: Params< + t_ProjectsAddCollaboratorParamSchema, + void, + t_ProjectsAddCollaboratorRequestBodySchema | undefined, + void + >, + respond: ProjectsAddCollaboratorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsRemoveCollaboratorResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsRemoveCollaborator = ( + params: Params, + respond: ProjectsRemoveCollaboratorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsGetPermissionForUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsGetPermissionForUser = ( + params: Params, + respond: ProjectsGetPermissionForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsListColumnsResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsListColumns = ( + params: Params< + t_ProjectsListColumnsParamSchema, + t_ProjectsListColumnsQuerySchema, + void, + void + >, + respond: ProjectsListColumnsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsCreateColumnResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsCreateColumn = ( + params: Params< + t_ProjectsCreateColumnParamSchema, + void, + t_ProjectsCreateColumnRequestBodySchema, + void + >, + respond: ProjectsCreateColumnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type RateLimitGetResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type RateLimitGet = ( + params: Params, + respond: RateLimitGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGet = ( + params: Params, + respond: ReposGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateResponder = { + with200(): ExpressRuntimeResponse + with307(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdate = ( + params: Params< + t_ReposUpdateParamSchema, + void, + t_ReposUpdateRequestBodySchema | undefined, + void + >, + respond: ReposUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteResponder = { + with204(): ExpressRuntimeResponse + with307(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDelete = ( + params: Params, + respond: ReposDeleteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListArtifactsForRepoResponder = { + with200(): ExpressRuntimeResponse<{ + artifacts: t_artifact[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListArtifactsForRepo = ( + params: Params< + t_ActionsListArtifactsForRepoParamSchema, + t_ActionsListArtifactsForRepoQuerySchema, + void, + void + >, + respond: ActionsListArtifactsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetArtifactResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetArtifact = ( + params: Params, + respond: ActionsGetArtifactResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteArtifactResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteArtifact = ( + params: Params, + respond: ActionsDeleteArtifactResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDownloadArtifactResponder = { + with302(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDownloadArtifact = ( + params: Params, + respond: ActionsDownloadArtifactResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetActionsCacheUsageResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetActionsCacheUsage = ( + params: Params, + respond: ActionsGetActionsCacheUsageResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetActionsCacheListResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetActionsCacheList = ( + params: Params< + t_ActionsGetActionsCacheListParamSchema, + t_ActionsGetActionsCacheListQuerySchema, + void, + void + >, + respond: ActionsGetActionsCacheListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteActionsCacheByKeyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteActionsCacheByKey = ( + params: Params< + t_ActionsDeleteActionsCacheByKeyParamSchema, + t_ActionsDeleteActionsCacheByKeyQuerySchema, + void, + void + >, + respond: ActionsDeleteActionsCacheByKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteActionsCacheByIdResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteActionsCacheById = ( + params: Params, + respond: ActionsDeleteActionsCacheByIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetJobForWorkflowRunResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetJobForWorkflowRun = ( + params: Params, + respond: ActionsGetJobForWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDownloadJobLogsForWorkflowRunResponder = { + with302(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDownloadJobLogsForWorkflowRun = ( + params: Params< + t_ActionsDownloadJobLogsForWorkflowRunParamSchema, + void, + void, + void + >, + respond: ActionsDownloadJobLogsForWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsReRunJobForWorkflowRunResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsReRunJobForWorkflowRun = ( + params: Params< + t_ActionsReRunJobForWorkflowRunParamSchema, + void, + t_ActionsReRunJobForWorkflowRunRequestBodySchema | undefined, + void + >, + respond: ActionsReRunJobForWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetCustomOidcSubClaimForRepoResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetCustomOidcSubClaimForRepo = ( + params: Params< + t_ActionsGetCustomOidcSubClaimForRepoParamSchema, + void, + void, + void + >, + respond: ActionsGetCustomOidcSubClaimForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetCustomOidcSubClaimForRepoResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetCustomOidcSubClaimForRepo = ( + params: Params< + t_ActionsSetCustomOidcSubClaimForRepoParamSchema, + void, + t_ActionsSetCustomOidcSubClaimForRepoRequestBodySchema, + void + >, + respond: ActionsSetCustomOidcSubClaimForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListRepoOrganizationSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_actions_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListRepoOrganizationSecrets = ( + params: Params< + t_ActionsListRepoOrganizationSecretsParamSchema, + t_ActionsListRepoOrganizationSecretsQuerySchema, + void, + void + >, + respond: ActionsListRepoOrganizationSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListRepoOrganizationVariablesResponder = { + with200(): ExpressRuntimeResponse<{ + total_count: number + variables: t_actions_variable[] + }> +} & ExpressRuntimeResponder + +export type ActionsListRepoOrganizationVariables = ( + params: Params< + t_ActionsListRepoOrganizationVariablesParamSchema, + t_ActionsListRepoOrganizationVariablesQuerySchema, + void, + void + >, + respond: ActionsListRepoOrganizationVariablesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetGithubActionsPermissionsRepositoryResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetGithubActionsPermissionsRepository = ( + params: Params< + t_ActionsGetGithubActionsPermissionsRepositoryParamSchema, + void, + void, + void + >, + respond: ActionsGetGithubActionsPermissionsRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetGithubActionsPermissionsRepositoryResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetGithubActionsPermissionsRepository = ( + params: Params< + t_ActionsSetGithubActionsPermissionsRepositoryParamSchema, + void, + t_ActionsSetGithubActionsPermissionsRepositoryRequestBodySchema, + void + >, + respond: ActionsSetGithubActionsPermissionsRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetWorkflowAccessToRepositoryResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetWorkflowAccessToRepository = ( + params: Params< + t_ActionsGetWorkflowAccessToRepositoryParamSchema, + void, + void, + void + >, + respond: ActionsGetWorkflowAccessToRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetWorkflowAccessToRepositoryResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetWorkflowAccessToRepository = ( + params: Params< + t_ActionsSetWorkflowAccessToRepositoryParamSchema, + void, + t_ActionsSetWorkflowAccessToRepositoryRequestBodySchema, + void + >, + respond: ActionsSetWorkflowAccessToRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetAllowedActionsRepositoryResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetAllowedActionsRepository = ( + params: Params< + t_ActionsGetAllowedActionsRepositoryParamSchema, + void, + void, + void + >, + respond: ActionsGetAllowedActionsRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetAllowedActionsRepositoryResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetAllowedActionsRepository = ( + params: Params< + t_ActionsSetAllowedActionsRepositoryParamSchema, + void, + t_ActionsSetAllowedActionsRepositoryRequestBodySchema | undefined, + void + >, + respond: ActionsSetAllowedActionsRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryResponder = + { + with200(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type ActionsGetGithubActionsDefaultWorkflowPermissionsRepository = ( + params: Params< + t_ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema, + void, + void, + void + >, + respond: ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryResponder = + { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type ActionsSetGithubActionsDefaultWorkflowPermissionsRepository = ( + params: Params< + t_ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema, + void, + t_ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryRequestBodySchema, + void + >, + respond: ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListSelfHostedRunnersForRepoResponder = { + with200(): ExpressRuntimeResponse<{ + runners: t_runner[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListSelfHostedRunnersForRepo = ( + params: Params< + t_ActionsListSelfHostedRunnersForRepoParamSchema, + t_ActionsListSelfHostedRunnersForRepoQuerySchema, + void, + void + >, + respond: ActionsListSelfHostedRunnersForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListRunnerApplicationsForRepoResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsListRunnerApplicationsForRepo = ( + params: Params< + t_ActionsListRunnerApplicationsForRepoParamSchema, + void, + void, + void + >, + respond: ActionsListRunnerApplicationsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGenerateRunnerJitconfigForRepoResponder = { + with201(): ExpressRuntimeResponse<{ + encoded_jit_config: string + runner: t_runner + }> + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGenerateRunnerJitconfigForRepo = ( + params: Params< + t_ActionsGenerateRunnerJitconfigForRepoParamSchema, + void, + t_ActionsGenerateRunnerJitconfigForRepoRequestBodySchema, + void + >, + respond: ActionsGenerateRunnerJitconfigForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateRegistrationTokenForRepoResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateRegistrationTokenForRepo = ( + params: Params< + t_ActionsCreateRegistrationTokenForRepoParamSchema, + void, + void, + void + >, + respond: ActionsCreateRegistrationTokenForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateRemoveTokenForRepoResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateRemoveTokenForRepo = ( + params: Params< + t_ActionsCreateRemoveTokenForRepoParamSchema, + void, + void, + void + >, + respond: ActionsCreateRemoveTokenForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetSelfHostedRunnerForRepoResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetSelfHostedRunnerForRepo = ( + params: Params< + t_ActionsGetSelfHostedRunnerForRepoParamSchema, + void, + void, + void + >, + respond: ActionsGetSelfHostedRunnerForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteSelfHostedRunnerFromRepoResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteSelfHostedRunnerFromRepo = ( + params: Params< + t_ActionsDeleteSelfHostedRunnerFromRepoParamSchema, + void, + void, + void + >, + respond: ActionsDeleteSelfHostedRunnerFromRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListLabelsForSelfHostedRunnerForRepoResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsListLabelsForSelfHostedRunnerForRepo = ( + params: Params< + t_ActionsListLabelsForSelfHostedRunnerForRepoParamSchema, + void, + void, + void + >, + respond: ActionsListLabelsForSelfHostedRunnerForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsAddCustomLabelsToSelfHostedRunnerForRepoResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsAddCustomLabelsToSelfHostedRunnerForRepo = ( + params: Params< + t_ActionsAddCustomLabelsToSelfHostedRunnerForRepoParamSchema, + void, + t_ActionsAddCustomLabelsToSelfHostedRunnerForRepoRequestBodySchema, + void + >, + respond: ActionsAddCustomLabelsToSelfHostedRunnerForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsSetCustomLabelsForSelfHostedRunnerForRepoResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsSetCustomLabelsForSelfHostedRunnerForRepo = ( + params: Params< + t_ActionsSetCustomLabelsForSelfHostedRunnerForRepoParamSchema, + void, + t_ActionsSetCustomLabelsForSelfHostedRunnerForRepoRequestBodySchema, + void + >, + respond: ActionsSetCustomLabelsForSelfHostedRunnerForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepo = ( + params: Params< + t_ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoParamSchema, + void, + void, + void + >, + respond: ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponder = { + with200(): ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }> + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsRemoveCustomLabelFromSelfHostedRunnerForRepo = ( + params: Params< + t_ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoParamSchema, + void, + void, + void + >, + respond: ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListWorkflowRunsForRepoResponder = { + with200(): ExpressRuntimeResponse<{ + total_count: number + workflow_runs: t_workflow_run[] + }> +} & ExpressRuntimeResponder + +export type ActionsListWorkflowRunsForRepo = ( + params: Params< + t_ActionsListWorkflowRunsForRepoParamSchema, + t_ActionsListWorkflowRunsForRepoQuerySchema, + void, + void + >, + respond: ActionsListWorkflowRunsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetWorkflowRunResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetWorkflowRun = ( + params: Params< + t_ActionsGetWorkflowRunParamSchema, + t_ActionsGetWorkflowRunQuerySchema, + void, + void + >, + respond: ActionsGetWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteWorkflowRunResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteWorkflowRun = ( + params: Params, + respond: ActionsDeleteWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetReviewsForRunResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetReviewsForRun = ( + params: Params, + respond: ActionsGetReviewsForRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsApproveWorkflowRunResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsApproveWorkflowRun = ( + params: Params, + respond: ActionsApproveWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListWorkflowRunArtifactsResponder = { + with200(): ExpressRuntimeResponse<{ + artifacts: t_artifact[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListWorkflowRunArtifacts = ( + params: Params< + t_ActionsListWorkflowRunArtifactsParamSchema, + t_ActionsListWorkflowRunArtifactsQuerySchema, + void, + void + >, + respond: ActionsListWorkflowRunArtifactsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetWorkflowRunAttemptResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetWorkflowRunAttempt = ( + params: Params< + t_ActionsGetWorkflowRunAttemptParamSchema, + t_ActionsGetWorkflowRunAttemptQuerySchema, + void, + void + >, + respond: ActionsGetWorkflowRunAttemptResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListJobsForWorkflowRunAttemptResponder = { + with200(): ExpressRuntimeResponse<{ + jobs: t_job[] + total_count: number + }> + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsListJobsForWorkflowRunAttempt = ( + params: Params< + t_ActionsListJobsForWorkflowRunAttemptParamSchema, + t_ActionsListJobsForWorkflowRunAttemptQuerySchema, + void, + void + >, + respond: ActionsListJobsForWorkflowRunAttemptResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDownloadWorkflowRunAttemptLogsResponder = { + with302(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDownloadWorkflowRunAttemptLogs = ( + params: Params< + t_ActionsDownloadWorkflowRunAttemptLogsParamSchema, + void, + void, + void + >, + respond: ActionsDownloadWorkflowRunAttemptLogsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCancelWorkflowRunResponder = { + with202(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCancelWorkflowRun = ( + params: Params, + respond: ActionsCancelWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsReviewCustomGatesForRunResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsReviewCustomGatesForRun = ( + params: Params< + t_ActionsReviewCustomGatesForRunParamSchema, + void, + t_ActionsReviewCustomGatesForRunRequestBodySchema, + void + >, + respond: ActionsReviewCustomGatesForRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsForceCancelWorkflowRunResponder = { + with202(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsForceCancelWorkflowRun = ( + params: Params, + respond: ActionsForceCancelWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListJobsForWorkflowRunResponder = { + with200(): ExpressRuntimeResponse<{ + jobs: t_job[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListJobsForWorkflowRun = ( + params: Params< + t_ActionsListJobsForWorkflowRunParamSchema, + t_ActionsListJobsForWorkflowRunQuerySchema, + void, + void + >, + respond: ActionsListJobsForWorkflowRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDownloadWorkflowRunLogsResponder = { + with302(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDownloadWorkflowRunLogs = ( + params: Params, + respond: ActionsDownloadWorkflowRunLogsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteWorkflowRunLogsResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteWorkflowRunLogs = ( + params: Params, + respond: ActionsDeleteWorkflowRunLogsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetPendingDeploymentsForRunResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetPendingDeploymentsForRun = ( + params: Params< + t_ActionsGetPendingDeploymentsForRunParamSchema, + void, + void, + void + >, + respond: ActionsGetPendingDeploymentsForRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsReviewPendingDeploymentsForRunResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsReviewPendingDeploymentsForRun = ( + params: Params< + t_ActionsReviewPendingDeploymentsForRunParamSchema, + void, + t_ActionsReviewPendingDeploymentsForRunRequestBodySchema, + void + >, + respond: ActionsReviewPendingDeploymentsForRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsReRunWorkflowResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsReRunWorkflow = ( + params: Params< + t_ActionsReRunWorkflowParamSchema, + void, + t_ActionsReRunWorkflowRequestBodySchema | undefined, + void + >, + respond: ActionsReRunWorkflowResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsReRunWorkflowFailedJobsResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsReRunWorkflowFailedJobs = ( + params: Params< + t_ActionsReRunWorkflowFailedJobsParamSchema, + void, + t_ActionsReRunWorkflowFailedJobsRequestBodySchema | undefined, + void + >, + respond: ActionsReRunWorkflowFailedJobsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetWorkflowRunUsageResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetWorkflowRunUsage = ( + params: Params, + respond: ActionsGetWorkflowRunUsageResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListRepoSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_actions_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListRepoSecrets = ( + params: Params< + t_ActionsListRepoSecretsParamSchema, + t_ActionsListRepoSecretsQuerySchema, + void, + void + >, + respond: ActionsListRepoSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetRepoPublicKeyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetRepoPublicKey = ( + params: Params, + respond: ActionsGetRepoPublicKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetRepoSecretResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetRepoSecret = ( + params: Params, + respond: ActionsGetRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateOrUpdateRepoSecretResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateOrUpdateRepoSecret = ( + params: Params< + t_ActionsCreateOrUpdateRepoSecretParamSchema, + void, + t_ActionsCreateOrUpdateRepoSecretRequestBodySchema, + void + >, + respond: ActionsCreateOrUpdateRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteRepoSecretResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteRepoSecret = ( + params: Params, + respond: ActionsDeleteRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListRepoVariablesResponder = { + with200(): ExpressRuntimeResponse<{ + total_count: number + variables: t_actions_variable[] + }> +} & ExpressRuntimeResponder + +export type ActionsListRepoVariables = ( + params: Params< + t_ActionsListRepoVariablesParamSchema, + t_ActionsListRepoVariablesQuerySchema, + void, + void + >, + respond: ActionsListRepoVariablesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateRepoVariableResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateRepoVariable = ( + params: Params< + t_ActionsCreateRepoVariableParamSchema, + void, + t_ActionsCreateRepoVariableRequestBodySchema, + void + >, + respond: ActionsCreateRepoVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetRepoVariableResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetRepoVariable = ( + params: Params, + respond: ActionsGetRepoVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsUpdateRepoVariableResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsUpdateRepoVariable = ( + params: Params< + t_ActionsUpdateRepoVariableParamSchema, + void, + t_ActionsUpdateRepoVariableRequestBodySchema, + void + >, + respond: ActionsUpdateRepoVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteRepoVariableResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteRepoVariable = ( + params: Params, + respond: ActionsDeleteRepoVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListRepoWorkflowsResponder = { + with200(): ExpressRuntimeResponse<{ + total_count: number + workflows: t_workflow[] + }> +} & ExpressRuntimeResponder + +export type ActionsListRepoWorkflows = ( + params: Params< + t_ActionsListRepoWorkflowsParamSchema, + t_ActionsListRepoWorkflowsQuerySchema, + void, + void + >, + respond: ActionsListRepoWorkflowsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetWorkflowResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetWorkflow = ( + params: Params, + respond: ActionsGetWorkflowResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDisableWorkflowResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDisableWorkflow = ( + params: Params, + respond: ActionsDisableWorkflowResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateWorkflowDispatchResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateWorkflowDispatch = ( + params: Params< + t_ActionsCreateWorkflowDispatchParamSchema, + void, + t_ActionsCreateWorkflowDispatchRequestBodySchema, + void + >, + respond: ActionsCreateWorkflowDispatchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsEnableWorkflowResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsEnableWorkflow = ( + params: Params, + respond: ActionsEnableWorkflowResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListWorkflowRunsResponder = { + with200(): ExpressRuntimeResponse<{ + total_count: number + workflow_runs: t_workflow_run[] + }> +} & ExpressRuntimeResponder + +export type ActionsListWorkflowRuns = ( + params: Params< + t_ActionsListWorkflowRunsParamSchema, + t_ActionsListWorkflowRunsQuerySchema, + void, + void + >, + respond: ActionsListWorkflowRunsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetWorkflowUsageResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetWorkflowUsage = ( + params: Params, + respond: ActionsGetWorkflowUsageResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListActivitiesResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListActivities = ( + params: Params< + t_ReposListActivitiesParamSchema, + t_ReposListActivitiesQuerySchema, + void, + void + >, + respond: ReposListActivitiesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListAssigneesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListAssignees = ( + params: Params< + t_IssuesListAssigneesParamSchema, + t_IssuesListAssigneesQuerySchema, + void, + void + >, + respond: IssuesListAssigneesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesCheckUserCanBeAssignedResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesCheckUserCanBeAssigned = ( + params: Params, + respond: IssuesCheckUserCanBeAssignedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateAttestationResponder = { + with201(): ExpressRuntimeResponse<{ + id?: number | undefined + }> + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateAttestation = ( + params: Params< + t_ReposCreateAttestationParamSchema, + void, + t_ReposCreateAttestationRequestBodySchema, + void + >, + respond: ReposCreateAttestationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListAttestationsResponder = { + with200(): ExpressRuntimeResponse<{ + attestations?: + | { + bundle?: + | { + dsseEnvelope?: + | { + [key: string]: unknown | undefined + } + | undefined + mediaType?: string | undefined + verificationMaterial?: + | { + [key: string]: unknown | undefined + } + | undefined + } + | undefined + bundle_url?: string | undefined + repository_id?: number | undefined + }[] + | undefined + }> +} & ExpressRuntimeResponder + +export type ReposListAttestations = ( + params: Params< + t_ReposListAttestationsParamSchema, + t_ReposListAttestationsQuerySchema, + void, + void + >, + respond: ReposListAttestationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListAutolinksResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListAutolinks = ( + params: Params, + respond: ReposListAutolinksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateAutolinkResponder = { + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateAutolink = ( + params: Params< + t_ReposCreateAutolinkParamSchema, + void, + t_ReposCreateAutolinkRequestBodySchema, + void + >, + respond: ReposCreateAutolinkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetAutolinkResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetAutolink = ( + params: Params, + respond: ReposGetAutolinkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteAutolinkResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteAutolink = ( + params: Params, + respond: ReposDeleteAutolinkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCheckAutomatedSecurityFixesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCheckAutomatedSecurityFixes = ( + params: Params< + t_ReposCheckAutomatedSecurityFixesParamSchema, + void, + void, + void + >, + respond: ReposCheckAutomatedSecurityFixesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposEnableAutomatedSecurityFixesResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposEnableAutomatedSecurityFixes = ( + params: Params< + t_ReposEnableAutomatedSecurityFixesParamSchema, + void, + void, + void + >, + respond: ReposEnableAutomatedSecurityFixesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDisableAutomatedSecurityFixesResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDisableAutomatedSecurityFixes = ( + params: Params< + t_ReposDisableAutomatedSecurityFixesParamSchema, + void, + void, + void + >, + respond: ReposDisableAutomatedSecurityFixesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListBranchesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListBranches = ( + params: Params< + t_ReposListBranchesParamSchema, + t_ReposListBranchesQuerySchema, + void, + void + >, + respond: ReposListBranchesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetBranchResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetBranch = ( + params: Params, + respond: ReposGetBranchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetBranchProtectionResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetBranchProtection = ( + params: Params, + respond: ReposGetBranchProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateBranchProtectionResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateBranchProtection = ( + params: Params< + t_ReposUpdateBranchProtectionParamSchema, + void, + t_ReposUpdateBranchProtectionRequestBodySchema, + void + >, + respond: ReposUpdateBranchProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteBranchProtectionResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteBranchProtection = ( + params: Params, + respond: ReposDeleteBranchProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetAdminBranchProtectionResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetAdminBranchProtection = ( + params: Params, + respond: ReposGetAdminBranchProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposSetAdminBranchProtectionResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposSetAdminBranchProtection = ( + params: Params, + respond: ReposSetAdminBranchProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteAdminBranchProtectionResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteAdminBranchProtection = ( + params: Params< + t_ReposDeleteAdminBranchProtectionParamSchema, + void, + void, + void + >, + respond: ReposDeleteAdminBranchProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetPullRequestReviewProtectionResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetPullRequestReviewProtection = ( + params: Params< + t_ReposGetPullRequestReviewProtectionParamSchema, + void, + void, + void + >, + respond: ReposGetPullRequestReviewProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdatePullRequestReviewProtectionResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdatePullRequestReviewProtection = ( + params: Params< + t_ReposUpdatePullRequestReviewProtectionParamSchema, + void, + t_ReposUpdatePullRequestReviewProtectionRequestBodySchema | undefined, + void + >, + respond: ReposUpdatePullRequestReviewProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeletePullRequestReviewProtectionResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeletePullRequestReviewProtection = ( + params: Params< + t_ReposDeletePullRequestReviewProtectionParamSchema, + void, + void, + void + >, + respond: ReposDeletePullRequestReviewProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCommitSignatureProtectionResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCommitSignatureProtection = ( + params: Params< + t_ReposGetCommitSignatureProtectionParamSchema, + void, + void, + void + >, + respond: ReposGetCommitSignatureProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateCommitSignatureProtectionResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateCommitSignatureProtection = ( + params: Params< + t_ReposCreateCommitSignatureProtectionParamSchema, + void, + void, + void + >, + respond: ReposCreateCommitSignatureProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteCommitSignatureProtectionResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteCommitSignatureProtection = ( + params: Params< + t_ReposDeleteCommitSignatureProtectionParamSchema, + void, + void, + void + >, + respond: ReposDeleteCommitSignatureProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetStatusChecksProtectionResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetStatusChecksProtection = ( + params: Params, + respond: ReposGetStatusChecksProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateStatusCheckProtectionResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateStatusCheckProtection = ( + params: Params< + t_ReposUpdateStatusCheckProtectionParamSchema, + void, + t_ReposUpdateStatusCheckProtectionRequestBodySchema | undefined, + void + >, + respond: ReposUpdateStatusCheckProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRemoveStatusCheckProtectionResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRemoveStatusCheckProtection = ( + params: Params< + t_ReposRemoveStatusCheckProtectionParamSchema, + void, + void, + void + >, + respond: ReposRemoveStatusCheckProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetAllStatusCheckContextsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetAllStatusCheckContexts = ( + params: Params, + respond: ReposGetAllStatusCheckContextsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposAddStatusCheckContextsResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposAddStatusCheckContexts = ( + params: Params< + t_ReposAddStatusCheckContextsParamSchema, + void, + t_ReposAddStatusCheckContextsRequestBodySchema | undefined, + void + >, + respond: ReposAddStatusCheckContextsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposSetStatusCheckContextsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposSetStatusCheckContexts = ( + params: Params< + t_ReposSetStatusCheckContextsParamSchema, + void, + t_ReposSetStatusCheckContextsRequestBodySchema | undefined, + void + >, + respond: ReposSetStatusCheckContextsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRemoveStatusCheckContextsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRemoveStatusCheckContexts = ( + params: Params< + t_ReposRemoveStatusCheckContextsParamSchema, + void, + t_ReposRemoveStatusCheckContextsRequestBodySchema, + void + >, + respond: ReposRemoveStatusCheckContextsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetAccessRestrictions = ( + params: Params, + respond: ReposGetAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteAccessRestrictionsResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteAccessRestrictions = ( + params: Params, + respond: ReposDeleteAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetAppsWithAccessToProtectedBranchResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetAppsWithAccessToProtectedBranch = ( + params: Params< + t_ReposGetAppsWithAccessToProtectedBranchParamSchema, + void, + void, + void + >, + respond: ReposGetAppsWithAccessToProtectedBranchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposAddAppAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposAddAppAccessRestrictions = ( + params: Params< + t_ReposAddAppAccessRestrictionsParamSchema, + void, + t_ReposAddAppAccessRestrictionsRequestBodySchema, + void + >, + respond: ReposAddAppAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposSetAppAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposSetAppAccessRestrictions = ( + params: Params< + t_ReposSetAppAccessRestrictionsParamSchema, + void, + t_ReposSetAppAccessRestrictionsRequestBodySchema, + void + >, + respond: ReposSetAppAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRemoveAppAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRemoveAppAccessRestrictions = ( + params: Params< + t_ReposRemoveAppAccessRestrictionsParamSchema, + void, + t_ReposRemoveAppAccessRestrictionsRequestBodySchema, + void + >, + respond: ReposRemoveAppAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetTeamsWithAccessToProtectedBranchResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetTeamsWithAccessToProtectedBranch = ( + params: Params< + t_ReposGetTeamsWithAccessToProtectedBranchParamSchema, + void, + void, + void + >, + respond: ReposGetTeamsWithAccessToProtectedBranchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposAddTeamAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposAddTeamAccessRestrictions = ( + params: Params< + t_ReposAddTeamAccessRestrictionsParamSchema, + void, + t_ReposAddTeamAccessRestrictionsRequestBodySchema | undefined, + void + >, + respond: ReposAddTeamAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposSetTeamAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposSetTeamAccessRestrictions = ( + params: Params< + t_ReposSetTeamAccessRestrictionsParamSchema, + void, + t_ReposSetTeamAccessRestrictionsRequestBodySchema | undefined, + void + >, + respond: ReposSetTeamAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRemoveTeamAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRemoveTeamAccessRestrictions = ( + params: Params< + t_ReposRemoveTeamAccessRestrictionsParamSchema, + void, + t_ReposRemoveTeamAccessRestrictionsRequestBodySchema, + void + >, + respond: ReposRemoveTeamAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetUsersWithAccessToProtectedBranchResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetUsersWithAccessToProtectedBranch = ( + params: Params< + t_ReposGetUsersWithAccessToProtectedBranchParamSchema, + void, + void, + void + >, + respond: ReposGetUsersWithAccessToProtectedBranchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposAddUserAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposAddUserAccessRestrictions = ( + params: Params< + t_ReposAddUserAccessRestrictionsParamSchema, + void, + t_ReposAddUserAccessRestrictionsRequestBodySchema, + void + >, + respond: ReposAddUserAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposSetUserAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposSetUserAccessRestrictions = ( + params: Params< + t_ReposSetUserAccessRestrictionsParamSchema, + void, + t_ReposSetUserAccessRestrictionsRequestBodySchema, + void + >, + respond: ReposSetUserAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRemoveUserAccessRestrictionsResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRemoveUserAccessRestrictions = ( + params: Params< + t_ReposRemoveUserAccessRestrictionsParamSchema, + void, + t_ReposRemoveUserAccessRestrictionsRequestBodySchema, + void + >, + respond: ReposRemoveUserAccessRestrictionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRenameBranchResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRenameBranch = ( + params: Params< + t_ReposRenameBranchParamSchema, + void, + t_ReposRenameBranchRequestBodySchema, + void + >, + respond: ReposRenameBranchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksCreateResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksCreate = ( + params: Params< + t_ChecksCreateParamSchema, + void, + t_ChecksCreateRequestBodySchema, + void + >, + respond: ChecksCreateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksGetResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksGet = ( + params: Params, + respond: ChecksGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksUpdateResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksUpdate = ( + params: Params< + t_ChecksUpdateParamSchema, + void, + t_ChecksUpdateRequestBodySchema, + void + >, + respond: ChecksUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksListAnnotationsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksListAnnotations = ( + params: Params< + t_ChecksListAnnotationsParamSchema, + t_ChecksListAnnotationsQuerySchema, + void, + void + >, + respond: ChecksListAnnotationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksRerequestRunResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksRerequestRun = ( + params: Params, + respond: ChecksRerequestRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksCreateSuiteResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksCreateSuite = ( + params: Params< + t_ChecksCreateSuiteParamSchema, + void, + t_ChecksCreateSuiteRequestBodySchema, + void + >, + respond: ChecksCreateSuiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksSetSuitesPreferencesResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksSetSuitesPreferences = ( + params: Params< + t_ChecksSetSuitesPreferencesParamSchema, + void, + t_ChecksSetSuitesPreferencesRequestBodySchema, + void + >, + respond: ChecksSetSuitesPreferencesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksGetSuiteResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksGetSuite = ( + params: Params, + respond: ChecksGetSuiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksListForSuiteResponder = { + with200(): ExpressRuntimeResponse<{ + check_runs: t_check_run[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ChecksListForSuite = ( + params: Params< + t_ChecksListForSuiteParamSchema, + t_ChecksListForSuiteQuerySchema, + void, + void + >, + respond: ChecksListForSuiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksRerequestSuiteResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChecksRerequestSuite = ( + params: Params, + respond: ChecksRerequestSuiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningListAlertsForRepoResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningListAlertsForRepo = ( + params: Params< + t_CodeScanningListAlertsForRepoParamSchema, + t_CodeScanningListAlertsForRepoQuerySchema, + void, + void + >, + respond: CodeScanningListAlertsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningGetAlertResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningGetAlert = ( + params: Params, + respond: CodeScanningGetAlertResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningUpdateAlertResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningUpdateAlert = ( + params: Params< + t_CodeScanningUpdateAlertParamSchema, + void, + t_CodeScanningUpdateAlertRequestBodySchema, + void + >, + respond: CodeScanningUpdateAlertResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningGetAutofixResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningGetAutofix = ( + params: Params, + respond: CodeScanningGetAutofixResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningCreateAutofixResponder = { + with200(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningCreateAutofix = ( + params: Params, + respond: CodeScanningCreateAutofixResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningCommitAutofixResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningCommitAutofix = ( + params: Params< + t_CodeScanningCommitAutofixParamSchema, + void, + t_CodeScanningCommitAutofixRequestBodySchema | undefined, + void + >, + respond: CodeScanningCommitAutofixResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningListAlertInstancesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningListAlertInstances = ( + params: Params< + t_CodeScanningListAlertInstancesParamSchema, + t_CodeScanningListAlertInstancesQuerySchema, + void, + void + >, + respond: CodeScanningListAlertInstancesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningListRecentAnalysesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningListRecentAnalyses = ( + params: Params< + t_CodeScanningListRecentAnalysesParamSchema, + t_CodeScanningListRecentAnalysesQuerySchema, + void, + void + >, + respond: CodeScanningListRecentAnalysesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningGetAnalysisResponder = { + with200(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningGetAnalysis = ( + params: Params, + respond: CodeScanningGetAnalysisResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningDeleteAnalysisResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningDeleteAnalysis = ( + params: Params< + t_CodeScanningDeleteAnalysisParamSchema, + t_CodeScanningDeleteAnalysisQuerySchema, + void, + void + >, + respond: CodeScanningDeleteAnalysisResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningListCodeqlDatabasesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningListCodeqlDatabases = ( + params: Params< + t_CodeScanningListCodeqlDatabasesParamSchema, + void, + void, + void + >, + respond: CodeScanningListCodeqlDatabasesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningGetCodeqlDatabaseResponder = { + with200(): ExpressRuntimeResponse + with302(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningGetCodeqlDatabase = ( + params: Params, + respond: CodeScanningGetCodeqlDatabaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningDeleteCodeqlDatabaseResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningDeleteCodeqlDatabase = ( + params: Params< + t_CodeScanningDeleteCodeqlDatabaseParamSchema, + void, + void, + void + >, + respond: CodeScanningDeleteCodeqlDatabaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningCreateVariantAnalysisResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningCreateVariantAnalysis = ( + params: Params< + t_CodeScanningCreateVariantAnalysisParamSchema, + void, + t_CodeScanningCreateVariantAnalysisRequestBodySchema, + void + >, + respond: CodeScanningCreateVariantAnalysisResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningGetVariantAnalysisResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningGetVariantAnalysis = ( + params: Params, + respond: CodeScanningGetVariantAnalysisResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningGetVariantAnalysisRepoTaskResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningGetVariantAnalysisRepoTask = ( + params: Params< + t_CodeScanningGetVariantAnalysisRepoTaskParamSchema, + void, + void, + void + >, + respond: CodeScanningGetVariantAnalysisRepoTaskResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningGetDefaultSetupResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningGetDefaultSetup = ( + params: Params, + respond: CodeScanningGetDefaultSetupResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningUpdateDefaultSetupResponder = { + with200(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningUpdateDefaultSetup = ( + params: Params< + t_CodeScanningUpdateDefaultSetupParamSchema, + void, + t_CodeScanningUpdateDefaultSetupRequestBodySchema, + void + >, + respond: CodeScanningUpdateDefaultSetupResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningUploadSarifResponder = { + with202(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with413(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningUploadSarif = ( + params: Params< + t_CodeScanningUploadSarifParamSchema, + void, + t_CodeScanningUploadSarifRequestBodySchema, + void + >, + respond: CodeScanningUploadSarifResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeScanningGetSarifResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodeScanningGetSarif = ( + params: Params, + respond: CodeScanningGetSarifResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodeSecurityGetConfigurationForRepositoryResponder = { + with200(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodeSecurityGetConfigurationForRepository = ( + params: Params< + t_CodeSecurityGetConfigurationForRepositoryParamSchema, + void, + void, + void + >, + respond: CodeSecurityGetConfigurationForRepositoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCodeownersErrorsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCodeownersErrors = ( + params: Params< + t_ReposCodeownersErrorsParamSchema, + t_ReposCodeownersErrorsQuerySchema, + void, + void + >, + respond: ReposCodeownersErrorsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListInRepositoryForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + codespaces: t_codespace[] + total_count: number + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesListInRepositoryForAuthenticatedUser = ( + params: Params< + t_CodespacesListInRepositoryForAuthenticatedUserParamSchema, + t_CodespacesListInRepositoryForAuthenticatedUserQuerySchema, + void, + void + >, + respond: CodespacesListInRepositoryForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesCreateWithRepoForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodespacesCreateWithRepoForAuthenticatedUser = ( + params: Params< + t_CodespacesCreateWithRepoForAuthenticatedUserParamSchema, + void, + t_CodespacesCreateWithRepoForAuthenticatedUserRequestBodySchema, + void + >, + respond: CodespacesCreateWithRepoForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListDevcontainersInRepositoryForAuthenticatedUserResponder = + { + with200(): ExpressRuntimeResponse<{ + devcontainers: { + display_name?: string | undefined + name?: string | undefined + path: string + }[] + total_count: number + }> + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type CodespacesListDevcontainersInRepositoryForAuthenticatedUser = ( + params: Params< + t_CodespacesListDevcontainersInRepositoryForAuthenticatedUserParamSchema, + t_CodespacesListDevcontainersInRepositoryForAuthenticatedUserQuerySchema, + void, + void + >, + respond: CodespacesListDevcontainersInRepositoryForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesRepoMachinesForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + machines: t_codespace_machine[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesRepoMachinesForAuthenticatedUser = ( + params: Params< + t_CodespacesRepoMachinesForAuthenticatedUserParamSchema, + t_CodespacesRepoMachinesForAuthenticatedUserQuerySchema, + void, + void + >, + respond: CodespacesRepoMachinesForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesPreFlightWithRepoForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + billable_owner?: t_simple_user | undefined + defaults?: + | { + devcontainer_path: string | null + location: string + } + | undefined + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesPreFlightWithRepoForAuthenticatedUser = ( + params: Params< + t_CodespacesPreFlightWithRepoForAuthenticatedUserParamSchema, + t_CodespacesPreFlightWithRepoForAuthenticatedUserQuerySchema, + void, + void + >, + respond: CodespacesPreFlightWithRepoForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesCheckPermissionsForDevcontainerResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodespacesCheckPermissionsForDevcontainer = ( + params: Params< + t_CodespacesCheckPermissionsForDevcontainerParamSchema, + t_CodespacesCheckPermissionsForDevcontainerQuerySchema, + void, + void + >, + respond: CodespacesCheckPermissionsForDevcontainerResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListRepoSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_repo_codespaces_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type CodespacesListRepoSecrets = ( + params: Params< + t_CodespacesListRepoSecretsParamSchema, + t_CodespacesListRepoSecretsQuerySchema, + void, + void + >, + respond: CodespacesListRepoSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetRepoPublicKeyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetRepoPublicKey = ( + params: Params, + respond: CodespacesGetRepoPublicKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetRepoSecretResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetRepoSecret = ( + params: Params, + respond: CodespacesGetRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesCreateOrUpdateRepoSecretResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesCreateOrUpdateRepoSecret = ( + params: Params< + t_CodespacesCreateOrUpdateRepoSecretParamSchema, + void, + t_CodespacesCreateOrUpdateRepoSecretRequestBodySchema, + void + >, + respond: CodespacesCreateOrUpdateRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesDeleteRepoSecretResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesDeleteRepoSecret = ( + params: Params, + respond: CodespacesDeleteRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListCollaboratorsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListCollaborators = ( + params: Params< + t_ReposListCollaboratorsParamSchema, + t_ReposListCollaboratorsQuerySchema, + void, + void + >, + respond: ReposListCollaboratorsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCheckCollaboratorResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCheckCollaborator = ( + params: Params, + respond: ReposCheckCollaboratorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposAddCollaboratorResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposAddCollaborator = ( + params: Params< + t_ReposAddCollaboratorParamSchema, + void, + t_ReposAddCollaboratorRequestBodySchema | undefined, + void + >, + respond: ReposAddCollaboratorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRemoveCollaboratorResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRemoveCollaborator = ( + params: Params, + respond: ReposRemoveCollaboratorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCollaboratorPermissionLevelResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCollaboratorPermissionLevel = ( + params: Params< + t_ReposGetCollaboratorPermissionLevelParamSchema, + void, + void, + void + >, + respond: ReposGetCollaboratorPermissionLevelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListCommitCommentsForRepoResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListCommitCommentsForRepo = ( + params: Params< + t_ReposListCommitCommentsForRepoParamSchema, + t_ReposListCommitCommentsForRepoQuerySchema, + void, + void + >, + respond: ReposListCommitCommentsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCommitCommentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCommitComment = ( + params: Params, + respond: ReposGetCommitCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateCommitCommentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateCommitComment = ( + params: Params< + t_ReposUpdateCommitCommentParamSchema, + void, + t_ReposUpdateCommitCommentRequestBodySchema, + void + >, + respond: ReposUpdateCommitCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteCommitCommentResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteCommitComment = ( + params: Params, + respond: ReposDeleteCommitCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForCommitCommentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForCommitComment = ( + params: Params< + t_ReactionsListForCommitCommentParamSchema, + t_ReactionsListForCommitCommentQuerySchema, + void, + void + >, + respond: ReactionsListForCommitCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForCommitCommentResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForCommitComment = ( + params: Params< + t_ReactionsCreateForCommitCommentParamSchema, + void, + t_ReactionsCreateForCommitCommentRequestBodySchema, + void + >, + respond: ReactionsCreateForCommitCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsDeleteForCommitCommentResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsDeleteForCommitComment = ( + params: Params< + t_ReactionsDeleteForCommitCommentParamSchema, + void, + void, + void + >, + respond: ReactionsDeleteForCommitCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListCommitsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListCommits = ( + params: Params< + t_ReposListCommitsParamSchema, + t_ReposListCommitsQuerySchema, + void, + void + >, + respond: ReposListCommitsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListBranchesForHeadCommitResponder = { + with200(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListBranchesForHeadCommit = ( + params: Params, + respond: ReposListBranchesForHeadCommitResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListCommentsForCommitResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListCommentsForCommit = ( + params: Params< + t_ReposListCommentsForCommitParamSchema, + t_ReposListCommentsForCommitQuerySchema, + void, + void + >, + respond: ReposListCommentsForCommitResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateCommitCommentResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateCommitComment = ( + params: Params< + t_ReposCreateCommitCommentParamSchema, + void, + t_ReposCreateCommitCommentRequestBodySchema, + void + >, + respond: ReposCreateCommitCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListPullRequestsAssociatedWithCommitResponder = { + with200(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListPullRequestsAssociatedWithCommit = ( + params: Params< + t_ReposListPullRequestsAssociatedWithCommitParamSchema, + t_ReposListPullRequestsAssociatedWithCommitQuerySchema, + void, + void + >, + respond: ReposListPullRequestsAssociatedWithCommitResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCommitResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type ReposGetCommit = ( + params: Params< + t_ReposGetCommitParamSchema, + t_ReposGetCommitQuerySchema, + void, + void + >, + respond: ReposGetCommitResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksListForRefResponder = { + with200(): ExpressRuntimeResponse<{ + check_runs: t_check_run[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ChecksListForRef = ( + params: Params< + t_ChecksListForRefParamSchema, + t_ChecksListForRefQuerySchema, + void, + void + >, + respond: ChecksListForRefResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChecksListSuitesForRefResponder = { + with200(): ExpressRuntimeResponse<{ + check_suites: t_check_suite[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ChecksListSuitesForRef = ( + params: Params< + t_ChecksListSuitesForRefParamSchema, + t_ChecksListSuitesForRefQuerySchema, + void, + void + >, + respond: ChecksListSuitesForRefResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCombinedStatusForRefResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCombinedStatusForRef = ( + params: Params< + t_ReposGetCombinedStatusForRefParamSchema, + t_ReposGetCombinedStatusForRefQuerySchema, + void, + void + >, + respond: ReposGetCombinedStatusForRefResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListCommitStatusesForRefResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListCommitStatusesForRef = ( + params: Params< + t_ReposListCommitStatusesForRefParamSchema, + t_ReposListCommitStatusesForRefQuerySchema, + void, + void + >, + respond: ReposListCommitStatusesForRefResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCommunityProfileMetricsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCommunityProfileMetrics = ( + params: Params< + t_ReposGetCommunityProfileMetricsParamSchema, + void, + void, + void + >, + respond: ReposGetCommunityProfileMetricsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCompareCommitsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type ReposCompareCommits = ( + params: Params< + t_ReposCompareCommitsParamSchema, + t_ReposCompareCommitsQuerySchema, + void, + void + >, + respond: ReposCompareCommitsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetContentResponder = { + with200(): ExpressRuntimeResponse< + | t_content_directory + | t_content_file + | t_content_symlink + | t_content_submodule + > + with302(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetContent = ( + params: Params< + t_ReposGetContentParamSchema, + t_ReposGetContentQuerySchema, + void, + void + >, + respond: ReposGetContentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateOrUpdateFileContentsResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse< + t_basic_error | t_repository_rule_violation_error + > + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateOrUpdateFileContents = ( + params: Params< + t_ReposCreateOrUpdateFileContentsParamSchema, + void, + t_ReposCreateOrUpdateFileContentsRequestBodySchema, + void + >, + respond: ReposCreateOrUpdateFileContentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteFileResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type ReposDeleteFile = ( + params: Params< + t_ReposDeleteFileParamSchema, + void, + t_ReposDeleteFileRequestBodySchema, + void + >, + respond: ReposDeleteFileResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListContributorsResponder = { + with200(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListContributors = ( + params: Params< + t_ReposListContributorsParamSchema, + t_ReposListContributorsQuerySchema, + void, + void + >, + respond: ReposListContributorsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotListAlertsForRepoResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotListAlertsForRepo = ( + params: Params< + t_DependabotListAlertsForRepoParamSchema, + t_DependabotListAlertsForRepoQuerySchema, + void, + void + >, + respond: DependabotListAlertsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotGetAlertResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotGetAlert = ( + params: Params, + respond: DependabotGetAlertResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotUpdateAlertResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotUpdateAlert = ( + params: Params< + t_DependabotUpdateAlertParamSchema, + void, + t_DependabotUpdateAlertRequestBodySchema, + void + >, + respond: DependabotUpdateAlertResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotListRepoSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_dependabot_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type DependabotListRepoSecrets = ( + params: Params< + t_DependabotListRepoSecretsParamSchema, + t_DependabotListRepoSecretsQuerySchema, + void, + void + >, + respond: DependabotListRepoSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotGetRepoPublicKeyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotGetRepoPublicKey = ( + params: Params, + respond: DependabotGetRepoPublicKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotGetRepoSecretResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotGetRepoSecret = ( + params: Params, + respond: DependabotGetRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotCreateOrUpdateRepoSecretResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotCreateOrUpdateRepoSecret = ( + params: Params< + t_DependabotCreateOrUpdateRepoSecretParamSchema, + void, + t_DependabotCreateOrUpdateRepoSecretRequestBodySchema, + void + >, + respond: DependabotCreateOrUpdateRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependabotDeleteRepoSecretResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependabotDeleteRepoSecret = ( + params: Params, + respond: DependabotDeleteRepoSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependencyGraphDiffRangeResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependencyGraphDiffRange = ( + params: Params< + t_DependencyGraphDiffRangeParamSchema, + t_DependencyGraphDiffRangeQuerySchema, + void, + void + >, + respond: DependencyGraphDiffRangeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependencyGraphExportSbomResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DependencyGraphExportSbom = ( + params: Params, + respond: DependencyGraphExportSbomResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DependencyGraphCreateRepositorySnapshotResponder = { + with201(): ExpressRuntimeResponse<{ + created_at: string + id: number + message: string + result: string + }> +} & ExpressRuntimeResponder + +export type DependencyGraphCreateRepositorySnapshot = ( + params: Params< + t_DependencyGraphCreateRepositorySnapshotParamSchema, + void, + t_DependencyGraphCreateRepositorySnapshotRequestBodySchema, + void + >, + respond: DependencyGraphCreateRepositorySnapshotResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListDeploymentsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListDeployments = ( + params: Params< + t_ReposListDeploymentsParamSchema, + t_ReposListDeploymentsQuerySchema, + void, + void + >, + respond: ReposListDeploymentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateDeploymentResponder = { + with201(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse<{ + message?: string | undefined + }> + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateDeployment = ( + params: Params< + t_ReposCreateDeploymentParamSchema, + void, + t_ReposCreateDeploymentRequestBodySchema, + void + >, + respond: ReposCreateDeploymentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetDeploymentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetDeployment = ( + params: Params, + respond: ReposGetDeploymentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteDeploymentResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteDeployment = ( + params: Params, + respond: ReposDeleteDeploymentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListDeploymentStatusesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListDeploymentStatuses = ( + params: Params< + t_ReposListDeploymentStatusesParamSchema, + t_ReposListDeploymentStatusesQuerySchema, + void, + void + >, + respond: ReposListDeploymentStatusesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateDeploymentStatusResponder = { + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateDeploymentStatus = ( + params: Params< + t_ReposCreateDeploymentStatusParamSchema, + void, + t_ReposCreateDeploymentStatusRequestBodySchema, + void + >, + respond: ReposCreateDeploymentStatusResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetDeploymentStatusResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetDeploymentStatus = ( + params: Params, + respond: ReposGetDeploymentStatusResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateDispatchEventResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateDispatchEvent = ( + params: Params< + t_ReposCreateDispatchEventParamSchema, + void, + t_ReposCreateDispatchEventRequestBodySchema, + void + >, + respond: ReposCreateDispatchEventResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetAllEnvironmentsResponder = { + with200(): ExpressRuntimeResponse<{ + environments?: t_environment[] | undefined + total_count?: number | undefined + }> +} & ExpressRuntimeResponder + +export type ReposGetAllEnvironments = ( + params: Params< + t_ReposGetAllEnvironmentsParamSchema, + t_ReposGetAllEnvironmentsQuerySchema, + void, + void + >, + respond: ReposGetAllEnvironmentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetEnvironmentResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetEnvironment = ( + params: Params, + respond: ReposGetEnvironmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateOrUpdateEnvironmentResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateOrUpdateEnvironment = ( + params: Params< + t_ReposCreateOrUpdateEnvironmentParamSchema, + void, + t_ReposCreateOrUpdateEnvironmentRequestBodySchema | undefined, + void + >, + respond: ReposCreateOrUpdateEnvironmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteAnEnvironmentResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteAnEnvironment = ( + params: Params, + respond: ReposDeleteAnEnvironmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListDeploymentBranchPoliciesResponder = { + with200(): ExpressRuntimeResponse<{ + branch_policies: t_deployment_branch_policy[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ReposListDeploymentBranchPolicies = ( + params: Params< + t_ReposListDeploymentBranchPoliciesParamSchema, + t_ReposListDeploymentBranchPoliciesQuerySchema, + void, + void + >, + respond: ReposListDeploymentBranchPoliciesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateDeploymentBranchPolicyResponder = { + with200(): ExpressRuntimeResponse + with303(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateDeploymentBranchPolicy = ( + params: Params< + t_ReposCreateDeploymentBranchPolicyParamSchema, + void, + t_ReposCreateDeploymentBranchPolicyRequestBodySchema, + void + >, + respond: ReposCreateDeploymentBranchPolicyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetDeploymentBranchPolicyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetDeploymentBranchPolicy = ( + params: Params, + respond: ReposGetDeploymentBranchPolicyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateDeploymentBranchPolicyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateDeploymentBranchPolicy = ( + params: Params< + t_ReposUpdateDeploymentBranchPolicyParamSchema, + void, + t_ReposUpdateDeploymentBranchPolicyRequestBodySchema, + void + >, + respond: ReposUpdateDeploymentBranchPolicyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteDeploymentBranchPolicyResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteDeploymentBranchPolicy = ( + params: Params< + t_ReposDeleteDeploymentBranchPolicyParamSchema, + void, + void, + void + >, + respond: ReposDeleteDeploymentBranchPolicyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetAllDeploymentProtectionRulesResponder = { + with200(): ExpressRuntimeResponse<{ + custom_deployment_protection_rules?: + | t_deployment_protection_rule[] + | undefined + total_count?: number | undefined + }> +} & ExpressRuntimeResponder + +export type ReposGetAllDeploymentProtectionRules = ( + params: Params< + t_ReposGetAllDeploymentProtectionRulesParamSchema, + void, + void, + void + >, + respond: ReposGetAllDeploymentProtectionRulesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateDeploymentProtectionRuleResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateDeploymentProtectionRule = ( + params: Params< + t_ReposCreateDeploymentProtectionRuleParamSchema, + void, + t_ReposCreateDeploymentProtectionRuleRequestBodySchema, + void + >, + respond: ReposCreateDeploymentProtectionRuleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListCustomDeploymentRuleIntegrationsResponder = { + with200(): ExpressRuntimeResponse<{ + available_custom_deployment_protection_rule_integrations?: + | t_custom_deployment_rule_app[] + | undefined + total_count?: number | undefined + }> +} & ExpressRuntimeResponder + +export type ReposListCustomDeploymentRuleIntegrations = ( + params: Params< + t_ReposListCustomDeploymentRuleIntegrationsParamSchema, + t_ReposListCustomDeploymentRuleIntegrationsQuerySchema, + void, + void + >, + respond: ReposListCustomDeploymentRuleIntegrationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCustomDeploymentProtectionRuleResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCustomDeploymentProtectionRule = ( + params: Params< + t_ReposGetCustomDeploymentProtectionRuleParamSchema, + void, + void, + void + >, + respond: ReposGetCustomDeploymentProtectionRuleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDisableDeploymentProtectionRuleResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDisableDeploymentProtectionRule = ( + params: Params< + t_ReposDisableDeploymentProtectionRuleParamSchema, + void, + void, + void + >, + respond: ReposDisableDeploymentProtectionRuleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListEnvironmentSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_actions_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type ActionsListEnvironmentSecrets = ( + params: Params< + t_ActionsListEnvironmentSecretsParamSchema, + t_ActionsListEnvironmentSecretsQuerySchema, + void, + void + >, + respond: ActionsListEnvironmentSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetEnvironmentPublicKeyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetEnvironmentPublicKey = ( + params: Params, + respond: ActionsGetEnvironmentPublicKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetEnvironmentSecretResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetEnvironmentSecret = ( + params: Params, + respond: ActionsGetEnvironmentSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateOrUpdateEnvironmentSecretResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateOrUpdateEnvironmentSecret = ( + params: Params< + t_ActionsCreateOrUpdateEnvironmentSecretParamSchema, + void, + t_ActionsCreateOrUpdateEnvironmentSecretRequestBodySchema, + void + >, + respond: ActionsCreateOrUpdateEnvironmentSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteEnvironmentSecretResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteEnvironmentSecret = ( + params: Params, + respond: ActionsDeleteEnvironmentSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsListEnvironmentVariablesResponder = { + with200(): ExpressRuntimeResponse<{ + total_count: number + variables: t_actions_variable[] + }> +} & ExpressRuntimeResponder + +export type ActionsListEnvironmentVariables = ( + params: Params< + t_ActionsListEnvironmentVariablesParamSchema, + t_ActionsListEnvironmentVariablesQuerySchema, + void, + void + >, + respond: ActionsListEnvironmentVariablesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsCreateEnvironmentVariableResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsCreateEnvironmentVariable = ( + params: Params< + t_ActionsCreateEnvironmentVariableParamSchema, + void, + t_ActionsCreateEnvironmentVariableRequestBodySchema, + void + >, + respond: ActionsCreateEnvironmentVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsGetEnvironmentVariableResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsGetEnvironmentVariable = ( + params: Params, + respond: ActionsGetEnvironmentVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsUpdateEnvironmentVariableResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsUpdateEnvironmentVariable = ( + params: Params< + t_ActionsUpdateEnvironmentVariableParamSchema, + void, + t_ActionsUpdateEnvironmentVariableRequestBodySchema, + void + >, + respond: ActionsUpdateEnvironmentVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActionsDeleteEnvironmentVariableResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActionsDeleteEnvironmentVariable = ( + params: Params< + t_ActionsDeleteEnvironmentVariableParamSchema, + void, + void, + void + >, + respond: ActionsDeleteEnvironmentVariableResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListRepoEventsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListRepoEvents = ( + params: Params< + t_ActivityListRepoEventsParamSchema, + t_ActivityListRepoEventsQuerySchema, + void, + void + >, + respond: ActivityListRepoEventsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListForksResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListForks = ( + params: Params< + t_ReposListForksParamSchema, + t_ReposListForksQuerySchema, + void, + void + >, + respond: ReposListForksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateForkResponder = { + with202(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateFork = ( + params: Params< + t_ReposCreateForkParamSchema, + void, + t_ReposCreateForkRequestBodySchema | undefined, + void + >, + respond: ReposCreateForkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitCreateBlobResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse< + t_validation_error | t_repository_rule_violation_error + > +} & ExpressRuntimeResponder + +export type GitCreateBlob = ( + params: Params< + t_GitCreateBlobParamSchema, + void, + t_GitCreateBlobRequestBodySchema, + void + >, + respond: GitCreateBlobResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitGetBlobResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitGetBlob = ( + params: Params, + respond: GitGetBlobResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitCreateCommitResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitCreateCommit = ( + params: Params< + t_GitCreateCommitParamSchema, + void, + t_GitCreateCommitRequestBodySchema, + void + >, + respond: GitCreateCommitResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitGetCommitResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitGetCommit = ( + params: Params, + respond: GitGetCommitResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitListMatchingRefsResponder = { + with200(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitListMatchingRefs = ( + params: Params, + respond: GitListMatchingRefsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitGetRefResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitGetRef = ( + params: Params, + respond: GitGetRefResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitCreateRefResponder = { + with201(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitCreateRef = ( + params: Params< + t_GitCreateRefParamSchema, + void, + t_GitCreateRefRequestBodySchema, + void + >, + respond: GitCreateRefResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitUpdateRefResponder = { + with200(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitUpdateRef = ( + params: Params< + t_GitUpdateRefParamSchema, + void, + t_GitUpdateRefRequestBodySchema, + void + >, + respond: GitUpdateRefResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitDeleteRefResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitDeleteRef = ( + params: Params, + respond: GitDeleteRefResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitCreateTagResponder = { + with201(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitCreateTag = ( + params: Params< + t_GitCreateTagParamSchema, + void, + t_GitCreateTagRequestBodySchema, + void + >, + respond: GitCreateTagResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitGetTagResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitGetTag = ( + params: Params, + respond: GitGetTagResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitCreateTreeResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitCreateTree = ( + params: Params< + t_GitCreateTreeParamSchema, + void, + t_GitCreateTreeRequestBodySchema, + void + >, + respond: GitCreateTreeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GitGetTreeResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GitGetTree = ( + params: Params, + respond: GitGetTreeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListWebhooksResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListWebhooks = ( + params: Params< + t_ReposListWebhooksParamSchema, + t_ReposListWebhooksQuerySchema, + void, + void + >, + respond: ReposListWebhooksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateWebhookResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateWebhook = ( + params: Params< + t_ReposCreateWebhookParamSchema, + void, + t_ReposCreateWebhookRequestBodySchema | undefined, + void + >, + respond: ReposCreateWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetWebhookResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetWebhook = ( + params: Params, + respond: ReposGetWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateWebhookResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateWebhook = ( + params: Params< + t_ReposUpdateWebhookParamSchema, + void, + t_ReposUpdateWebhookRequestBodySchema, + void + >, + respond: ReposUpdateWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteWebhookResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteWebhook = ( + params: Params, + respond: ReposDeleteWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetWebhookConfigForRepoResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetWebhookConfigForRepo = ( + params: Params, + respond: ReposGetWebhookConfigForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateWebhookConfigForRepoResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateWebhookConfigForRepo = ( + params: Params< + t_ReposUpdateWebhookConfigForRepoParamSchema, + void, + t_ReposUpdateWebhookConfigForRepoRequestBodySchema | undefined, + void + >, + respond: ReposUpdateWebhookConfigForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListWebhookDeliveriesResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListWebhookDeliveries = ( + params: Params< + t_ReposListWebhookDeliveriesParamSchema, + t_ReposListWebhookDeliveriesQuerySchema, + void, + void + >, + respond: ReposListWebhookDeliveriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetWebhookDeliveryResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetWebhookDelivery = ( + params: Params, + respond: ReposGetWebhookDeliveryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRedeliverWebhookDeliveryResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with400(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRedeliverWebhookDelivery = ( + params: Params, + respond: ReposRedeliverWebhookDeliveryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposPingWebhookResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposPingWebhook = ( + params: Params, + respond: ReposPingWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposTestPushWebhookResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposTestPushWebhook = ( + params: Params, + respond: ReposTestPushWebhookResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsGetImportStatusResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsGetImportStatus = ( + params: Params, + respond: MigrationsGetImportStatusResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsStartImportResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsStartImport = ( + params: Params< + t_MigrationsStartImportParamSchema, + void, + t_MigrationsStartImportRequestBodySchema, + void + >, + respond: MigrationsStartImportResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsUpdateImportResponder = { + with200(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsUpdateImport = ( + params: Params< + t_MigrationsUpdateImportParamSchema, + void, + t_MigrationsUpdateImportRequestBodySchema | undefined, + void + >, + respond: MigrationsUpdateImportResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsCancelImportResponder = { + with204(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsCancelImport = ( + params: Params, + respond: MigrationsCancelImportResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsGetCommitAuthorsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsGetCommitAuthors = ( + params: Params< + t_MigrationsGetCommitAuthorsParamSchema, + t_MigrationsGetCommitAuthorsQuerySchema, + void, + void + >, + respond: MigrationsGetCommitAuthorsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsMapCommitAuthorResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsMapCommitAuthor = ( + params: Params< + t_MigrationsMapCommitAuthorParamSchema, + void, + t_MigrationsMapCommitAuthorRequestBodySchema | undefined, + void + >, + respond: MigrationsMapCommitAuthorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsGetLargeFilesResponder = { + with200(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsGetLargeFiles = ( + params: Params, + respond: MigrationsGetLargeFilesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsSetLfsPreferenceResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsSetLfsPreference = ( + params: Params< + t_MigrationsSetLfsPreferenceParamSchema, + void, + t_MigrationsSetLfsPreferenceRequestBodySchema, + void + >, + respond: MigrationsSetLfsPreferenceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetRepoInstallationResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetRepoInstallation = ( + params: Params, + respond: AppsGetRepoInstallationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsGetRestrictionsForRepoResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsGetRestrictionsForRepo = ( + params: Params< + t_InteractionsGetRestrictionsForRepoParamSchema, + void, + void, + void + >, + respond: InteractionsGetRestrictionsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsSetRestrictionsForRepoResponder = { + with200(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsSetRestrictionsForRepo = ( + params: Params< + t_InteractionsSetRestrictionsForRepoParamSchema, + void, + t_InteractionsSetRestrictionsForRepoRequestBodySchema, + void + >, + respond: InteractionsSetRestrictionsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsRemoveRestrictionsForRepoResponder = { + with204(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsRemoveRestrictionsForRepo = ( + params: Params< + t_InteractionsRemoveRestrictionsForRepoParamSchema, + void, + void, + void + >, + respond: InteractionsRemoveRestrictionsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListInvitationsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListInvitations = ( + params: Params< + t_ReposListInvitationsParamSchema, + t_ReposListInvitationsQuerySchema, + void, + void + >, + respond: ReposListInvitationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateInvitationResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateInvitation = ( + params: Params< + t_ReposUpdateInvitationParamSchema, + void, + t_ReposUpdateInvitationRequestBodySchema | undefined, + void + >, + respond: ReposUpdateInvitationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteInvitationResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteInvitation = ( + params: Params, + respond: ReposDeleteInvitationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListForRepoResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListForRepo = ( + params: Params< + t_IssuesListForRepoParamSchema, + t_IssuesListForRepoQuerySchema, + void, + void + >, + respond: IssuesListForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesCreateResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type IssuesCreate = ( + params: Params< + t_IssuesCreateParamSchema, + void, + t_IssuesCreateRequestBodySchema, + void + >, + respond: IssuesCreateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListCommentsForRepoResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListCommentsForRepo = ( + params: Params< + t_IssuesListCommentsForRepoParamSchema, + t_IssuesListCommentsForRepoQuerySchema, + void, + void + >, + respond: IssuesListCommentsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesGetCommentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesGetComment = ( + params: Params, + respond: IssuesGetCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesUpdateCommentResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesUpdateComment = ( + params: Params< + t_IssuesUpdateCommentParamSchema, + void, + t_IssuesUpdateCommentRequestBodySchema, + void + >, + respond: IssuesUpdateCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesDeleteCommentResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesDeleteComment = ( + params: Params, + respond: IssuesDeleteCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForIssueCommentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForIssueComment = ( + params: Params< + t_ReactionsListForIssueCommentParamSchema, + t_ReactionsListForIssueCommentQuerySchema, + void, + void + >, + respond: ReactionsListForIssueCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForIssueCommentResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForIssueComment = ( + params: Params< + t_ReactionsCreateForIssueCommentParamSchema, + void, + t_ReactionsCreateForIssueCommentRequestBodySchema, + void + >, + respond: ReactionsCreateForIssueCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsDeleteForIssueCommentResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsDeleteForIssueComment = ( + params: Params, + respond: ReactionsDeleteForIssueCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListEventsForRepoResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListEventsForRepo = ( + params: Params< + t_IssuesListEventsForRepoParamSchema, + t_IssuesListEventsForRepoQuerySchema, + void, + void + >, + respond: IssuesListEventsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesGetEventResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesGetEvent = ( + params: Params, + respond: IssuesGetEventResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesGetResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesGet = ( + params: Params, + respond: IssuesGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesUpdateResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type IssuesUpdate = ( + params: Params< + t_IssuesUpdateParamSchema, + void, + t_IssuesUpdateRequestBodySchema | undefined, + void + >, + respond: IssuesUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesAddAssigneesResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesAddAssignees = ( + params: Params< + t_IssuesAddAssigneesParamSchema, + void, + t_IssuesAddAssigneesRequestBodySchema | undefined, + void + >, + respond: IssuesAddAssigneesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesRemoveAssigneesResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesRemoveAssignees = ( + params: Params< + t_IssuesRemoveAssigneesParamSchema, + void, + t_IssuesRemoveAssigneesRequestBodySchema, + void + >, + respond: IssuesRemoveAssigneesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesCheckUserCanBeAssignedToIssueResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesCheckUserCanBeAssignedToIssue = ( + params: Params< + t_IssuesCheckUserCanBeAssignedToIssueParamSchema, + void, + void, + void + >, + respond: IssuesCheckUserCanBeAssignedToIssueResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListCommentsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListComments = ( + params: Params< + t_IssuesListCommentsParamSchema, + t_IssuesListCommentsQuerySchema, + void, + void + >, + respond: IssuesListCommentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesCreateCommentResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesCreateComment = ( + params: Params< + t_IssuesCreateCommentParamSchema, + void, + t_IssuesCreateCommentRequestBodySchema, + void + >, + respond: IssuesCreateCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListEventsResponder = { + with200(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListEvents = ( + params: Params< + t_IssuesListEventsParamSchema, + t_IssuesListEventsQuerySchema, + void, + void + >, + respond: IssuesListEventsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListLabelsOnIssueResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListLabelsOnIssue = ( + params: Params< + t_IssuesListLabelsOnIssueParamSchema, + t_IssuesListLabelsOnIssueQuerySchema, + void, + void + >, + respond: IssuesListLabelsOnIssueResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesAddLabelsResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesAddLabels = ( + params: Params< + t_IssuesAddLabelsParamSchema, + void, + t_IssuesAddLabelsRequestBodySchema | undefined, + void + >, + respond: IssuesAddLabelsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesSetLabelsResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesSetLabels = ( + params: Params< + t_IssuesSetLabelsParamSchema, + void, + t_IssuesSetLabelsRequestBodySchema | undefined, + void + >, + respond: IssuesSetLabelsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesRemoveAllLabelsResponder = { + with204(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesRemoveAllLabels = ( + params: Params, + respond: IssuesRemoveAllLabelsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesRemoveLabelResponder = { + with200(): ExpressRuntimeResponse + with301(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesRemoveLabel = ( + params: Params, + respond: IssuesRemoveLabelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesLockResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesLock = ( + params: Params< + t_IssuesLockParamSchema, + void, + t_IssuesLockRequestBodySchema | undefined, + void + >, + respond: IssuesLockResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesUnlockResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesUnlock = ( + params: Params, + respond: IssuesUnlockResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForIssueResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForIssue = ( + params: Params< + t_ReactionsListForIssueParamSchema, + t_ReactionsListForIssueQuerySchema, + void, + void + >, + respond: ReactionsListForIssueResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForIssueResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForIssue = ( + params: Params< + t_ReactionsCreateForIssueParamSchema, + void, + t_ReactionsCreateForIssueRequestBodySchema, + void + >, + respond: ReactionsCreateForIssueResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsDeleteForIssueResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsDeleteForIssue = ( + params: Params, + respond: ReactionsDeleteForIssueResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesRemoveSubIssueResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesRemoveSubIssue = ( + params: Params< + t_IssuesRemoveSubIssueParamSchema, + void, + t_IssuesRemoveSubIssueRequestBodySchema, + void + >, + respond: IssuesRemoveSubIssueResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListSubIssuesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListSubIssues = ( + params: Params< + t_IssuesListSubIssuesParamSchema, + t_IssuesListSubIssuesQuerySchema, + void, + void + >, + respond: IssuesListSubIssuesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesAddSubIssueResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesAddSubIssue = ( + params: Params< + t_IssuesAddSubIssueParamSchema, + void, + t_IssuesAddSubIssueRequestBodySchema, + void + >, + respond: IssuesAddSubIssueResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesReprioritizeSubIssueResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type IssuesReprioritizeSubIssue = ( + params: Params< + t_IssuesReprioritizeSubIssueParamSchema, + void, + t_IssuesReprioritizeSubIssueRequestBodySchema, + void + >, + respond: IssuesReprioritizeSubIssueResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListEventsForTimelineResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListEventsForTimeline = ( + params: Params< + t_IssuesListEventsForTimelineParamSchema, + t_IssuesListEventsForTimelineQuerySchema, + void, + void + >, + respond: IssuesListEventsForTimelineResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListDeployKeysResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListDeployKeys = ( + params: Params< + t_ReposListDeployKeysParamSchema, + t_ReposListDeployKeysQuerySchema, + void, + void + >, + respond: ReposListDeployKeysResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateDeployKeyResponder = { + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateDeployKey = ( + params: Params< + t_ReposCreateDeployKeyParamSchema, + void, + t_ReposCreateDeployKeyRequestBodySchema, + void + >, + respond: ReposCreateDeployKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetDeployKeyResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetDeployKey = ( + params: Params, + respond: ReposGetDeployKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteDeployKeyResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteDeployKey = ( + params: Params, + respond: ReposDeleteDeployKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListLabelsForRepoResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListLabelsForRepo = ( + params: Params< + t_IssuesListLabelsForRepoParamSchema, + t_IssuesListLabelsForRepoQuerySchema, + void, + void + >, + respond: IssuesListLabelsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesCreateLabelResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesCreateLabel = ( + params: Params< + t_IssuesCreateLabelParamSchema, + void, + t_IssuesCreateLabelRequestBodySchema, + void + >, + respond: IssuesCreateLabelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesGetLabelResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesGetLabel = ( + params: Params, + respond: IssuesGetLabelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesUpdateLabelResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesUpdateLabel = ( + params: Params< + t_IssuesUpdateLabelParamSchema, + void, + t_IssuesUpdateLabelRequestBodySchema | undefined, + void + >, + respond: IssuesUpdateLabelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesDeleteLabelResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesDeleteLabel = ( + params: Params, + respond: IssuesDeleteLabelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListLanguagesResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListLanguages = ( + params: Params, + respond: ReposListLanguagesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type LicensesGetForRepoResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type LicensesGetForRepo = ( + params: Params< + t_LicensesGetForRepoParamSchema, + t_LicensesGetForRepoQuerySchema, + void, + void + >, + respond: LicensesGetForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposMergeUpstreamResponder = { + with200(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposMergeUpstream = ( + params: Params< + t_ReposMergeUpstreamParamSchema, + void, + t_ReposMergeUpstreamRequestBodySchema, + void + >, + respond: ReposMergeUpstreamResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposMergeResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposMerge = ( + params: Params< + t_ReposMergeParamSchema, + void, + t_ReposMergeRequestBodySchema, + void + >, + respond: ReposMergeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListMilestonesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListMilestones = ( + params: Params< + t_IssuesListMilestonesParamSchema, + t_IssuesListMilestonesQuerySchema, + void, + void + >, + respond: IssuesListMilestonesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesCreateMilestoneResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesCreateMilestone = ( + params: Params< + t_IssuesCreateMilestoneParamSchema, + void, + t_IssuesCreateMilestoneRequestBodySchema, + void + >, + respond: IssuesCreateMilestoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesGetMilestoneResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesGetMilestone = ( + params: Params, + respond: IssuesGetMilestoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesUpdateMilestoneResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesUpdateMilestone = ( + params: Params< + t_IssuesUpdateMilestoneParamSchema, + void, + t_IssuesUpdateMilestoneRequestBodySchema | undefined, + void + >, + respond: IssuesUpdateMilestoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesDeleteMilestoneResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesDeleteMilestone = ( + params: Params, + respond: IssuesDeleteMilestoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListLabelsForMilestoneResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListLabelsForMilestone = ( + params: Params< + t_IssuesListLabelsForMilestoneParamSchema, + t_IssuesListLabelsForMilestoneQuerySchema, + void, + void + >, + respond: IssuesListLabelsForMilestoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListRepoNotificationsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListRepoNotificationsForAuthenticatedUser = ( + params: Params< + t_ActivityListRepoNotificationsForAuthenticatedUserParamSchema, + t_ActivityListRepoNotificationsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: ActivityListRepoNotificationsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityMarkRepoNotificationsAsReadResponder = { + with202(): ExpressRuntimeResponse<{ + message?: string | undefined + url?: string | undefined + }> + with205(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityMarkRepoNotificationsAsRead = ( + params: Params< + t_ActivityMarkRepoNotificationsAsReadParamSchema, + void, + t_ActivityMarkRepoNotificationsAsReadRequestBodySchema | undefined, + void + >, + respond: ActivityMarkRepoNotificationsAsReadResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetPagesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetPages = ( + params: Params, + respond: ReposGetPagesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreatePagesSiteResponder = { + with201(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreatePagesSite = ( + params: Params< + t_ReposCreatePagesSiteParamSchema, + void, + t_ReposCreatePagesSiteRequestBodySchema, + void + >, + respond: ReposCreatePagesSiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateInformationAboutPagesSiteResponder = { + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateInformationAboutPagesSite = ( + params: Params< + t_ReposUpdateInformationAboutPagesSiteParamSchema, + void, + t_ReposUpdateInformationAboutPagesSiteRequestBodySchema, + void + >, + respond: ReposUpdateInformationAboutPagesSiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeletePagesSiteResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeletePagesSite = ( + params: Params, + respond: ReposDeletePagesSiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListPagesBuildsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListPagesBuilds = ( + params: Params< + t_ReposListPagesBuildsParamSchema, + t_ReposListPagesBuildsQuerySchema, + void, + void + >, + respond: ReposListPagesBuildsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposRequestPagesBuildResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposRequestPagesBuild = ( + params: Params, + respond: ReposRequestPagesBuildResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetLatestPagesBuildResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetLatestPagesBuild = ( + params: Params, + respond: ReposGetLatestPagesBuildResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetPagesBuildResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetPagesBuild = ( + params: Params, + respond: ReposGetPagesBuildResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreatePagesDeploymentResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreatePagesDeployment = ( + params: Params< + t_ReposCreatePagesDeploymentParamSchema, + void, + t_ReposCreatePagesDeploymentRequestBodySchema, + void + >, + respond: ReposCreatePagesDeploymentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetPagesDeploymentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetPagesDeployment = ( + params: Params, + respond: ReposGetPagesDeploymentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCancelPagesDeploymentResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCancelPagesDeployment = ( + params: Params, + respond: ReposCancelPagesDeploymentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetPagesHealthCheckResponder = { + with200(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetPagesHealthCheck = ( + params: Params, + respond: ReposGetPagesHealthCheckResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCheckPrivateVulnerabilityReportingResponder = { + with200(): ExpressRuntimeResponse<{ + enabled: boolean + }> + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCheckPrivateVulnerabilityReporting = ( + params: Params< + t_ReposCheckPrivateVulnerabilityReportingParamSchema, + void, + void, + void + >, + respond: ReposCheckPrivateVulnerabilityReportingResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposEnablePrivateVulnerabilityReportingResponder = { + with204(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposEnablePrivateVulnerabilityReporting = ( + params: Params< + t_ReposEnablePrivateVulnerabilityReportingParamSchema, + void, + void, + void + >, + respond: ReposEnablePrivateVulnerabilityReportingResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDisablePrivateVulnerabilityReportingResponder = { + with204(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDisablePrivateVulnerabilityReporting = ( + params: Params< + t_ReposDisablePrivateVulnerabilityReportingParamSchema, + void, + void, + void + >, + respond: ReposDisablePrivateVulnerabilityReportingResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsListForRepoResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsListForRepo = ( + params: Params< + t_ProjectsListForRepoParamSchema, + t_ProjectsListForRepoQuerySchema, + void, + void + >, + respond: ProjectsListForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsCreateForRepoResponder = { + with201(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with410(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsCreateForRepo = ( + params: Params< + t_ProjectsCreateForRepoParamSchema, + void, + t_ProjectsCreateForRepoRequestBodySchema, + void + >, + respond: ProjectsCreateForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCustomPropertiesValuesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCustomPropertiesValues = ( + params: Params, + respond: ReposGetCustomPropertiesValuesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateOrUpdateCustomPropertiesValuesResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateOrUpdateCustomPropertiesValues = ( + params: Params< + t_ReposCreateOrUpdateCustomPropertiesValuesParamSchema, + void, + t_ReposCreateOrUpdateCustomPropertiesValuesRequestBodySchema, + void + >, + respond: ReposCreateOrUpdateCustomPropertiesValuesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsListResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsList = ( + params: Params, + respond: PullsListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsCreateResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsCreate = ( + params: Params< + t_PullsCreateParamSchema, + void, + t_PullsCreateRequestBodySchema, + void + >, + respond: PullsCreateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsListReviewCommentsForRepoResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsListReviewCommentsForRepo = ( + params: Params< + t_PullsListReviewCommentsForRepoParamSchema, + t_PullsListReviewCommentsForRepoQuerySchema, + void, + void + >, + respond: PullsListReviewCommentsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsGetReviewCommentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsGetReviewComment = ( + params: Params, + respond: PullsGetReviewCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsUpdateReviewCommentResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsUpdateReviewComment = ( + params: Params< + t_PullsUpdateReviewCommentParamSchema, + void, + t_PullsUpdateReviewCommentRequestBodySchema, + void + >, + respond: PullsUpdateReviewCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsDeleteReviewCommentResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsDeleteReviewComment = ( + params: Params, + respond: PullsDeleteReviewCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForPullRequestReviewCommentResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForPullRequestReviewComment = ( + params: Params< + t_ReactionsListForPullRequestReviewCommentParamSchema, + t_ReactionsListForPullRequestReviewCommentQuerySchema, + void, + void + >, + respond: ReactionsListForPullRequestReviewCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForPullRequestReviewCommentResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForPullRequestReviewComment = ( + params: Params< + t_ReactionsCreateForPullRequestReviewCommentParamSchema, + void, + t_ReactionsCreateForPullRequestReviewCommentRequestBodySchema, + void + >, + respond: ReactionsCreateForPullRequestReviewCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsDeleteForPullRequestCommentResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsDeleteForPullRequestComment = ( + params: Params< + t_ReactionsDeleteForPullRequestCommentParamSchema, + void, + void, + void + >, + respond: ReactionsDeleteForPullRequestCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsGetResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with406(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type PullsGet = ( + params: Params, + respond: PullsGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsUpdateResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsUpdate = ( + params: Params< + t_PullsUpdateParamSchema, + void, + t_PullsUpdateRequestBodySchema | undefined, + void + >, + respond: PullsUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesCreateWithPrForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodespacesCreateWithPrForAuthenticatedUser = ( + params: Params< + t_CodespacesCreateWithPrForAuthenticatedUserParamSchema, + void, + t_CodespacesCreateWithPrForAuthenticatedUserRequestBodySchema, + void + >, + respond: CodespacesCreateWithPrForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsListReviewCommentsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsListReviewComments = ( + params: Params< + t_PullsListReviewCommentsParamSchema, + t_PullsListReviewCommentsQuerySchema, + void, + void + >, + respond: PullsListReviewCommentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsCreateReviewCommentResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsCreateReviewComment = ( + params: Params< + t_PullsCreateReviewCommentParamSchema, + void, + t_PullsCreateReviewCommentRequestBodySchema, + void + >, + respond: PullsCreateReviewCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsCreateReplyForReviewCommentResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsCreateReplyForReviewComment = ( + params: Params< + t_PullsCreateReplyForReviewCommentParamSchema, + void, + t_PullsCreateReplyForReviewCommentRequestBodySchema, + void + >, + respond: PullsCreateReplyForReviewCommentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsListCommitsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsListCommits = ( + params: Params< + t_PullsListCommitsParamSchema, + t_PullsListCommitsQuerySchema, + void, + void + >, + respond: PullsListCommitsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsListFilesResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type PullsListFiles = ( + params: Params< + t_PullsListFilesParamSchema, + t_PullsListFilesQuerySchema, + void, + void + >, + respond: PullsListFilesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsCheckIfMergedResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsCheckIfMerged = ( + params: Params, + respond: PullsCheckIfMergedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsMergeResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with405(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }> + with409(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }> + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsMerge = ( + params: Params< + t_PullsMergeParamSchema, + void, + t_PullsMergeRequestBodySchema | undefined, + void + >, + respond: PullsMergeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsListRequestedReviewersResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsListRequestedReviewers = ( + params: Params, + respond: PullsListRequestedReviewersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsRequestReviewersResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsRequestReviewers = ( + params: Params< + t_PullsRequestReviewersParamSchema, + void, + t_PullsRequestReviewersRequestBodySchema | undefined, + void + >, + respond: PullsRequestReviewersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsRemoveRequestedReviewersResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsRemoveRequestedReviewers = ( + params: Params< + t_PullsRemoveRequestedReviewersParamSchema, + void, + t_PullsRemoveRequestedReviewersRequestBodySchema, + void + >, + respond: PullsRemoveRequestedReviewersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsListReviewsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsListReviews = ( + params: Params< + t_PullsListReviewsParamSchema, + t_PullsListReviewsQuerySchema, + void, + void + >, + respond: PullsListReviewsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsCreateReviewResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsCreateReview = ( + params: Params< + t_PullsCreateReviewParamSchema, + void, + t_PullsCreateReviewRequestBodySchema | undefined, + void + >, + respond: PullsCreateReviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsGetReviewResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsGetReview = ( + params: Params, + respond: PullsGetReviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsUpdateReviewResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsUpdateReview = ( + params: Params< + t_PullsUpdateReviewParamSchema, + void, + t_PullsUpdateReviewRequestBodySchema, + void + >, + respond: PullsUpdateReviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsDeletePendingReviewResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsDeletePendingReview = ( + params: Params, + respond: PullsDeletePendingReviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsListCommentsForReviewResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsListCommentsForReview = ( + params: Params< + t_PullsListCommentsForReviewParamSchema, + t_PullsListCommentsForReviewQuerySchema, + void, + void + >, + respond: PullsListCommentsForReviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsDismissReviewResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsDismissReview = ( + params: Params< + t_PullsDismissReviewParamSchema, + void, + t_PullsDismissReviewRequestBodySchema, + void + >, + respond: PullsDismissReviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsSubmitReviewResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsSubmitReview = ( + params: Params< + t_PullsSubmitReviewParamSchema, + void, + t_PullsSubmitReviewRequestBodySchema, + void + >, + respond: PullsSubmitReviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PullsUpdateBranchResponder = { + with202(): ExpressRuntimeResponse<{ + message?: string | undefined + url?: string | undefined + }> + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PullsUpdateBranch = ( + params: Params< + t_PullsUpdateBranchParamSchema, + void, + t_PullsUpdateBranchRequestBodySchema | undefined, + void + >, + respond: PullsUpdateBranchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetReadmeResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetReadme = ( + params: Params< + t_ReposGetReadmeParamSchema, + t_ReposGetReadmeQuerySchema, + void, + void + >, + respond: ReposGetReadmeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetReadmeInDirectoryResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetReadmeInDirectory = ( + params: Params< + t_ReposGetReadmeInDirectoryParamSchema, + t_ReposGetReadmeInDirectoryQuerySchema, + void, + void + >, + respond: ReposGetReadmeInDirectoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListReleasesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListReleases = ( + params: Params< + t_ReposListReleasesParamSchema, + t_ReposListReleasesQuerySchema, + void, + void + >, + respond: ReposListReleasesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateReleaseResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateRelease = ( + params: Params< + t_ReposCreateReleaseParamSchema, + void, + t_ReposCreateReleaseRequestBodySchema, + void + >, + respond: ReposCreateReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetReleaseAssetResponder = { + with200(): ExpressRuntimeResponse + with302(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetReleaseAsset = ( + params: Params, + respond: ReposGetReleaseAssetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateReleaseAssetResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateReleaseAsset = ( + params: Params< + t_ReposUpdateReleaseAssetParamSchema, + void, + t_ReposUpdateReleaseAssetRequestBodySchema | undefined, + void + >, + respond: ReposUpdateReleaseAssetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteReleaseAssetResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteReleaseAsset = ( + params: Params, + respond: ReposDeleteReleaseAssetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGenerateReleaseNotesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGenerateReleaseNotes = ( + params: Params< + t_ReposGenerateReleaseNotesParamSchema, + void, + t_ReposGenerateReleaseNotesRequestBodySchema, + void + >, + respond: ReposGenerateReleaseNotesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetLatestReleaseResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetLatestRelease = ( + params: Params, + respond: ReposGetLatestReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetReleaseByTagResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetReleaseByTag = ( + params: Params, + respond: ReposGetReleaseByTagResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetReleaseResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetRelease = ( + params: Params, + respond: ReposGetReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateReleaseResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateRelease = ( + params: Params< + t_ReposUpdateReleaseParamSchema, + void, + t_ReposUpdateReleaseRequestBodySchema | undefined, + void + >, + respond: ReposUpdateReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteReleaseResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteRelease = ( + params: Params, + respond: ReposDeleteReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListReleaseAssetsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListReleaseAssets = ( + params: Params< + t_ReposListReleaseAssetsParamSchema, + t_ReposListReleaseAssetsQuerySchema, + void, + void + >, + respond: ReposListReleaseAssetsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUploadReleaseAssetResponder = { + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUploadReleaseAsset = ( + params: Params< + t_ReposUploadReleaseAssetParamSchema, + t_ReposUploadReleaseAssetQuerySchema, + t_ReposUploadReleaseAssetRequestBodySchema | undefined, + void + >, + respond: ReposUploadReleaseAssetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForReleaseResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForRelease = ( + params: Params< + t_ReactionsListForReleaseParamSchema, + t_ReactionsListForReleaseQuerySchema, + void, + void + >, + respond: ReactionsListForReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForReleaseResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForRelease = ( + params: Params< + t_ReactionsCreateForReleaseParamSchema, + void, + t_ReactionsCreateForReleaseRequestBodySchema, + void + >, + respond: ReactionsCreateForReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsDeleteForReleaseResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsDeleteForRelease = ( + params: Params, + respond: ReactionsDeleteForReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetBranchRulesResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetBranchRules = ( + params: Params< + t_ReposGetBranchRulesParamSchema, + t_ReposGetBranchRulesQuerySchema, + void, + void + >, + respond: ReposGetBranchRulesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetRepoRulesetsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetRepoRulesets = ( + params: Params< + t_ReposGetRepoRulesetsParamSchema, + t_ReposGetRepoRulesetsQuerySchema, + void, + void + >, + respond: ReposGetRepoRulesetsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateRepoRulesetResponder = { + with201(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateRepoRuleset = ( + params: Params< + t_ReposCreateRepoRulesetParamSchema, + void, + t_ReposCreateRepoRulesetRequestBodySchema, + void + >, + respond: ReposCreateRepoRulesetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetRepoRuleSuitesResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetRepoRuleSuites = ( + params: Params< + t_ReposGetRepoRuleSuitesParamSchema, + t_ReposGetRepoRuleSuitesQuerySchema, + void, + void + >, + respond: ReposGetRepoRuleSuitesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetRepoRuleSuiteResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetRepoRuleSuite = ( + params: Params, + respond: ReposGetRepoRuleSuiteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetRepoRulesetResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetRepoRuleset = ( + params: Params< + t_ReposGetRepoRulesetParamSchema, + t_ReposGetRepoRulesetQuerySchema, + void, + void + >, + respond: ReposGetRepoRulesetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposUpdateRepoRulesetResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposUpdateRepoRuleset = ( + params: Params< + t_ReposUpdateRepoRulesetParamSchema, + void, + t_ReposUpdateRepoRulesetRequestBodySchema | undefined, + void + >, + respond: ReposUpdateRepoRulesetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteRepoRulesetResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteRepoRuleset = ( + params: Params, + respond: ReposDeleteRepoRulesetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetRepoRulesetHistoryResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetRepoRulesetHistory = ( + params: Params< + t_ReposGetRepoRulesetHistoryParamSchema, + t_ReposGetRepoRulesetHistoryQuerySchema, + void, + void + >, + respond: ReposGetRepoRulesetHistoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetRepoRulesetVersionResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetRepoRulesetVersion = ( + params: Params, + respond: ReposGetRepoRulesetVersionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecretScanningListAlertsForRepoResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SecretScanningListAlertsForRepo = ( + params: Params< + t_SecretScanningListAlertsForRepoParamSchema, + t_SecretScanningListAlertsForRepoQuerySchema, + void, + void + >, + respond: SecretScanningListAlertsForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecretScanningGetAlertResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SecretScanningGetAlert = ( + params: Params, + respond: SecretScanningGetAlertResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecretScanningUpdateAlertResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SecretScanningUpdateAlert = ( + params: Params< + t_SecretScanningUpdateAlertParamSchema, + void, + t_SecretScanningUpdateAlertRequestBodySchema, + void + >, + respond: SecretScanningUpdateAlertResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecretScanningListLocationsForAlertResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SecretScanningListLocationsForAlert = ( + params: Params< + t_SecretScanningListLocationsForAlertParamSchema, + t_SecretScanningListLocationsForAlertQuerySchema, + void, + void + >, + respond: SecretScanningListLocationsForAlertResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecretScanningCreatePushProtectionBypassResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SecretScanningCreatePushProtectionBypass = ( + params: Params< + t_SecretScanningCreatePushProtectionBypassParamSchema, + void, + t_SecretScanningCreatePushProtectionBypassRequestBodySchema, + void + >, + respond: SecretScanningCreatePushProtectionBypassResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecretScanningGetScanHistoryResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SecretScanningGetScanHistory = ( + params: Params, + respond: SecretScanningGetScanHistoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesListRepositoryAdvisoriesResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesListRepositoryAdvisories = ( + params: Params< + t_SecurityAdvisoriesListRepositoryAdvisoriesParamSchema, + t_SecurityAdvisoriesListRepositoryAdvisoriesQuerySchema, + void, + void + >, + respond: SecurityAdvisoriesListRepositoryAdvisoriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesCreateRepositoryAdvisoryResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesCreateRepositoryAdvisory = ( + params: Params< + t_SecurityAdvisoriesCreateRepositoryAdvisoryParamSchema, + void, + t_SecurityAdvisoriesCreateRepositoryAdvisoryRequestBodySchema, + void + >, + respond: SecurityAdvisoriesCreateRepositoryAdvisoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesCreatePrivateVulnerabilityReportResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesCreatePrivateVulnerabilityReport = ( + params: Params< + t_SecurityAdvisoriesCreatePrivateVulnerabilityReportParamSchema, + void, + t_SecurityAdvisoriesCreatePrivateVulnerabilityReportRequestBodySchema, + void + >, + respond: SecurityAdvisoriesCreatePrivateVulnerabilityReportResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesGetRepositoryAdvisoryResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesGetRepositoryAdvisory = ( + params: Params< + t_SecurityAdvisoriesGetRepositoryAdvisoryParamSchema, + void, + void, + void + >, + respond: SecurityAdvisoriesGetRepositoryAdvisoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesUpdateRepositoryAdvisoryResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesUpdateRepositoryAdvisory = ( + params: Params< + t_SecurityAdvisoriesUpdateRepositoryAdvisoryParamSchema, + void, + t_SecurityAdvisoriesUpdateRepositoryAdvisoryRequestBodySchema, + void + >, + respond: SecurityAdvisoriesUpdateRepositoryAdvisoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesCreateRepositoryAdvisoryCveRequestResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesCreateRepositoryAdvisoryCveRequest = ( + params: Params< + t_SecurityAdvisoriesCreateRepositoryAdvisoryCveRequestParamSchema, + void, + void, + void + >, + respond: SecurityAdvisoriesCreateRepositoryAdvisoryCveRequestResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SecurityAdvisoriesCreateForkResponder = { + with202(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SecurityAdvisoriesCreateFork = ( + params: Params, + respond: SecurityAdvisoriesCreateForkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListStargazersForRepoResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListStargazersForRepo = ( + params: Params< + t_ActivityListStargazersForRepoParamSchema, + t_ActivityListStargazersForRepoQuerySchema, + void, + void + >, + respond: ActivityListStargazersForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCodeFrequencyStatsResponder = { + with200(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with204(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCodeFrequencyStats = ( + params: Params, + respond: ReposGetCodeFrequencyStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetCommitActivityStatsResponder = { + with200(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetCommitActivityStats = ( + params: Params, + respond: ReposGetCommitActivityStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetContributorsStatsResponder = { + with200(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetContributorsStats = ( + params: Params, + respond: ReposGetContributorsStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetParticipationStatsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetParticipationStats = ( + params: Params, + respond: ReposGetParticipationStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetPunchCardStatsResponder = { + with200(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetPunchCardStats = ( + params: Params, + respond: ReposGetPunchCardStatsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateCommitStatusResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateCommitStatus = ( + params: Params< + t_ReposCreateCommitStatusParamSchema, + void, + t_ReposCreateCommitStatusRequestBodySchema, + void + >, + respond: ReposCreateCommitStatusResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListWatchersForRepoResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListWatchersForRepo = ( + params: Params< + t_ActivityListWatchersForRepoParamSchema, + t_ActivityListWatchersForRepoQuerySchema, + void, + void + >, + respond: ActivityListWatchersForRepoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityGetRepoSubscriptionResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityGetRepoSubscription = ( + params: Params, + respond: ActivityGetRepoSubscriptionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivitySetRepoSubscriptionResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivitySetRepoSubscription = ( + params: Params< + t_ActivitySetRepoSubscriptionParamSchema, + void, + t_ActivitySetRepoSubscriptionRequestBodySchema | undefined, + void + >, + respond: ActivitySetRepoSubscriptionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityDeleteRepoSubscriptionResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityDeleteRepoSubscription = ( + params: Params, + respond: ActivityDeleteRepoSubscriptionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListTagsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListTags = ( + params: Params< + t_ReposListTagsParamSchema, + t_ReposListTagsQuerySchema, + void, + void + >, + respond: ReposListTagsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListTagProtectionResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListTagProtection = ( + params: Params, + respond: ReposListTagProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateTagProtectionResponder = { + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateTagProtection = ( + params: Params< + t_ReposCreateTagProtectionParamSchema, + void, + t_ReposCreateTagProtectionRequestBodySchema, + void + >, + respond: ReposCreateTagProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeleteTagProtectionResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeleteTagProtection = ( + params: Params, + respond: ReposDeleteTagProtectionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDownloadTarballArchiveResponder = { + with302(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDownloadTarballArchive = ( + params: Params, + respond: ReposDownloadTarballArchiveResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListTeamsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListTeams = ( + params: Params< + t_ReposListTeamsParamSchema, + t_ReposListTeamsQuerySchema, + void, + void + >, + respond: ReposListTeamsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetAllTopicsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetAllTopics = ( + params: Params< + t_ReposGetAllTopicsParamSchema, + t_ReposGetAllTopicsQuerySchema, + void, + void + >, + respond: ReposGetAllTopicsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposReplaceAllTopicsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposReplaceAllTopics = ( + params: Params< + t_ReposReplaceAllTopicsParamSchema, + void, + t_ReposReplaceAllTopicsRequestBodySchema, + void + >, + respond: ReposReplaceAllTopicsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetClonesResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetClones = ( + params: Params< + t_ReposGetClonesParamSchema, + t_ReposGetClonesQuerySchema, + void, + void + >, + respond: ReposGetClonesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetTopPathsResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetTopPaths = ( + params: Params, + respond: ReposGetTopPathsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetTopReferrersResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetTopReferrers = ( + params: Params, + respond: ReposGetTopReferrersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposGetViewsResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposGetViews = ( + params: Params< + t_ReposGetViewsParamSchema, + t_ReposGetViewsQuerySchema, + void, + void + >, + respond: ReposGetViewsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposTransferResponder = { + with202(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposTransfer = ( + params: Params< + t_ReposTransferParamSchema, + void, + t_ReposTransferRequestBodySchema, + void + >, + respond: ReposTransferResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCheckVulnerabilityAlertsResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCheckVulnerabilityAlerts = ( + params: Params, + respond: ReposCheckVulnerabilityAlertsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposEnableVulnerabilityAlertsResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposEnableVulnerabilityAlerts = ( + params: Params, + respond: ReposEnableVulnerabilityAlertsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDisableVulnerabilityAlertsResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDisableVulnerabilityAlerts = ( + params: Params< + t_ReposDisableVulnerabilityAlertsParamSchema, + void, + void, + void + >, + respond: ReposDisableVulnerabilityAlertsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDownloadZipballArchiveResponder = { + with302(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDownloadZipballArchive = ( + params: Params, + respond: ReposDownloadZipballArchiveResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateUsingTemplateResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateUsingTemplate = ( + params: Params< + t_ReposCreateUsingTemplateParamSchema, + void, + t_ReposCreateUsingTemplateRequestBodySchema, + void + >, + respond: ReposCreateUsingTemplateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListPublicResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListPublic = ( + params: Params, + respond: ReposListPublicResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SearchCodeResponder = { + with200(): ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_code_search_result_item[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SearchCode = ( + params: Params, + respond: SearchCodeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SearchCommitsResponder = { + with200(): ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_commit_search_result_item[] + total_count: number + }> + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SearchCommits = ( + params: Params, + respond: SearchCommitsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SearchIssuesAndPullRequestsResponder = { + with200(): ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_issue_search_result_item[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SearchIssuesAndPullRequests = ( + params: Params, + respond: SearchIssuesAndPullRequestsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SearchLabelsResponder = { + with200(): ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_label_search_result_item[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SearchLabels = ( + params: Params, + respond: SearchLabelsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SearchReposResponder = { + with200(): ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_repo_search_result_item[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SearchRepos = ( + params: Params, + respond: SearchReposResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SearchTopicsResponder = { + with200(): ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_topic_search_result_item[] + total_count: number + }> + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SearchTopics = ( + params: Params, + respond: SearchTopicsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SearchUsersResponder = { + with200(): ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_user_search_result_item[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type SearchUsers = ( + params: Params, + respond: SearchUsersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetLegacyResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetLegacy = ( + params: Params, + respond: TeamsGetLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsUpdateLegacyResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsUpdateLegacy = ( + params: Params< + t_TeamsUpdateLegacyParamSchema, + void, + t_TeamsUpdateLegacyRequestBodySchema, + void + >, + respond: TeamsUpdateLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsDeleteLegacyResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsDeleteLegacy = ( + params: Params, + respond: TeamsDeleteLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListDiscussionsLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListDiscussionsLegacy = ( + params: Params< + t_TeamsListDiscussionsLegacyParamSchema, + t_TeamsListDiscussionsLegacyQuerySchema, + void, + void + >, + respond: TeamsListDiscussionsLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCreateDiscussionLegacyResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCreateDiscussionLegacy = ( + params: Params< + t_TeamsCreateDiscussionLegacyParamSchema, + void, + t_TeamsCreateDiscussionLegacyRequestBodySchema, + void + >, + respond: TeamsCreateDiscussionLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetDiscussionLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetDiscussionLegacy = ( + params: Params, + respond: TeamsGetDiscussionLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsUpdateDiscussionLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsUpdateDiscussionLegacy = ( + params: Params< + t_TeamsUpdateDiscussionLegacyParamSchema, + void, + t_TeamsUpdateDiscussionLegacyRequestBodySchema | undefined, + void + >, + respond: TeamsUpdateDiscussionLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsDeleteDiscussionLegacyResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsDeleteDiscussionLegacy = ( + params: Params, + respond: TeamsDeleteDiscussionLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListDiscussionCommentsLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListDiscussionCommentsLegacy = ( + params: Params< + t_TeamsListDiscussionCommentsLegacyParamSchema, + t_TeamsListDiscussionCommentsLegacyQuerySchema, + void, + void + >, + respond: TeamsListDiscussionCommentsLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCreateDiscussionCommentLegacyResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCreateDiscussionCommentLegacy = ( + params: Params< + t_TeamsCreateDiscussionCommentLegacyParamSchema, + void, + t_TeamsCreateDiscussionCommentLegacyRequestBodySchema, + void + >, + respond: TeamsCreateDiscussionCommentLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetDiscussionCommentLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetDiscussionCommentLegacy = ( + params: Params< + t_TeamsGetDiscussionCommentLegacyParamSchema, + void, + void, + void + >, + respond: TeamsGetDiscussionCommentLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsUpdateDiscussionCommentLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsUpdateDiscussionCommentLegacy = ( + params: Params< + t_TeamsUpdateDiscussionCommentLegacyParamSchema, + void, + t_TeamsUpdateDiscussionCommentLegacyRequestBodySchema, + void + >, + respond: TeamsUpdateDiscussionCommentLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsDeleteDiscussionCommentLegacyResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsDeleteDiscussionCommentLegacy = ( + params: Params< + t_TeamsDeleteDiscussionCommentLegacyParamSchema, + void, + void, + void + >, + respond: TeamsDeleteDiscussionCommentLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForTeamDiscussionCommentLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForTeamDiscussionCommentLegacy = ( + params: Params< + t_ReactionsListForTeamDiscussionCommentLegacyParamSchema, + t_ReactionsListForTeamDiscussionCommentLegacyQuerySchema, + void, + void + >, + respond: ReactionsListForTeamDiscussionCommentLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForTeamDiscussionCommentLegacyResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForTeamDiscussionCommentLegacy = ( + params: Params< + t_ReactionsCreateForTeamDiscussionCommentLegacyParamSchema, + void, + t_ReactionsCreateForTeamDiscussionCommentLegacyRequestBodySchema, + void + >, + respond: ReactionsCreateForTeamDiscussionCommentLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsListForTeamDiscussionLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsListForTeamDiscussionLegacy = ( + params: Params< + t_ReactionsListForTeamDiscussionLegacyParamSchema, + t_ReactionsListForTeamDiscussionLegacyQuerySchema, + void, + void + >, + respond: ReactionsListForTeamDiscussionLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReactionsCreateForTeamDiscussionLegacyResponder = { + with201(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReactionsCreateForTeamDiscussionLegacy = ( + params: Params< + t_ReactionsCreateForTeamDiscussionLegacyParamSchema, + void, + t_ReactionsCreateForTeamDiscussionLegacyRequestBodySchema, + void + >, + respond: ReactionsCreateForTeamDiscussionLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListPendingInvitationsLegacyResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListPendingInvitationsLegacy = ( + params: Params< + t_TeamsListPendingInvitationsLegacyParamSchema, + t_TeamsListPendingInvitationsLegacyQuerySchema, + void, + void + >, + respond: TeamsListPendingInvitationsLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListMembersLegacyResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListMembersLegacy = ( + params: Params< + t_TeamsListMembersLegacyParamSchema, + t_TeamsListMembersLegacyQuerySchema, + void, + void + >, + respond: TeamsListMembersLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetMemberLegacyResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetMemberLegacy = ( + params: Params, + respond: TeamsGetMemberLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsAddMemberLegacyResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsAddMemberLegacy = ( + params: Params, + respond: TeamsAddMemberLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsRemoveMemberLegacyResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsRemoveMemberLegacy = ( + params: Params, + respond: TeamsRemoveMemberLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsGetMembershipForUserLegacyResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsGetMembershipForUserLegacy = ( + params: Params< + t_TeamsGetMembershipForUserLegacyParamSchema, + void, + void, + void + >, + respond: TeamsGetMembershipForUserLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsAddOrUpdateMembershipForUserLegacyResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsAddOrUpdateMembershipForUserLegacy = ( + params: Params< + t_TeamsAddOrUpdateMembershipForUserLegacyParamSchema, + void, + t_TeamsAddOrUpdateMembershipForUserLegacyRequestBodySchema | undefined, + void + >, + respond: TeamsAddOrUpdateMembershipForUserLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsRemoveMembershipForUserLegacyResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsRemoveMembershipForUserLegacy = ( + params: Params< + t_TeamsRemoveMembershipForUserLegacyParamSchema, + void, + void, + void + >, + respond: TeamsRemoveMembershipForUserLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListProjectsLegacyResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListProjectsLegacy = ( + params: Params< + t_TeamsListProjectsLegacyParamSchema, + t_TeamsListProjectsLegacyQuerySchema, + void, + void + >, + respond: TeamsListProjectsLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCheckPermissionsForProjectLegacyResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCheckPermissionsForProjectLegacy = ( + params: Params< + t_TeamsCheckPermissionsForProjectLegacyParamSchema, + void, + void, + void + >, + respond: TeamsCheckPermissionsForProjectLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsAddOrUpdateProjectPermissionsLegacyResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }> + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsAddOrUpdateProjectPermissionsLegacy = ( + params: Params< + t_TeamsAddOrUpdateProjectPermissionsLegacyParamSchema, + void, + t_TeamsAddOrUpdateProjectPermissionsLegacyRequestBodySchema | undefined, + void + >, + respond: TeamsAddOrUpdateProjectPermissionsLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsRemoveProjectLegacyResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsRemoveProjectLegacy = ( + params: Params, + respond: TeamsRemoveProjectLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListReposLegacyResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListReposLegacy = ( + params: Params< + t_TeamsListReposLegacyParamSchema, + t_TeamsListReposLegacyQuerySchema, + void, + void + >, + respond: TeamsListReposLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsCheckPermissionsForRepoLegacyResponder = { + with200(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsCheckPermissionsForRepoLegacy = ( + params: Params< + t_TeamsCheckPermissionsForRepoLegacyParamSchema, + void, + void, + void + >, + respond: TeamsCheckPermissionsForRepoLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsAddOrUpdateRepoPermissionsLegacyResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsAddOrUpdateRepoPermissionsLegacy = ( + params: Params< + t_TeamsAddOrUpdateRepoPermissionsLegacyParamSchema, + void, + t_TeamsAddOrUpdateRepoPermissionsLegacyRequestBodySchema | undefined, + void + >, + respond: TeamsAddOrUpdateRepoPermissionsLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsRemoveRepoLegacyResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsRemoveRepoLegacy = ( + params: Params, + respond: TeamsRemoveRepoLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListChildLegacyResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListChildLegacy = ( + params: Params< + t_TeamsListChildLegacyParamSchema, + t_TeamsListChildLegacyQuerySchema, + void, + void + >, + respond: TeamsListChildLegacyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersGetAuthenticatedResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersGetAuthenticated = ( + params: Params, + respond: UsersGetAuthenticatedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersUpdateAuthenticatedResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersUpdateAuthenticated = ( + params: Params< + void, + void, + t_UsersUpdateAuthenticatedRequestBodySchema | undefined, + void + >, + respond: UsersUpdateAuthenticatedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListBlockedByAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListBlockedByAuthenticatedUser = ( + params: Params< + void, + t_UsersListBlockedByAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListBlockedByAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersCheckBlockedResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersCheckBlocked = ( + params: Params, + respond: UsersCheckBlockedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersBlockResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersBlock = ( + params: Params, + respond: UsersBlockResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersUnblockResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersUnblock = ( + params: Params, + respond: UsersUnblockResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + codespaces: t_codespace[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesListForAuthenticatedUser = ( + params: Params< + void, + t_CodespacesListForAuthenticatedUserQuerySchema, + void, + void + >, + respond: CodespacesListForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesCreateForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with202(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with503(): ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }> +} & ExpressRuntimeResponder + +export type CodespacesCreateForAuthenticatedUser = ( + params: Params< + void, + void, + t_CodespacesCreateForAuthenticatedUserRequestBodySchema, + void + >, + respond: CodespacesCreateForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListSecretsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + secrets: t_codespaces_secret[] + total_count: number + }> +} & ExpressRuntimeResponder + +export type CodespacesListSecretsForAuthenticatedUser = ( + params: Params< + void, + t_CodespacesListSecretsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: CodespacesListSecretsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetPublicKeyForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetPublicKeyForAuthenticatedUser = ( + params: Params, + respond: CodespacesGetPublicKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetSecretForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetSecretForAuthenticatedUser = ( + params: Params< + t_CodespacesGetSecretForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesGetSecretForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesCreateOrUpdateSecretForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesCreateOrUpdateSecretForAuthenticatedUser = ( + params: Params< + t_CodespacesCreateOrUpdateSecretForAuthenticatedUserParamSchema, + void, + t_CodespacesCreateOrUpdateSecretForAuthenticatedUserRequestBodySchema, + void + >, + respond: CodespacesCreateOrUpdateSecretForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesDeleteSecretForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesDeleteSecretForAuthenticatedUser = ( + params: Params< + t_CodespacesDeleteSecretForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesDeleteSecretForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesListRepositoriesForSecretForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesListRepositoriesForSecretForAuthenticatedUser = ( + params: Params< + t_CodespacesListRepositoriesForSecretForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesListRepositoriesForSecretForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesSetRepositoriesForSecretForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesSetRepositoriesForSecretForAuthenticatedUser = ( + params: Params< + t_CodespacesSetRepositoriesForSecretForAuthenticatedUserParamSchema, + void, + t_CodespacesSetRepositoriesForSecretForAuthenticatedUserRequestBodySchema, + void + >, + respond: CodespacesSetRepositoriesForSecretForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesAddRepositoryForSecretForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesAddRepositoryForSecretForAuthenticatedUser = ( + params: Params< + t_CodespacesAddRepositoryForSecretForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesAddRepositoryForSecretForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesRemoveRepositoryForSecretForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesRemoveRepositoryForSecretForAuthenticatedUser = ( + params: Params< + t_CodespacesRemoveRepositoryForSecretForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesRemoveRepositoryForSecretForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetForAuthenticatedUser = ( + params: Params< + t_CodespacesGetForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesGetForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesUpdateForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesUpdateForAuthenticatedUser = ( + params: Params< + t_CodespacesUpdateForAuthenticatedUserParamSchema, + void, + t_CodespacesUpdateForAuthenticatedUserRequestBodySchema | undefined, + void + >, + respond: CodespacesUpdateForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesDeleteForAuthenticatedUserResponder = { + with202(): ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesDeleteForAuthenticatedUser = ( + params: Params< + t_CodespacesDeleteForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesDeleteForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesExportForAuthenticatedUserResponder = { + with202(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesExportForAuthenticatedUser = ( + params: Params< + t_CodespacesExportForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesExportForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesGetExportDetailsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesGetExportDetailsForAuthenticatedUser = ( + params: Params< + t_CodespacesGetExportDetailsForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesGetExportDetailsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesCodespaceMachinesForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + machines: t_codespace_machine[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesCodespaceMachinesForAuthenticatedUser = ( + params: Params< + t_CodespacesCodespaceMachinesForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesCodespaceMachinesForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesPublishForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesPublishForAuthenticatedUser = ( + params: Params< + t_CodespacesPublishForAuthenticatedUserParamSchema, + void, + t_CodespacesPublishForAuthenticatedUserRequestBodySchema, + void + >, + respond: CodespacesPublishForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesStartForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with402(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesStartForAuthenticatedUser = ( + params: Params< + t_CodespacesStartForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesStartForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CodespacesStopForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CodespacesStopForAuthenticatedUser = ( + params: Params< + t_CodespacesStopForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: CodespacesStopForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesListDockerMigrationConflictingPackagesForAuthenticatedUserResponder = + { + with200(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PackagesListDockerMigrationConflictingPackagesForAuthenticatedUser = + ( + params: Params, + respond: PackagesListDockerMigrationConflictingPackagesForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, + ) => Promise | typeof SkipResponse> + +export type UsersSetPrimaryEmailVisibilityForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersSetPrimaryEmailVisibilityForAuthenticatedUser = ( + params: Params< + void, + void, + t_UsersSetPrimaryEmailVisibilityForAuthenticatedUserRequestBodySchema, + void + >, + respond: UsersSetPrimaryEmailVisibilityForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListEmailsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListEmailsForAuthenticatedUser = ( + params: Params< + void, + t_UsersListEmailsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListEmailsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersAddEmailForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersAddEmailForAuthenticatedUser = ( + params: Params< + void, + void, + t_UsersAddEmailForAuthenticatedUserRequestBodySchema | undefined, + void + >, + respond: UsersAddEmailForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersDeleteEmailForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersDeleteEmailForAuthenticatedUser = ( + params: Params< + void, + void, + t_UsersDeleteEmailForAuthenticatedUserRequestBodySchema, + void + >, + respond: UsersDeleteEmailForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListFollowersForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListFollowersForAuthenticatedUser = ( + params: Params< + void, + t_UsersListFollowersForAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListFollowersForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListFollowedByAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListFollowedByAuthenticatedUser = ( + params: Params< + void, + t_UsersListFollowedByAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListFollowedByAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersCheckPersonIsFollowedByAuthenticatedResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersCheckPersonIsFollowedByAuthenticated = ( + params: Params< + t_UsersCheckPersonIsFollowedByAuthenticatedParamSchema, + void, + void, + void + >, + respond: UsersCheckPersonIsFollowedByAuthenticatedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersFollowResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersFollow = ( + params: Params, + respond: UsersFollowResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersUnfollowResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersUnfollow = ( + params: Params, + respond: UsersUnfollowResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListGpgKeysForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListGpgKeysForAuthenticatedUser = ( + params: Params< + void, + t_UsersListGpgKeysForAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListGpgKeysForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersCreateGpgKeyForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersCreateGpgKeyForAuthenticatedUser = ( + params: Params< + void, + void, + t_UsersCreateGpgKeyForAuthenticatedUserRequestBodySchema, + void + >, + respond: UsersCreateGpgKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersGetGpgKeyForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersGetGpgKeyForAuthenticatedUser = ( + params: Params< + t_UsersGetGpgKeyForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: UsersGetGpgKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersDeleteGpgKeyForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersDeleteGpgKeyForAuthenticatedUser = ( + params: Params< + t_UsersDeleteGpgKeyForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: UsersDeleteGpgKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListInstallationsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + installations: t_installation[] + total_count: number + }> + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListInstallationsForAuthenticatedUser = ( + params: Params< + void, + t_AppsListInstallationsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: AppsListInstallationsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListInstallationReposForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse<{ + repositories: t_repository[] + repository_selection?: string | undefined + total_count: number + }> + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListInstallationReposForAuthenticatedUser = ( + params: Params< + t_AppsListInstallationReposForAuthenticatedUserParamSchema, + t_AppsListInstallationReposForAuthenticatedUserQuerySchema, + void, + void + >, + respond: AppsListInstallationReposForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsAddRepoToInstallationForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsAddRepoToInstallationForAuthenticatedUser = ( + params: Params< + t_AppsAddRepoToInstallationForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: AppsAddRepoToInstallationForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsRemoveRepoFromInstallationForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsRemoveRepoFromInstallationForAuthenticatedUser = ( + params: Params< + t_AppsRemoveRepoFromInstallationForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: AppsRemoveRepoFromInstallationForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsGetRestrictionsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsGetRestrictionsForAuthenticatedUser = ( + params: Params, + respond: InteractionsGetRestrictionsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsSetRestrictionsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsSetRestrictionsForAuthenticatedUser = ( + params: Params< + void, + void, + t_InteractionsSetRestrictionsForAuthenticatedUserRequestBodySchema, + void + >, + respond: InteractionsSetRestrictionsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type InteractionsRemoveRestrictionsForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type InteractionsRemoveRestrictionsForAuthenticatedUser = ( + params: Params, + respond: InteractionsRemoveRestrictionsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IssuesListForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IssuesListForAuthenticatedUser = ( + params: Params, + respond: IssuesListForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListPublicSshKeysForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListPublicSshKeysForAuthenticatedUser = ( + params: Params< + void, + t_UsersListPublicSshKeysForAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListPublicSshKeysForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersCreatePublicSshKeyForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersCreatePublicSshKeyForAuthenticatedUser = ( + params: Params< + void, + void, + t_UsersCreatePublicSshKeyForAuthenticatedUserRequestBodySchema, + void + >, + respond: UsersCreatePublicSshKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersGetPublicSshKeyForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersGetPublicSshKeyForAuthenticatedUser = ( + params: Params< + t_UsersGetPublicSshKeyForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: UsersGetPublicSshKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersDeletePublicSshKeyForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersDeletePublicSshKeyForAuthenticatedUser = ( + params: Params< + t_UsersDeletePublicSshKeyForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: UsersDeletePublicSshKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListSubscriptionsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListSubscriptionsForAuthenticatedUser = ( + params: Params< + void, + t_AppsListSubscriptionsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: AppsListSubscriptionsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsListSubscriptionsForAuthenticatedUserStubbedResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsListSubscriptionsForAuthenticatedUserStubbed = ( + params: Params< + void, + t_AppsListSubscriptionsForAuthenticatedUserStubbedQuerySchema, + void, + void + >, + respond: AppsListSubscriptionsForAuthenticatedUserStubbedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListMembershipsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListMembershipsForAuthenticatedUser = ( + params: Params< + void, + t_OrgsListMembershipsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: OrgsListMembershipsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsGetMembershipForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsGetMembershipForAuthenticatedUser = ( + params: Params< + t_OrgsGetMembershipForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: OrgsGetMembershipForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsUpdateMembershipForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsUpdateMembershipForAuthenticatedUser = ( + params: Params< + t_OrgsUpdateMembershipForAuthenticatedUserParamSchema, + void, + t_OrgsUpdateMembershipForAuthenticatedUserRequestBodySchema, + void + >, + respond: OrgsUpdateMembershipForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsListForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsListForAuthenticatedUser = ( + params: Params< + void, + t_MigrationsListForAuthenticatedUserQuerySchema, + void, + void + >, + respond: MigrationsListForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsStartForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsStartForAuthenticatedUser = ( + params: Params< + void, + void, + t_MigrationsStartForAuthenticatedUserRequestBodySchema, + void + >, + respond: MigrationsStartForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsGetStatusForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsGetStatusForAuthenticatedUser = ( + params: Params< + t_MigrationsGetStatusForAuthenticatedUserParamSchema, + t_MigrationsGetStatusForAuthenticatedUserQuerySchema, + void, + void + >, + respond: MigrationsGetStatusForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsGetArchiveForAuthenticatedUserResponder = { + with302(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsGetArchiveForAuthenticatedUser = ( + params: Params< + t_MigrationsGetArchiveForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: MigrationsGetArchiveForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsDeleteArchiveForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsDeleteArchiveForAuthenticatedUser = ( + params: Params< + t_MigrationsDeleteArchiveForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: MigrationsDeleteArchiveForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsUnlockRepoForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsUnlockRepoForAuthenticatedUser = ( + params: Params< + t_MigrationsUnlockRepoForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: MigrationsUnlockRepoForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MigrationsListReposForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MigrationsListReposForAuthenticatedUser = ( + params: Params< + t_MigrationsListReposForAuthenticatedUserParamSchema, + t_MigrationsListReposForAuthenticatedUserQuerySchema, + void, + void + >, + respond: MigrationsListReposForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListForAuthenticatedUser = ( + params: Params, + respond: OrgsListForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesListPackagesForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesListPackagesForAuthenticatedUser = ( + params: Params< + void, + t_PackagesListPackagesForAuthenticatedUserQuerySchema, + void, + void + >, + respond: PackagesListPackagesForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetPackageForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesGetPackageForAuthenticatedUser = ( + params: Params< + t_PackagesGetPackageForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: PackagesGetPackageForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesDeletePackageForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesDeletePackageForAuthenticatedUser = ( + params: Params< + t_PackagesDeletePackageForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: PackagesDeletePackageForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesRestorePackageForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesRestorePackageForAuthenticatedUser = ( + params: Params< + t_PackagesRestorePackageForAuthenticatedUserParamSchema, + t_PackagesRestorePackageForAuthenticatedUserQuerySchema, + void, + void + >, + respond: PackagesRestorePackageForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserResponder = + { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUser = ( + params: Params< + t_PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserParamSchema, + t_PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserQuerySchema, + void, + void + >, + respond: PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetPackageVersionForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesGetPackageVersionForAuthenticatedUser = ( + params: Params< + t_PackagesGetPackageVersionForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: PackagesGetPackageVersionForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesDeletePackageVersionForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesDeletePackageVersionForAuthenticatedUser = ( + params: Params< + t_PackagesDeletePackageVersionForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: PackagesDeletePackageVersionForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesRestorePackageVersionForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesRestorePackageVersionForAuthenticatedUser = ( + params: Params< + t_PackagesRestorePackageVersionForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: PackagesRestorePackageVersionForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsCreateForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsCreateForAuthenticatedUser = ( + params: Params< + void, + void, + t_ProjectsCreateForAuthenticatedUserRequestBodySchema, + void + >, + respond: ProjectsCreateForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListPublicEmailsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListPublicEmailsForAuthenticatedUser = ( + params: Params< + void, + t_UsersListPublicEmailsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListPublicEmailsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListForAuthenticatedUser = ( + params: Params, + respond: ReposListForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposCreateForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposCreateForAuthenticatedUser = ( + params: Params< + void, + void, + t_ReposCreateForAuthenticatedUserRequestBodySchema, + void + >, + respond: ReposCreateForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListInvitationsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListInvitationsForAuthenticatedUser = ( + params: Params< + void, + t_ReposListInvitationsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: ReposListInvitationsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposAcceptInvitationForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposAcceptInvitationForAuthenticatedUser = ( + params: Params< + t_ReposAcceptInvitationForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: ReposAcceptInvitationForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposDeclineInvitationForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposDeclineInvitationForAuthenticatedUser = ( + params: Params< + t_ReposDeclineInvitationForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: ReposDeclineInvitationForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListSocialAccountsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListSocialAccountsForAuthenticatedUser = ( + params: Params< + void, + t_UsersListSocialAccountsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListSocialAccountsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersAddSocialAccountForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersAddSocialAccountForAuthenticatedUser = ( + params: Params< + void, + void, + t_UsersAddSocialAccountForAuthenticatedUserRequestBodySchema, + void + >, + respond: UsersAddSocialAccountForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersDeleteSocialAccountForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersDeleteSocialAccountForAuthenticatedUser = ( + params: Params< + void, + void, + t_UsersDeleteSocialAccountForAuthenticatedUserRequestBodySchema, + void + >, + respond: UsersDeleteSocialAccountForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListSshSigningKeysForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListSshSigningKeysForAuthenticatedUser = ( + params: Params< + void, + t_UsersListSshSigningKeysForAuthenticatedUserQuerySchema, + void, + void + >, + respond: UsersListSshSigningKeysForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersCreateSshSigningKeyForAuthenticatedUserResponder = { + with201(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersCreateSshSigningKeyForAuthenticatedUser = ( + params: Params< + void, + void, + t_UsersCreateSshSigningKeyForAuthenticatedUserRequestBodySchema, + void + >, + respond: UsersCreateSshSigningKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersGetSshSigningKeyForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersGetSshSigningKeyForAuthenticatedUser = ( + params: Params< + t_UsersGetSshSigningKeyForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: UsersGetSshSigningKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersDeleteSshSigningKeyForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersDeleteSshSigningKeyForAuthenticatedUser = ( + params: Params< + t_UsersDeleteSshSigningKeyForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: UsersDeleteSshSigningKeyForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListReposStarredByAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListReposStarredByAuthenticatedUser = ( + params: Params< + void, + t_ActivityListReposStarredByAuthenticatedUserQuerySchema, + void, + void + >, + respond: ActivityListReposStarredByAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityCheckRepoIsStarredByAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityCheckRepoIsStarredByAuthenticatedUser = ( + params: Params< + t_ActivityCheckRepoIsStarredByAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: ActivityCheckRepoIsStarredByAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityStarRepoForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityStarRepoForAuthenticatedUser = ( + params: Params< + t_ActivityStarRepoForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: ActivityStarRepoForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityUnstarRepoForAuthenticatedUserResponder = { + with204(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityUnstarRepoForAuthenticatedUser = ( + params: Params< + t_ActivityUnstarRepoForAuthenticatedUserParamSchema, + void, + void, + void + >, + respond: ActivityUnstarRepoForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListWatchedReposForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListWatchedReposForAuthenticatedUser = ( + params: Params< + void, + t_ActivityListWatchedReposForAuthenticatedUserQuerySchema, + void, + void + >, + respond: ActivityListWatchedReposForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TeamsListForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TeamsListForAuthenticatedUser = ( + params: Params, + respond: TeamsListForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersGetByIdResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersGetById = ( + params: Params, + respond: UsersGetByIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListResponder = { + with200(): ExpressRuntimeResponse + with304(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersList = ( + params: Params, + respond: UsersListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersGetByUsernameResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersGetByUsername = ( + params: Params, + respond: UsersGetByUsernameResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListAttestationsResponder = { + with200(): ExpressRuntimeResponse<{ + attestations?: + | { + bundle?: + | { + dsseEnvelope?: + | { + [key: string]: unknown | undefined + } + | undefined + mediaType?: string | undefined + verificationMaterial?: + | { + [key: string]: unknown | undefined + } + | undefined + } + | undefined + bundle_url?: string | undefined + repository_id?: number | undefined + }[] + | undefined + }> + with201(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListAttestations = ( + params: Params< + t_UsersListAttestationsParamSchema, + t_UsersListAttestationsQuerySchema, + void, + void + >, + respond: UsersListAttestationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesListDockerMigrationConflictingPackagesForUserResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesListDockerMigrationConflictingPackagesForUser = ( + params: Params< + t_PackagesListDockerMigrationConflictingPackagesForUserParamSchema, + void, + void, + void + >, + respond: PackagesListDockerMigrationConflictingPackagesForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListEventsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListEventsForAuthenticatedUser = ( + params: Params< + t_ActivityListEventsForAuthenticatedUserParamSchema, + t_ActivityListEventsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: ActivityListEventsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListOrgEventsForAuthenticatedUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListOrgEventsForAuthenticatedUser = ( + params: Params< + t_ActivityListOrgEventsForAuthenticatedUserParamSchema, + t_ActivityListOrgEventsForAuthenticatedUserQuerySchema, + void, + void + >, + respond: ActivityListOrgEventsForAuthenticatedUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListPublicEventsForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListPublicEventsForUser = ( + params: Params< + t_ActivityListPublicEventsForUserParamSchema, + t_ActivityListPublicEventsForUserQuerySchema, + void, + void + >, + respond: ActivityListPublicEventsForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListFollowersForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListFollowersForUser = ( + params: Params< + t_UsersListFollowersForUserParamSchema, + t_UsersListFollowersForUserQuerySchema, + void, + void + >, + respond: UsersListFollowersForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListFollowingForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListFollowingForUser = ( + params: Params< + t_UsersListFollowingForUserParamSchema, + t_UsersListFollowingForUserQuerySchema, + void, + void + >, + respond: UsersListFollowingForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersCheckFollowingForUserResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersCheckFollowingForUser = ( + params: Params, + respond: UsersCheckFollowingForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GistsListForUserResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GistsListForUser = ( + params: Params< + t_GistsListForUserParamSchema, + t_GistsListForUserQuerySchema, + void, + void + >, + respond: GistsListForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListGpgKeysForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListGpgKeysForUser = ( + params: Params< + t_UsersListGpgKeysForUserParamSchema, + t_UsersListGpgKeysForUserQuerySchema, + void, + void + >, + respond: UsersListGpgKeysForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersGetContextForUserResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersGetContextForUser = ( + params: Params< + t_UsersGetContextForUserParamSchema, + t_UsersGetContextForUserQuerySchema, + void, + void + >, + respond: UsersGetContextForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AppsGetUserInstallationResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AppsGetUserInstallation = ( + params: Params, + respond: AppsGetUserInstallationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListPublicKeysForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListPublicKeysForUser = ( + params: Params< + t_UsersListPublicKeysForUserParamSchema, + t_UsersListPublicKeysForUserQuerySchema, + void, + void + >, + respond: UsersListPublicKeysForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OrgsListForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OrgsListForUser = ( + params: Params< + t_OrgsListForUserParamSchema, + t_OrgsListForUserQuerySchema, + void, + void + >, + respond: OrgsListForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesListPackagesForUserResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesListPackagesForUser = ( + params: Params< + t_PackagesListPackagesForUserParamSchema, + t_PackagesListPackagesForUserQuerySchema, + void, + void + >, + respond: PackagesListPackagesForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetPackageForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesGetPackageForUser = ( + params: Params, + respond: PackagesGetPackageForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesDeletePackageForUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesDeletePackageForUser = ( + params: Params, + respond: PackagesDeletePackageForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesRestorePackageForUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesRestorePackageForUser = ( + params: Params< + t_PackagesRestorePackageForUserParamSchema, + t_PackagesRestorePackageForUserQuerySchema, + void, + void + >, + respond: PackagesRestorePackageForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetAllPackageVersionsForPackageOwnedByUserResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesGetAllPackageVersionsForPackageOwnedByUser = ( + params: Params< + t_PackagesGetAllPackageVersionsForPackageOwnedByUserParamSchema, + void, + void, + void + >, + respond: PackagesGetAllPackageVersionsForPackageOwnedByUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesGetPackageVersionForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesGetPackageVersionForUser = ( + params: Params< + t_PackagesGetPackageVersionForUserParamSchema, + void, + void, + void + >, + respond: PackagesGetPackageVersionForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesDeletePackageVersionForUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesDeletePackageVersionForUser = ( + params: Params< + t_PackagesDeletePackageVersionForUserParamSchema, + void, + void, + void + >, + respond: PackagesDeletePackageVersionForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PackagesRestorePackageVersionForUserResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PackagesRestorePackageVersionForUser = ( + params: Params< + t_PackagesRestorePackageVersionForUserParamSchema, + void, + void, + void + >, + respond: PackagesRestorePackageVersionForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ProjectsListForUserResponder = { + with200(): ExpressRuntimeResponse + with422(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ProjectsListForUser = ( + params: Params< + t_ProjectsListForUserParamSchema, + t_ProjectsListForUserQuerySchema, + void, + void + >, + respond: ProjectsListForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListReceivedEventsForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListReceivedEventsForUser = ( + params: Params< + t_ActivityListReceivedEventsForUserParamSchema, + t_ActivityListReceivedEventsForUserQuerySchema, + void, + void + >, + respond: ActivityListReceivedEventsForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListReceivedPublicEventsForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListReceivedPublicEventsForUser = ( + params: Params< + t_ActivityListReceivedPublicEventsForUserParamSchema, + t_ActivityListReceivedPublicEventsForUserQuerySchema, + void, + void + >, + respond: ActivityListReceivedPublicEventsForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReposListForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReposListForUser = ( + params: Params< + t_ReposListForUserParamSchema, + t_ReposListForUserQuerySchema, + void, + void + >, + respond: ReposListForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BillingGetGithubActionsBillingUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type BillingGetGithubActionsBillingUser = ( + params: Params< + t_BillingGetGithubActionsBillingUserParamSchema, + void, + void, + void + >, + respond: BillingGetGithubActionsBillingUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BillingGetGithubPackagesBillingUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type BillingGetGithubPackagesBillingUser = ( + params: Params< + t_BillingGetGithubPackagesBillingUserParamSchema, + void, + void, + void + >, + respond: BillingGetGithubPackagesBillingUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BillingGetSharedStorageBillingUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type BillingGetSharedStorageBillingUser = ( + params: Params< + t_BillingGetSharedStorageBillingUserParamSchema, + void, + void, + void + >, + respond: BillingGetSharedStorageBillingUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListSocialAccountsForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListSocialAccountsForUser = ( + params: Params< + t_UsersListSocialAccountsForUserParamSchema, + t_UsersListSocialAccountsForUserQuerySchema, + void, + void + >, + respond: UsersListSocialAccountsForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UsersListSshSigningKeysForUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UsersListSshSigningKeysForUser = ( + params: Params< + t_UsersListSshSigningKeysForUserParamSchema, + t_UsersListSshSigningKeysForUserQuerySchema, + void, + void + >, + respond: UsersListSshSigningKeysForUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListReposStarredByUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListReposStarredByUser = ( + params: Params< + t_ActivityListReposStarredByUserParamSchema, + t_ActivityListReposStarredByUserQuerySchema, + void, + void + >, + respond: ActivityListReposStarredByUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ActivityListReposWatchedByUserResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ActivityListReposWatchedByUser = ( + params: Params< + t_ActivityListReposWatchedByUserParamSchema, + t_ActivityListReposWatchedByUserQuerySchema, + void, + void + >, + respond: ActivityListReposWatchedByUserResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MetaGetAllVersionsResponder = { + with200(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MetaGetAllVersions = ( + params: Params, + respond: MetaGetAllVersionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type MetaGetZenResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type MetaGetZen = ( + params: Params, + respond: MetaGetZenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type Implementation = { + metaRoot: MetaRoot + securityAdvisoriesListGlobalAdvisories: SecurityAdvisoriesListGlobalAdvisories + securityAdvisoriesGetGlobalAdvisory: SecurityAdvisoriesGetGlobalAdvisory + appsGetAuthenticated: AppsGetAuthenticated + appsCreateFromManifest: AppsCreateFromManifest + appsGetWebhookConfigForApp: AppsGetWebhookConfigForApp + appsUpdateWebhookConfigForApp: AppsUpdateWebhookConfigForApp + appsListWebhookDeliveries: AppsListWebhookDeliveries + appsGetWebhookDelivery: AppsGetWebhookDelivery + appsRedeliverWebhookDelivery: AppsRedeliverWebhookDelivery + appsListInstallationRequestsForAuthenticatedApp: AppsListInstallationRequestsForAuthenticatedApp + appsListInstallations: AppsListInstallations + appsGetInstallation: AppsGetInstallation + appsDeleteInstallation: AppsDeleteInstallation + appsCreateInstallationAccessToken: AppsCreateInstallationAccessToken + appsSuspendInstallation: AppsSuspendInstallation + appsUnsuspendInstallation: AppsUnsuspendInstallation + appsDeleteAuthorization: AppsDeleteAuthorization + appsCheckToken: AppsCheckToken + appsResetToken: AppsResetToken + appsDeleteToken: AppsDeleteToken + appsScopeToken: AppsScopeToken + appsGetBySlug: AppsGetBySlug + classroomGetAnAssignment: ClassroomGetAnAssignment + classroomListAcceptedAssignmentsForAnAssignment: ClassroomListAcceptedAssignmentsForAnAssignment + classroomGetAssignmentGrades: ClassroomGetAssignmentGrades + classroomListClassrooms: ClassroomListClassrooms + classroomGetAClassroom: ClassroomGetAClassroom + classroomListAssignmentsForAClassroom: ClassroomListAssignmentsForAClassroom + codesOfConductGetAllCodesOfConduct: CodesOfConductGetAllCodesOfConduct + codesOfConductGetConductCode: CodesOfConductGetConductCode + emojisGet: EmojisGet + codeSecurityGetConfigurationsForEnterprise: CodeSecurityGetConfigurationsForEnterprise + codeSecurityCreateConfigurationForEnterprise: CodeSecurityCreateConfigurationForEnterprise + codeSecurityGetDefaultConfigurationsForEnterprise: CodeSecurityGetDefaultConfigurationsForEnterprise + codeSecurityGetSingleConfigurationForEnterprise: CodeSecurityGetSingleConfigurationForEnterprise + codeSecurityUpdateEnterpriseConfiguration: CodeSecurityUpdateEnterpriseConfiguration + codeSecurityDeleteConfigurationForEnterprise: CodeSecurityDeleteConfigurationForEnterprise + codeSecurityAttachEnterpriseConfiguration: CodeSecurityAttachEnterpriseConfiguration + codeSecuritySetConfigurationAsDefaultForEnterprise: CodeSecuritySetConfigurationAsDefaultForEnterprise + codeSecurityGetRepositoriesForEnterpriseConfiguration: CodeSecurityGetRepositoriesForEnterpriseConfiguration + dependabotListAlertsForEnterprise: DependabotListAlertsForEnterprise + secretScanningListAlertsForEnterprise: SecretScanningListAlertsForEnterprise + activityListPublicEvents: ActivityListPublicEvents + activityGetFeeds: ActivityGetFeeds + gistsList: GistsList + gistsCreate: GistsCreate + gistsListPublic: GistsListPublic + gistsListStarred: GistsListStarred + gistsGet: GistsGet + gistsUpdate: GistsUpdate + gistsDelete: GistsDelete + gistsListComments: GistsListComments + gistsCreateComment: GistsCreateComment + gistsGetComment: GistsGetComment + gistsUpdateComment: GistsUpdateComment + gistsDeleteComment: GistsDeleteComment + gistsListCommits: GistsListCommits + gistsListForks: GistsListForks + gistsFork: GistsFork + gistsCheckIsStarred: GistsCheckIsStarred + gistsStar: GistsStar + gistsUnstar: GistsUnstar + gistsGetRevision: GistsGetRevision + gitignoreGetAllTemplates: GitignoreGetAllTemplates + gitignoreGetTemplate: GitignoreGetTemplate + appsListReposAccessibleToInstallation: AppsListReposAccessibleToInstallation + appsRevokeInstallationAccessToken: AppsRevokeInstallationAccessToken + issuesList: IssuesList + licensesGetAllCommonlyUsed: LicensesGetAllCommonlyUsed + licensesGet: LicensesGet + markdownRender: MarkdownRender + markdownRenderRaw: MarkdownRenderRaw + appsGetSubscriptionPlanForAccount: AppsGetSubscriptionPlanForAccount + appsListPlans: AppsListPlans + appsListAccountsForPlan: AppsListAccountsForPlan + appsGetSubscriptionPlanForAccountStubbed: AppsGetSubscriptionPlanForAccountStubbed + appsListPlansStubbed: AppsListPlansStubbed + appsListAccountsForPlanStubbed: AppsListAccountsForPlanStubbed + metaGet: MetaGet + activityListPublicEventsForRepoNetwork: ActivityListPublicEventsForRepoNetwork + activityListNotificationsForAuthenticatedUser: ActivityListNotificationsForAuthenticatedUser + activityMarkNotificationsAsRead: ActivityMarkNotificationsAsRead + activityGetThread: ActivityGetThread + activityMarkThreadAsRead: ActivityMarkThreadAsRead + activityMarkThreadAsDone: ActivityMarkThreadAsDone + activityGetThreadSubscriptionForAuthenticatedUser: ActivityGetThreadSubscriptionForAuthenticatedUser + activitySetThreadSubscription: ActivitySetThreadSubscription + activityDeleteThreadSubscription: ActivityDeleteThreadSubscription + metaGetOctocat: MetaGetOctocat + orgsList: OrgsList + billingGetGithubBillingUsageReportOrg: BillingGetGithubBillingUsageReportOrg + orgsGet: OrgsGet + orgsUpdate: OrgsUpdate + orgsDelete: OrgsDelete + actionsGetActionsCacheUsageForOrg: ActionsGetActionsCacheUsageForOrg + actionsGetActionsCacheUsageByRepoForOrg: ActionsGetActionsCacheUsageByRepoForOrg + actionsListHostedRunnersForOrg: ActionsListHostedRunnersForOrg + actionsCreateHostedRunnerForOrg: ActionsCreateHostedRunnerForOrg + actionsGetHostedRunnersGithubOwnedImagesForOrg: ActionsGetHostedRunnersGithubOwnedImagesForOrg + actionsGetHostedRunnersPartnerImagesForOrg: ActionsGetHostedRunnersPartnerImagesForOrg + actionsGetHostedRunnersLimitsForOrg: ActionsGetHostedRunnersLimitsForOrg + actionsGetHostedRunnersMachineSpecsForOrg: ActionsGetHostedRunnersMachineSpecsForOrg + actionsGetHostedRunnersPlatformsForOrg: ActionsGetHostedRunnersPlatformsForOrg + actionsGetHostedRunnerForOrg: ActionsGetHostedRunnerForOrg + actionsUpdateHostedRunnerForOrg: ActionsUpdateHostedRunnerForOrg + actionsDeleteHostedRunnerForOrg: ActionsDeleteHostedRunnerForOrg + oidcGetOidcCustomSubTemplateForOrg: OidcGetOidcCustomSubTemplateForOrg + oidcUpdateOidcCustomSubTemplateForOrg: OidcUpdateOidcCustomSubTemplateForOrg + actionsGetGithubActionsPermissionsOrganization: ActionsGetGithubActionsPermissionsOrganization + actionsSetGithubActionsPermissionsOrganization: ActionsSetGithubActionsPermissionsOrganization + actionsListSelectedRepositoriesEnabledGithubActionsOrganization: ActionsListSelectedRepositoriesEnabledGithubActionsOrganization + actionsSetSelectedRepositoriesEnabledGithubActionsOrganization: ActionsSetSelectedRepositoriesEnabledGithubActionsOrganization + actionsEnableSelectedRepositoryGithubActionsOrganization: ActionsEnableSelectedRepositoryGithubActionsOrganization + actionsDisableSelectedRepositoryGithubActionsOrganization: ActionsDisableSelectedRepositoryGithubActionsOrganization + actionsGetAllowedActionsOrganization: ActionsGetAllowedActionsOrganization + actionsSetAllowedActionsOrganization: ActionsSetAllowedActionsOrganization + actionsGetGithubActionsDefaultWorkflowPermissionsOrganization: ActionsGetGithubActionsDefaultWorkflowPermissionsOrganization + actionsSetGithubActionsDefaultWorkflowPermissionsOrganization: ActionsSetGithubActionsDefaultWorkflowPermissionsOrganization + actionsListSelfHostedRunnerGroupsForOrg: ActionsListSelfHostedRunnerGroupsForOrg + actionsCreateSelfHostedRunnerGroupForOrg: ActionsCreateSelfHostedRunnerGroupForOrg + actionsGetSelfHostedRunnerGroupForOrg: ActionsGetSelfHostedRunnerGroupForOrg + actionsUpdateSelfHostedRunnerGroupForOrg: ActionsUpdateSelfHostedRunnerGroupForOrg + actionsDeleteSelfHostedRunnerGroupFromOrg: ActionsDeleteSelfHostedRunnerGroupFromOrg + actionsListGithubHostedRunnersInGroupForOrg: ActionsListGithubHostedRunnersInGroupForOrg + actionsListRepoAccessToSelfHostedRunnerGroupInOrg: ActionsListRepoAccessToSelfHostedRunnerGroupInOrg + actionsSetRepoAccessToSelfHostedRunnerGroupInOrg: ActionsSetRepoAccessToSelfHostedRunnerGroupInOrg + actionsAddRepoAccessToSelfHostedRunnerGroupInOrg: ActionsAddRepoAccessToSelfHostedRunnerGroupInOrg + actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg: ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg + actionsListSelfHostedRunnersInGroupForOrg: ActionsListSelfHostedRunnersInGroupForOrg + actionsSetSelfHostedRunnersInGroupForOrg: ActionsSetSelfHostedRunnersInGroupForOrg + actionsAddSelfHostedRunnerToGroupForOrg: ActionsAddSelfHostedRunnerToGroupForOrg + actionsRemoveSelfHostedRunnerFromGroupForOrg: ActionsRemoveSelfHostedRunnerFromGroupForOrg + actionsListSelfHostedRunnersForOrg: ActionsListSelfHostedRunnersForOrg + actionsListRunnerApplicationsForOrg: ActionsListRunnerApplicationsForOrg + actionsGenerateRunnerJitconfigForOrg: ActionsGenerateRunnerJitconfigForOrg + actionsCreateRegistrationTokenForOrg: ActionsCreateRegistrationTokenForOrg + actionsCreateRemoveTokenForOrg: ActionsCreateRemoveTokenForOrg + actionsGetSelfHostedRunnerForOrg: ActionsGetSelfHostedRunnerForOrg + actionsDeleteSelfHostedRunnerFromOrg: ActionsDeleteSelfHostedRunnerFromOrg + actionsListLabelsForSelfHostedRunnerForOrg: ActionsListLabelsForSelfHostedRunnerForOrg + actionsAddCustomLabelsToSelfHostedRunnerForOrg: ActionsAddCustomLabelsToSelfHostedRunnerForOrg + actionsSetCustomLabelsForSelfHostedRunnerForOrg: ActionsSetCustomLabelsForSelfHostedRunnerForOrg + actionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrg: ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrg + actionsRemoveCustomLabelFromSelfHostedRunnerForOrg: ActionsRemoveCustomLabelFromSelfHostedRunnerForOrg + actionsListOrgSecrets: ActionsListOrgSecrets + actionsGetOrgPublicKey: ActionsGetOrgPublicKey + actionsGetOrgSecret: ActionsGetOrgSecret + actionsCreateOrUpdateOrgSecret: ActionsCreateOrUpdateOrgSecret + actionsDeleteOrgSecret: ActionsDeleteOrgSecret + actionsListSelectedReposForOrgSecret: ActionsListSelectedReposForOrgSecret + actionsSetSelectedReposForOrgSecret: ActionsSetSelectedReposForOrgSecret + actionsAddSelectedRepoToOrgSecret: ActionsAddSelectedRepoToOrgSecret + actionsRemoveSelectedRepoFromOrgSecret: ActionsRemoveSelectedRepoFromOrgSecret + actionsListOrgVariables: ActionsListOrgVariables + actionsCreateOrgVariable: ActionsCreateOrgVariable + actionsGetOrgVariable: ActionsGetOrgVariable + actionsUpdateOrgVariable: ActionsUpdateOrgVariable + actionsDeleteOrgVariable: ActionsDeleteOrgVariable + actionsListSelectedReposForOrgVariable: ActionsListSelectedReposForOrgVariable + actionsSetSelectedReposForOrgVariable: ActionsSetSelectedReposForOrgVariable + actionsAddSelectedRepoToOrgVariable: ActionsAddSelectedRepoToOrgVariable + actionsRemoveSelectedRepoFromOrgVariable: ActionsRemoveSelectedRepoFromOrgVariable + orgsListAttestations: OrgsListAttestations + orgsListBlockedUsers: OrgsListBlockedUsers + orgsCheckBlockedUser: OrgsCheckBlockedUser + orgsBlockUser: OrgsBlockUser + orgsUnblockUser: OrgsUnblockUser + campaignsListOrgCampaigns: CampaignsListOrgCampaigns + campaignsCreateCampaign: CampaignsCreateCampaign + campaignsGetCampaignSummary: CampaignsGetCampaignSummary + campaignsUpdateCampaign: CampaignsUpdateCampaign + campaignsDeleteCampaign: CampaignsDeleteCampaign + codeScanningListAlertsForOrg: CodeScanningListAlertsForOrg + codeSecurityGetConfigurationsForOrg: CodeSecurityGetConfigurationsForOrg + codeSecurityCreateConfiguration: CodeSecurityCreateConfiguration + codeSecurityGetDefaultConfigurations: CodeSecurityGetDefaultConfigurations + codeSecurityDetachConfiguration: CodeSecurityDetachConfiguration + codeSecurityGetConfiguration: CodeSecurityGetConfiguration + codeSecurityUpdateConfiguration: CodeSecurityUpdateConfiguration + codeSecurityDeleteConfiguration: CodeSecurityDeleteConfiguration + codeSecurityAttachConfiguration: CodeSecurityAttachConfiguration + codeSecuritySetConfigurationAsDefault: CodeSecuritySetConfigurationAsDefault + codeSecurityGetRepositoriesForConfiguration: CodeSecurityGetRepositoriesForConfiguration + codespacesListInOrganization: CodespacesListInOrganization + codespacesSetCodespacesAccess: CodespacesSetCodespacesAccess + codespacesSetCodespacesAccessUsers: CodespacesSetCodespacesAccessUsers + codespacesDeleteCodespacesAccessUsers: CodespacesDeleteCodespacesAccessUsers + codespacesListOrgSecrets: CodespacesListOrgSecrets + codespacesGetOrgPublicKey: CodespacesGetOrgPublicKey + codespacesGetOrgSecret: CodespacesGetOrgSecret + codespacesCreateOrUpdateOrgSecret: CodespacesCreateOrUpdateOrgSecret + codespacesDeleteOrgSecret: CodespacesDeleteOrgSecret + codespacesListSelectedReposForOrgSecret: CodespacesListSelectedReposForOrgSecret + codespacesSetSelectedReposForOrgSecret: CodespacesSetSelectedReposForOrgSecret + codespacesAddSelectedRepoToOrgSecret: CodespacesAddSelectedRepoToOrgSecret + codespacesRemoveSelectedRepoFromOrgSecret: CodespacesRemoveSelectedRepoFromOrgSecret + copilotGetCopilotOrganizationDetails: CopilotGetCopilotOrganizationDetails + copilotListCopilotSeats: CopilotListCopilotSeats + copilotAddCopilotSeatsForTeams: CopilotAddCopilotSeatsForTeams + copilotCancelCopilotSeatAssignmentForTeams: CopilotCancelCopilotSeatAssignmentForTeams + copilotAddCopilotSeatsForUsers: CopilotAddCopilotSeatsForUsers + copilotCancelCopilotSeatAssignmentForUsers: CopilotCancelCopilotSeatAssignmentForUsers + copilotCopilotMetricsForOrganization: CopilotCopilotMetricsForOrganization + dependabotListAlertsForOrg: DependabotListAlertsForOrg + dependabotListOrgSecrets: DependabotListOrgSecrets + dependabotGetOrgPublicKey: DependabotGetOrgPublicKey + dependabotGetOrgSecret: DependabotGetOrgSecret + dependabotCreateOrUpdateOrgSecret: DependabotCreateOrUpdateOrgSecret + dependabotDeleteOrgSecret: DependabotDeleteOrgSecret + dependabotListSelectedReposForOrgSecret: DependabotListSelectedReposForOrgSecret + dependabotSetSelectedReposForOrgSecret: DependabotSetSelectedReposForOrgSecret + dependabotAddSelectedRepoToOrgSecret: DependabotAddSelectedRepoToOrgSecret + dependabotRemoveSelectedRepoFromOrgSecret: DependabotRemoveSelectedRepoFromOrgSecret + packagesListDockerMigrationConflictingPackagesForOrganization: PackagesListDockerMigrationConflictingPackagesForOrganization + activityListPublicOrgEvents: ActivityListPublicOrgEvents + orgsListFailedInvitations: OrgsListFailedInvitations + orgsListWebhooks: OrgsListWebhooks + orgsCreateWebhook: OrgsCreateWebhook + orgsGetWebhook: OrgsGetWebhook + orgsUpdateWebhook: OrgsUpdateWebhook + orgsDeleteWebhook: OrgsDeleteWebhook + orgsGetWebhookConfigForOrg: OrgsGetWebhookConfigForOrg + orgsUpdateWebhookConfigForOrg: OrgsUpdateWebhookConfigForOrg + orgsListWebhookDeliveries: OrgsListWebhookDeliveries + orgsGetWebhookDelivery: OrgsGetWebhookDelivery + orgsRedeliverWebhookDelivery: OrgsRedeliverWebhookDelivery + orgsPingWebhook: OrgsPingWebhook + apiInsightsGetRouteStatsByActor: ApiInsightsGetRouteStatsByActor + apiInsightsGetSubjectStats: ApiInsightsGetSubjectStats + apiInsightsGetSummaryStats: ApiInsightsGetSummaryStats + apiInsightsGetSummaryStatsByUser: ApiInsightsGetSummaryStatsByUser + apiInsightsGetSummaryStatsByActor: ApiInsightsGetSummaryStatsByActor + apiInsightsGetTimeStats: ApiInsightsGetTimeStats + apiInsightsGetTimeStatsByUser: ApiInsightsGetTimeStatsByUser + apiInsightsGetTimeStatsByActor: ApiInsightsGetTimeStatsByActor + apiInsightsGetUserStats: ApiInsightsGetUserStats + appsGetOrgInstallation: AppsGetOrgInstallation + orgsListAppInstallations: OrgsListAppInstallations + interactionsGetRestrictionsForOrg: InteractionsGetRestrictionsForOrg + interactionsSetRestrictionsForOrg: InteractionsSetRestrictionsForOrg + interactionsRemoveRestrictionsForOrg: InteractionsRemoveRestrictionsForOrg + orgsListPendingInvitations: OrgsListPendingInvitations + orgsCreateInvitation: OrgsCreateInvitation + orgsCancelInvitation: OrgsCancelInvitation + orgsListInvitationTeams: OrgsListInvitationTeams + orgsListIssueTypes: OrgsListIssueTypes + orgsCreateIssueType: OrgsCreateIssueType + orgsUpdateIssueType: OrgsUpdateIssueType + orgsDeleteIssueType: OrgsDeleteIssueType + issuesListForOrg: IssuesListForOrg + orgsListMembers: OrgsListMembers + orgsCheckMembershipForUser: OrgsCheckMembershipForUser + orgsRemoveMember: OrgsRemoveMember + codespacesGetCodespacesForUserInOrg: CodespacesGetCodespacesForUserInOrg + codespacesDeleteFromOrganization: CodespacesDeleteFromOrganization + codespacesStopInOrganization: CodespacesStopInOrganization + copilotGetCopilotSeatDetailsForUser: CopilotGetCopilotSeatDetailsForUser + orgsGetMembershipForUser: OrgsGetMembershipForUser + orgsSetMembershipForUser: OrgsSetMembershipForUser + orgsRemoveMembershipForUser: OrgsRemoveMembershipForUser + migrationsListForOrg: MigrationsListForOrg + migrationsStartForOrg: MigrationsStartForOrg + migrationsGetStatusForOrg: MigrationsGetStatusForOrg + migrationsDownloadArchiveForOrg: MigrationsDownloadArchiveForOrg + migrationsDeleteArchiveForOrg: MigrationsDeleteArchiveForOrg + migrationsUnlockRepoForOrg: MigrationsUnlockRepoForOrg + migrationsListReposForOrg: MigrationsListReposForOrg + orgsListOrgRoles: OrgsListOrgRoles + orgsRevokeAllOrgRolesTeam: OrgsRevokeAllOrgRolesTeam + orgsAssignTeamToOrgRole: OrgsAssignTeamToOrgRole + orgsRevokeOrgRoleTeam: OrgsRevokeOrgRoleTeam + orgsRevokeAllOrgRolesUser: OrgsRevokeAllOrgRolesUser + orgsAssignUserToOrgRole: OrgsAssignUserToOrgRole + orgsRevokeOrgRoleUser: OrgsRevokeOrgRoleUser + orgsGetOrgRole: OrgsGetOrgRole + orgsListOrgRoleTeams: OrgsListOrgRoleTeams + orgsListOrgRoleUsers: OrgsListOrgRoleUsers + orgsListOutsideCollaborators: OrgsListOutsideCollaborators + orgsConvertMemberToOutsideCollaborator: OrgsConvertMemberToOutsideCollaborator + orgsRemoveOutsideCollaborator: OrgsRemoveOutsideCollaborator + packagesListPackagesForOrganization: PackagesListPackagesForOrganization + packagesGetPackageForOrganization: PackagesGetPackageForOrganization + packagesDeletePackageForOrg: PackagesDeletePackageForOrg + packagesRestorePackageForOrg: PackagesRestorePackageForOrg + packagesGetAllPackageVersionsForPackageOwnedByOrg: PackagesGetAllPackageVersionsForPackageOwnedByOrg + packagesGetPackageVersionForOrganization: PackagesGetPackageVersionForOrganization + packagesDeletePackageVersionForOrg: PackagesDeletePackageVersionForOrg + packagesRestorePackageVersionForOrg: PackagesRestorePackageVersionForOrg + orgsListPatGrantRequests: OrgsListPatGrantRequests + orgsReviewPatGrantRequestsInBulk: OrgsReviewPatGrantRequestsInBulk + orgsReviewPatGrantRequest: OrgsReviewPatGrantRequest + orgsListPatGrantRequestRepositories: OrgsListPatGrantRequestRepositories + orgsListPatGrants: OrgsListPatGrants + orgsUpdatePatAccesses: OrgsUpdatePatAccesses + orgsUpdatePatAccess: OrgsUpdatePatAccess + orgsListPatGrantRepositories: OrgsListPatGrantRepositories + privateRegistriesListOrgPrivateRegistries: PrivateRegistriesListOrgPrivateRegistries + privateRegistriesCreateOrgPrivateRegistry: PrivateRegistriesCreateOrgPrivateRegistry + privateRegistriesGetOrgPublicKey: PrivateRegistriesGetOrgPublicKey + privateRegistriesGetOrgPrivateRegistry: PrivateRegistriesGetOrgPrivateRegistry + privateRegistriesUpdateOrgPrivateRegistry: PrivateRegistriesUpdateOrgPrivateRegistry + privateRegistriesDeleteOrgPrivateRegistry: PrivateRegistriesDeleteOrgPrivateRegistry + projectsListForOrg: ProjectsListForOrg + projectsCreateForOrg: ProjectsCreateForOrg + orgsGetAllCustomProperties: OrgsGetAllCustomProperties + orgsCreateOrUpdateCustomProperties: OrgsCreateOrUpdateCustomProperties + orgsGetCustomProperty: OrgsGetCustomProperty + orgsCreateOrUpdateCustomProperty: OrgsCreateOrUpdateCustomProperty + orgsRemoveCustomProperty: OrgsRemoveCustomProperty + orgsListCustomPropertiesValuesForRepos: OrgsListCustomPropertiesValuesForRepos + orgsCreateOrUpdateCustomPropertiesValuesForRepos: OrgsCreateOrUpdateCustomPropertiesValuesForRepos + orgsListPublicMembers: OrgsListPublicMembers + orgsCheckPublicMembershipForUser: OrgsCheckPublicMembershipForUser + orgsSetPublicMembershipForAuthenticatedUser: OrgsSetPublicMembershipForAuthenticatedUser + orgsRemovePublicMembershipForAuthenticatedUser: OrgsRemovePublicMembershipForAuthenticatedUser + reposListForOrg: ReposListForOrg + reposCreateInOrg: ReposCreateInOrg + reposGetOrgRulesets: ReposGetOrgRulesets + reposCreateOrgRuleset: ReposCreateOrgRuleset + reposGetOrgRuleSuites: ReposGetOrgRuleSuites + reposGetOrgRuleSuite: ReposGetOrgRuleSuite + reposGetOrgRuleset: ReposGetOrgRuleset + reposUpdateOrgRuleset: ReposUpdateOrgRuleset + reposDeleteOrgRuleset: ReposDeleteOrgRuleset + orgsGetOrgRulesetHistory: OrgsGetOrgRulesetHistory + orgsGetOrgRulesetVersion: OrgsGetOrgRulesetVersion + secretScanningListAlertsForOrg: SecretScanningListAlertsForOrg + securityAdvisoriesListOrgRepositoryAdvisories: SecurityAdvisoriesListOrgRepositoryAdvisories + orgsListSecurityManagerTeams: OrgsListSecurityManagerTeams + orgsAddSecurityManagerTeam: OrgsAddSecurityManagerTeam + orgsRemoveSecurityManagerTeam: OrgsRemoveSecurityManagerTeam + billingGetGithubActionsBillingOrg: BillingGetGithubActionsBillingOrg + billingGetGithubPackagesBillingOrg: BillingGetGithubPackagesBillingOrg + billingGetSharedStorageBillingOrg: BillingGetSharedStorageBillingOrg + hostedComputeListNetworkConfigurationsForOrg: HostedComputeListNetworkConfigurationsForOrg + hostedComputeCreateNetworkConfigurationForOrg: HostedComputeCreateNetworkConfigurationForOrg + hostedComputeGetNetworkConfigurationForOrg: HostedComputeGetNetworkConfigurationForOrg + hostedComputeUpdateNetworkConfigurationForOrg: HostedComputeUpdateNetworkConfigurationForOrg + hostedComputeDeleteNetworkConfigurationFromOrg: HostedComputeDeleteNetworkConfigurationFromOrg + hostedComputeGetNetworkSettingsForOrg: HostedComputeGetNetworkSettingsForOrg + copilotCopilotMetricsForTeam: CopilotCopilotMetricsForTeam + teamsList: TeamsList + teamsCreate: TeamsCreate + teamsGetByName: TeamsGetByName + teamsUpdateInOrg: TeamsUpdateInOrg + teamsDeleteInOrg: TeamsDeleteInOrg + teamsListDiscussionsInOrg: TeamsListDiscussionsInOrg + teamsCreateDiscussionInOrg: TeamsCreateDiscussionInOrg + teamsGetDiscussionInOrg: TeamsGetDiscussionInOrg + teamsUpdateDiscussionInOrg: TeamsUpdateDiscussionInOrg + teamsDeleteDiscussionInOrg: TeamsDeleteDiscussionInOrg + teamsListDiscussionCommentsInOrg: TeamsListDiscussionCommentsInOrg + teamsCreateDiscussionCommentInOrg: TeamsCreateDiscussionCommentInOrg + teamsGetDiscussionCommentInOrg: TeamsGetDiscussionCommentInOrg + teamsUpdateDiscussionCommentInOrg: TeamsUpdateDiscussionCommentInOrg + teamsDeleteDiscussionCommentInOrg: TeamsDeleteDiscussionCommentInOrg + reactionsListForTeamDiscussionCommentInOrg: ReactionsListForTeamDiscussionCommentInOrg + reactionsCreateForTeamDiscussionCommentInOrg: ReactionsCreateForTeamDiscussionCommentInOrg + reactionsDeleteForTeamDiscussionComment: ReactionsDeleteForTeamDiscussionComment + reactionsListForTeamDiscussionInOrg: ReactionsListForTeamDiscussionInOrg + reactionsCreateForTeamDiscussionInOrg: ReactionsCreateForTeamDiscussionInOrg + reactionsDeleteForTeamDiscussion: ReactionsDeleteForTeamDiscussion + teamsListPendingInvitationsInOrg: TeamsListPendingInvitationsInOrg + teamsListMembersInOrg: TeamsListMembersInOrg + teamsGetMembershipForUserInOrg: TeamsGetMembershipForUserInOrg + teamsAddOrUpdateMembershipForUserInOrg: TeamsAddOrUpdateMembershipForUserInOrg + teamsRemoveMembershipForUserInOrg: TeamsRemoveMembershipForUserInOrg + teamsListProjectsInOrg: TeamsListProjectsInOrg + teamsCheckPermissionsForProjectInOrg: TeamsCheckPermissionsForProjectInOrg + teamsAddOrUpdateProjectPermissionsInOrg: TeamsAddOrUpdateProjectPermissionsInOrg + teamsRemoveProjectInOrg: TeamsRemoveProjectInOrg + teamsListReposInOrg: TeamsListReposInOrg + teamsCheckPermissionsForRepoInOrg: TeamsCheckPermissionsForRepoInOrg + teamsAddOrUpdateRepoPermissionsInOrg: TeamsAddOrUpdateRepoPermissionsInOrg + teamsRemoveRepoInOrg: TeamsRemoveRepoInOrg + teamsListChildInOrg: TeamsListChildInOrg + orgsEnableOrDisableSecurityProductOnAllOrgRepos: OrgsEnableOrDisableSecurityProductOnAllOrgRepos + projectsGetCard: ProjectsGetCard + projectsUpdateCard: ProjectsUpdateCard + projectsDeleteCard: ProjectsDeleteCard + projectsMoveCard: ProjectsMoveCard + projectsGetColumn: ProjectsGetColumn + projectsUpdateColumn: ProjectsUpdateColumn + projectsDeleteColumn: ProjectsDeleteColumn + projectsListCards: ProjectsListCards + projectsCreateCard: ProjectsCreateCard + projectsMoveColumn: ProjectsMoveColumn + projectsGet: ProjectsGet + projectsUpdate: ProjectsUpdate + projectsDelete: ProjectsDelete + projectsListCollaborators: ProjectsListCollaborators + projectsAddCollaborator: ProjectsAddCollaborator + projectsRemoveCollaborator: ProjectsRemoveCollaborator + projectsGetPermissionForUser: ProjectsGetPermissionForUser + projectsListColumns: ProjectsListColumns + projectsCreateColumn: ProjectsCreateColumn + rateLimitGet: RateLimitGet + reposGet: ReposGet + reposUpdate: ReposUpdate + reposDelete: ReposDelete + actionsListArtifactsForRepo: ActionsListArtifactsForRepo + actionsGetArtifact: ActionsGetArtifact + actionsDeleteArtifact: ActionsDeleteArtifact + actionsDownloadArtifact: ActionsDownloadArtifact + actionsGetActionsCacheUsage: ActionsGetActionsCacheUsage + actionsGetActionsCacheList: ActionsGetActionsCacheList + actionsDeleteActionsCacheByKey: ActionsDeleteActionsCacheByKey + actionsDeleteActionsCacheById: ActionsDeleteActionsCacheById + actionsGetJobForWorkflowRun: ActionsGetJobForWorkflowRun + actionsDownloadJobLogsForWorkflowRun: ActionsDownloadJobLogsForWorkflowRun + actionsReRunJobForWorkflowRun: ActionsReRunJobForWorkflowRun + actionsGetCustomOidcSubClaimForRepo: ActionsGetCustomOidcSubClaimForRepo + actionsSetCustomOidcSubClaimForRepo: ActionsSetCustomOidcSubClaimForRepo + actionsListRepoOrganizationSecrets: ActionsListRepoOrganizationSecrets + actionsListRepoOrganizationVariables: ActionsListRepoOrganizationVariables + actionsGetGithubActionsPermissionsRepository: ActionsGetGithubActionsPermissionsRepository + actionsSetGithubActionsPermissionsRepository: ActionsSetGithubActionsPermissionsRepository + actionsGetWorkflowAccessToRepository: ActionsGetWorkflowAccessToRepository + actionsSetWorkflowAccessToRepository: ActionsSetWorkflowAccessToRepository + actionsGetAllowedActionsRepository: ActionsGetAllowedActionsRepository + actionsSetAllowedActionsRepository: ActionsSetAllowedActionsRepository + actionsGetGithubActionsDefaultWorkflowPermissionsRepository: ActionsGetGithubActionsDefaultWorkflowPermissionsRepository + actionsSetGithubActionsDefaultWorkflowPermissionsRepository: ActionsSetGithubActionsDefaultWorkflowPermissionsRepository + actionsListSelfHostedRunnersForRepo: ActionsListSelfHostedRunnersForRepo + actionsListRunnerApplicationsForRepo: ActionsListRunnerApplicationsForRepo + actionsGenerateRunnerJitconfigForRepo: ActionsGenerateRunnerJitconfigForRepo + actionsCreateRegistrationTokenForRepo: ActionsCreateRegistrationTokenForRepo + actionsCreateRemoveTokenForRepo: ActionsCreateRemoveTokenForRepo + actionsGetSelfHostedRunnerForRepo: ActionsGetSelfHostedRunnerForRepo + actionsDeleteSelfHostedRunnerFromRepo: ActionsDeleteSelfHostedRunnerFromRepo + actionsListLabelsForSelfHostedRunnerForRepo: ActionsListLabelsForSelfHostedRunnerForRepo + actionsAddCustomLabelsToSelfHostedRunnerForRepo: ActionsAddCustomLabelsToSelfHostedRunnerForRepo + actionsSetCustomLabelsForSelfHostedRunnerForRepo: ActionsSetCustomLabelsForSelfHostedRunnerForRepo + actionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepo: ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepo + actionsRemoveCustomLabelFromSelfHostedRunnerForRepo: ActionsRemoveCustomLabelFromSelfHostedRunnerForRepo + actionsListWorkflowRunsForRepo: ActionsListWorkflowRunsForRepo + actionsGetWorkflowRun: ActionsGetWorkflowRun + actionsDeleteWorkflowRun: ActionsDeleteWorkflowRun + actionsGetReviewsForRun: ActionsGetReviewsForRun + actionsApproveWorkflowRun: ActionsApproveWorkflowRun + actionsListWorkflowRunArtifacts: ActionsListWorkflowRunArtifacts + actionsGetWorkflowRunAttempt: ActionsGetWorkflowRunAttempt + actionsListJobsForWorkflowRunAttempt: ActionsListJobsForWorkflowRunAttempt + actionsDownloadWorkflowRunAttemptLogs: ActionsDownloadWorkflowRunAttemptLogs + actionsCancelWorkflowRun: ActionsCancelWorkflowRun + actionsReviewCustomGatesForRun: ActionsReviewCustomGatesForRun + actionsForceCancelWorkflowRun: ActionsForceCancelWorkflowRun + actionsListJobsForWorkflowRun: ActionsListJobsForWorkflowRun + actionsDownloadWorkflowRunLogs: ActionsDownloadWorkflowRunLogs + actionsDeleteWorkflowRunLogs: ActionsDeleteWorkflowRunLogs + actionsGetPendingDeploymentsForRun: ActionsGetPendingDeploymentsForRun + actionsReviewPendingDeploymentsForRun: ActionsReviewPendingDeploymentsForRun + actionsReRunWorkflow: ActionsReRunWorkflow + actionsReRunWorkflowFailedJobs: ActionsReRunWorkflowFailedJobs + actionsGetWorkflowRunUsage: ActionsGetWorkflowRunUsage + actionsListRepoSecrets: ActionsListRepoSecrets + actionsGetRepoPublicKey: ActionsGetRepoPublicKey + actionsGetRepoSecret: ActionsGetRepoSecret + actionsCreateOrUpdateRepoSecret: ActionsCreateOrUpdateRepoSecret + actionsDeleteRepoSecret: ActionsDeleteRepoSecret + actionsListRepoVariables: ActionsListRepoVariables + actionsCreateRepoVariable: ActionsCreateRepoVariable + actionsGetRepoVariable: ActionsGetRepoVariable + actionsUpdateRepoVariable: ActionsUpdateRepoVariable + actionsDeleteRepoVariable: ActionsDeleteRepoVariable + actionsListRepoWorkflows: ActionsListRepoWorkflows + actionsGetWorkflow: ActionsGetWorkflow + actionsDisableWorkflow: ActionsDisableWorkflow + actionsCreateWorkflowDispatch: ActionsCreateWorkflowDispatch + actionsEnableWorkflow: ActionsEnableWorkflow + actionsListWorkflowRuns: ActionsListWorkflowRuns + actionsGetWorkflowUsage: ActionsGetWorkflowUsage + reposListActivities: ReposListActivities + issuesListAssignees: IssuesListAssignees + issuesCheckUserCanBeAssigned: IssuesCheckUserCanBeAssigned + reposCreateAttestation: ReposCreateAttestation + reposListAttestations: ReposListAttestations + reposListAutolinks: ReposListAutolinks + reposCreateAutolink: ReposCreateAutolink + reposGetAutolink: ReposGetAutolink + reposDeleteAutolink: ReposDeleteAutolink + reposCheckAutomatedSecurityFixes: ReposCheckAutomatedSecurityFixes + reposEnableAutomatedSecurityFixes: ReposEnableAutomatedSecurityFixes + reposDisableAutomatedSecurityFixes: ReposDisableAutomatedSecurityFixes + reposListBranches: ReposListBranches + reposGetBranch: ReposGetBranch + reposGetBranchProtection: ReposGetBranchProtection + reposUpdateBranchProtection: ReposUpdateBranchProtection + reposDeleteBranchProtection: ReposDeleteBranchProtection + reposGetAdminBranchProtection: ReposGetAdminBranchProtection + reposSetAdminBranchProtection: ReposSetAdminBranchProtection + reposDeleteAdminBranchProtection: ReposDeleteAdminBranchProtection + reposGetPullRequestReviewProtection: ReposGetPullRequestReviewProtection + reposUpdatePullRequestReviewProtection: ReposUpdatePullRequestReviewProtection + reposDeletePullRequestReviewProtection: ReposDeletePullRequestReviewProtection + reposGetCommitSignatureProtection: ReposGetCommitSignatureProtection + reposCreateCommitSignatureProtection: ReposCreateCommitSignatureProtection + reposDeleteCommitSignatureProtection: ReposDeleteCommitSignatureProtection + reposGetStatusChecksProtection: ReposGetStatusChecksProtection + reposUpdateStatusCheckProtection: ReposUpdateStatusCheckProtection + reposRemoveStatusCheckProtection: ReposRemoveStatusCheckProtection + reposGetAllStatusCheckContexts: ReposGetAllStatusCheckContexts + reposAddStatusCheckContexts: ReposAddStatusCheckContexts + reposSetStatusCheckContexts: ReposSetStatusCheckContexts + reposRemoveStatusCheckContexts: ReposRemoveStatusCheckContexts + reposGetAccessRestrictions: ReposGetAccessRestrictions + reposDeleteAccessRestrictions: ReposDeleteAccessRestrictions + reposGetAppsWithAccessToProtectedBranch: ReposGetAppsWithAccessToProtectedBranch + reposAddAppAccessRestrictions: ReposAddAppAccessRestrictions + reposSetAppAccessRestrictions: ReposSetAppAccessRestrictions + reposRemoveAppAccessRestrictions: ReposRemoveAppAccessRestrictions + reposGetTeamsWithAccessToProtectedBranch: ReposGetTeamsWithAccessToProtectedBranch + reposAddTeamAccessRestrictions: ReposAddTeamAccessRestrictions + reposSetTeamAccessRestrictions: ReposSetTeamAccessRestrictions + reposRemoveTeamAccessRestrictions: ReposRemoveTeamAccessRestrictions + reposGetUsersWithAccessToProtectedBranch: ReposGetUsersWithAccessToProtectedBranch + reposAddUserAccessRestrictions: ReposAddUserAccessRestrictions + reposSetUserAccessRestrictions: ReposSetUserAccessRestrictions + reposRemoveUserAccessRestrictions: ReposRemoveUserAccessRestrictions + reposRenameBranch: ReposRenameBranch + checksCreate: ChecksCreate + checksGet: ChecksGet + checksUpdate: ChecksUpdate + checksListAnnotations: ChecksListAnnotations + checksRerequestRun: ChecksRerequestRun + checksCreateSuite: ChecksCreateSuite + checksSetSuitesPreferences: ChecksSetSuitesPreferences + checksGetSuite: ChecksGetSuite + checksListForSuite: ChecksListForSuite + checksRerequestSuite: ChecksRerequestSuite + codeScanningListAlertsForRepo: CodeScanningListAlertsForRepo + codeScanningGetAlert: CodeScanningGetAlert + codeScanningUpdateAlert: CodeScanningUpdateAlert + codeScanningGetAutofix: CodeScanningGetAutofix + codeScanningCreateAutofix: CodeScanningCreateAutofix + codeScanningCommitAutofix: CodeScanningCommitAutofix + codeScanningListAlertInstances: CodeScanningListAlertInstances + codeScanningListRecentAnalyses: CodeScanningListRecentAnalyses + codeScanningGetAnalysis: CodeScanningGetAnalysis + codeScanningDeleteAnalysis: CodeScanningDeleteAnalysis + codeScanningListCodeqlDatabases: CodeScanningListCodeqlDatabases + codeScanningGetCodeqlDatabase: CodeScanningGetCodeqlDatabase + codeScanningDeleteCodeqlDatabase: CodeScanningDeleteCodeqlDatabase + codeScanningCreateVariantAnalysis: CodeScanningCreateVariantAnalysis + codeScanningGetVariantAnalysis: CodeScanningGetVariantAnalysis + codeScanningGetVariantAnalysisRepoTask: CodeScanningGetVariantAnalysisRepoTask + codeScanningGetDefaultSetup: CodeScanningGetDefaultSetup + codeScanningUpdateDefaultSetup: CodeScanningUpdateDefaultSetup + codeScanningUploadSarif: CodeScanningUploadSarif + codeScanningGetSarif: CodeScanningGetSarif + codeSecurityGetConfigurationForRepository: CodeSecurityGetConfigurationForRepository + reposCodeownersErrors: ReposCodeownersErrors + codespacesListInRepositoryForAuthenticatedUser: CodespacesListInRepositoryForAuthenticatedUser + codespacesCreateWithRepoForAuthenticatedUser: CodespacesCreateWithRepoForAuthenticatedUser + codespacesListDevcontainersInRepositoryForAuthenticatedUser: CodespacesListDevcontainersInRepositoryForAuthenticatedUser + codespacesRepoMachinesForAuthenticatedUser: CodespacesRepoMachinesForAuthenticatedUser + codespacesPreFlightWithRepoForAuthenticatedUser: CodespacesPreFlightWithRepoForAuthenticatedUser + codespacesCheckPermissionsForDevcontainer: CodespacesCheckPermissionsForDevcontainer + codespacesListRepoSecrets: CodespacesListRepoSecrets + codespacesGetRepoPublicKey: CodespacesGetRepoPublicKey + codespacesGetRepoSecret: CodespacesGetRepoSecret + codespacesCreateOrUpdateRepoSecret: CodespacesCreateOrUpdateRepoSecret + codespacesDeleteRepoSecret: CodespacesDeleteRepoSecret + reposListCollaborators: ReposListCollaborators + reposCheckCollaborator: ReposCheckCollaborator + reposAddCollaborator: ReposAddCollaborator + reposRemoveCollaborator: ReposRemoveCollaborator + reposGetCollaboratorPermissionLevel: ReposGetCollaboratorPermissionLevel + reposListCommitCommentsForRepo: ReposListCommitCommentsForRepo + reposGetCommitComment: ReposGetCommitComment + reposUpdateCommitComment: ReposUpdateCommitComment + reposDeleteCommitComment: ReposDeleteCommitComment + reactionsListForCommitComment: ReactionsListForCommitComment + reactionsCreateForCommitComment: ReactionsCreateForCommitComment + reactionsDeleteForCommitComment: ReactionsDeleteForCommitComment + reposListCommits: ReposListCommits + reposListBranchesForHeadCommit: ReposListBranchesForHeadCommit + reposListCommentsForCommit: ReposListCommentsForCommit + reposCreateCommitComment: ReposCreateCommitComment + reposListPullRequestsAssociatedWithCommit: ReposListPullRequestsAssociatedWithCommit + reposGetCommit: ReposGetCommit + checksListForRef: ChecksListForRef + checksListSuitesForRef: ChecksListSuitesForRef + reposGetCombinedStatusForRef: ReposGetCombinedStatusForRef + reposListCommitStatusesForRef: ReposListCommitStatusesForRef + reposGetCommunityProfileMetrics: ReposGetCommunityProfileMetrics + reposCompareCommits: ReposCompareCommits + reposGetContent: ReposGetContent + reposCreateOrUpdateFileContents: ReposCreateOrUpdateFileContents + reposDeleteFile: ReposDeleteFile + reposListContributors: ReposListContributors + dependabotListAlertsForRepo: DependabotListAlertsForRepo + dependabotGetAlert: DependabotGetAlert + dependabotUpdateAlert: DependabotUpdateAlert + dependabotListRepoSecrets: DependabotListRepoSecrets + dependabotGetRepoPublicKey: DependabotGetRepoPublicKey + dependabotGetRepoSecret: DependabotGetRepoSecret + dependabotCreateOrUpdateRepoSecret: DependabotCreateOrUpdateRepoSecret + dependabotDeleteRepoSecret: DependabotDeleteRepoSecret + dependencyGraphDiffRange: DependencyGraphDiffRange + dependencyGraphExportSbom: DependencyGraphExportSbom + dependencyGraphCreateRepositorySnapshot: DependencyGraphCreateRepositorySnapshot + reposListDeployments: ReposListDeployments + reposCreateDeployment: ReposCreateDeployment + reposGetDeployment: ReposGetDeployment + reposDeleteDeployment: ReposDeleteDeployment + reposListDeploymentStatuses: ReposListDeploymentStatuses + reposCreateDeploymentStatus: ReposCreateDeploymentStatus + reposGetDeploymentStatus: ReposGetDeploymentStatus + reposCreateDispatchEvent: ReposCreateDispatchEvent + reposGetAllEnvironments: ReposGetAllEnvironments + reposGetEnvironment: ReposGetEnvironment + reposCreateOrUpdateEnvironment: ReposCreateOrUpdateEnvironment + reposDeleteAnEnvironment: ReposDeleteAnEnvironment + reposListDeploymentBranchPolicies: ReposListDeploymentBranchPolicies + reposCreateDeploymentBranchPolicy: ReposCreateDeploymentBranchPolicy + reposGetDeploymentBranchPolicy: ReposGetDeploymentBranchPolicy + reposUpdateDeploymentBranchPolicy: ReposUpdateDeploymentBranchPolicy + reposDeleteDeploymentBranchPolicy: ReposDeleteDeploymentBranchPolicy + reposGetAllDeploymentProtectionRules: ReposGetAllDeploymentProtectionRules + reposCreateDeploymentProtectionRule: ReposCreateDeploymentProtectionRule + reposListCustomDeploymentRuleIntegrations: ReposListCustomDeploymentRuleIntegrations + reposGetCustomDeploymentProtectionRule: ReposGetCustomDeploymentProtectionRule + reposDisableDeploymentProtectionRule: ReposDisableDeploymentProtectionRule + actionsListEnvironmentSecrets: ActionsListEnvironmentSecrets + actionsGetEnvironmentPublicKey: ActionsGetEnvironmentPublicKey + actionsGetEnvironmentSecret: ActionsGetEnvironmentSecret + actionsCreateOrUpdateEnvironmentSecret: ActionsCreateOrUpdateEnvironmentSecret + actionsDeleteEnvironmentSecret: ActionsDeleteEnvironmentSecret + actionsListEnvironmentVariables: ActionsListEnvironmentVariables + actionsCreateEnvironmentVariable: ActionsCreateEnvironmentVariable + actionsGetEnvironmentVariable: ActionsGetEnvironmentVariable + actionsUpdateEnvironmentVariable: ActionsUpdateEnvironmentVariable + actionsDeleteEnvironmentVariable: ActionsDeleteEnvironmentVariable + activityListRepoEvents: ActivityListRepoEvents + reposListForks: ReposListForks + reposCreateFork: ReposCreateFork + gitCreateBlob: GitCreateBlob + gitGetBlob: GitGetBlob + gitCreateCommit: GitCreateCommit + gitGetCommit: GitGetCommit + gitListMatchingRefs: GitListMatchingRefs + gitGetRef: GitGetRef + gitCreateRef: GitCreateRef + gitUpdateRef: GitUpdateRef + gitDeleteRef: GitDeleteRef + gitCreateTag: GitCreateTag + gitGetTag: GitGetTag + gitCreateTree: GitCreateTree + gitGetTree: GitGetTree + reposListWebhooks: ReposListWebhooks + reposCreateWebhook: ReposCreateWebhook + reposGetWebhook: ReposGetWebhook + reposUpdateWebhook: ReposUpdateWebhook + reposDeleteWebhook: ReposDeleteWebhook + reposGetWebhookConfigForRepo: ReposGetWebhookConfigForRepo + reposUpdateWebhookConfigForRepo: ReposUpdateWebhookConfigForRepo + reposListWebhookDeliveries: ReposListWebhookDeliveries + reposGetWebhookDelivery: ReposGetWebhookDelivery + reposRedeliverWebhookDelivery: ReposRedeliverWebhookDelivery + reposPingWebhook: ReposPingWebhook + reposTestPushWebhook: ReposTestPushWebhook + migrationsGetImportStatus: MigrationsGetImportStatus + migrationsStartImport: MigrationsStartImport + migrationsUpdateImport: MigrationsUpdateImport + migrationsCancelImport: MigrationsCancelImport + migrationsGetCommitAuthors: MigrationsGetCommitAuthors + migrationsMapCommitAuthor: MigrationsMapCommitAuthor + migrationsGetLargeFiles: MigrationsGetLargeFiles + migrationsSetLfsPreference: MigrationsSetLfsPreference + appsGetRepoInstallation: AppsGetRepoInstallation + interactionsGetRestrictionsForRepo: InteractionsGetRestrictionsForRepo + interactionsSetRestrictionsForRepo: InteractionsSetRestrictionsForRepo + interactionsRemoveRestrictionsForRepo: InteractionsRemoveRestrictionsForRepo + reposListInvitations: ReposListInvitations + reposUpdateInvitation: ReposUpdateInvitation + reposDeleteInvitation: ReposDeleteInvitation + issuesListForRepo: IssuesListForRepo + issuesCreate: IssuesCreate + issuesListCommentsForRepo: IssuesListCommentsForRepo + issuesGetComment: IssuesGetComment + issuesUpdateComment: IssuesUpdateComment + issuesDeleteComment: IssuesDeleteComment + reactionsListForIssueComment: ReactionsListForIssueComment + reactionsCreateForIssueComment: ReactionsCreateForIssueComment + reactionsDeleteForIssueComment: ReactionsDeleteForIssueComment + issuesListEventsForRepo: IssuesListEventsForRepo + issuesGetEvent: IssuesGetEvent + issuesGet: IssuesGet + issuesUpdate: IssuesUpdate + issuesAddAssignees: IssuesAddAssignees + issuesRemoveAssignees: IssuesRemoveAssignees + issuesCheckUserCanBeAssignedToIssue: IssuesCheckUserCanBeAssignedToIssue + issuesListComments: IssuesListComments + issuesCreateComment: IssuesCreateComment + issuesListEvents: IssuesListEvents + issuesListLabelsOnIssue: IssuesListLabelsOnIssue + issuesAddLabels: IssuesAddLabels + issuesSetLabels: IssuesSetLabels + issuesRemoveAllLabels: IssuesRemoveAllLabels + issuesRemoveLabel: IssuesRemoveLabel + issuesLock: IssuesLock + issuesUnlock: IssuesUnlock + reactionsListForIssue: ReactionsListForIssue + reactionsCreateForIssue: ReactionsCreateForIssue + reactionsDeleteForIssue: ReactionsDeleteForIssue + issuesRemoveSubIssue: IssuesRemoveSubIssue + issuesListSubIssues: IssuesListSubIssues + issuesAddSubIssue: IssuesAddSubIssue + issuesReprioritizeSubIssue: IssuesReprioritizeSubIssue + issuesListEventsForTimeline: IssuesListEventsForTimeline + reposListDeployKeys: ReposListDeployKeys + reposCreateDeployKey: ReposCreateDeployKey + reposGetDeployKey: ReposGetDeployKey + reposDeleteDeployKey: ReposDeleteDeployKey + issuesListLabelsForRepo: IssuesListLabelsForRepo + issuesCreateLabel: IssuesCreateLabel + issuesGetLabel: IssuesGetLabel + issuesUpdateLabel: IssuesUpdateLabel + issuesDeleteLabel: IssuesDeleteLabel + reposListLanguages: ReposListLanguages + licensesGetForRepo: LicensesGetForRepo + reposMergeUpstream: ReposMergeUpstream + reposMerge: ReposMerge + issuesListMilestones: IssuesListMilestones + issuesCreateMilestone: IssuesCreateMilestone + issuesGetMilestone: IssuesGetMilestone + issuesUpdateMilestone: IssuesUpdateMilestone + issuesDeleteMilestone: IssuesDeleteMilestone + issuesListLabelsForMilestone: IssuesListLabelsForMilestone + activityListRepoNotificationsForAuthenticatedUser: ActivityListRepoNotificationsForAuthenticatedUser + activityMarkRepoNotificationsAsRead: ActivityMarkRepoNotificationsAsRead + reposGetPages: ReposGetPages + reposCreatePagesSite: ReposCreatePagesSite + reposUpdateInformationAboutPagesSite: ReposUpdateInformationAboutPagesSite + reposDeletePagesSite: ReposDeletePagesSite + reposListPagesBuilds: ReposListPagesBuilds + reposRequestPagesBuild: ReposRequestPagesBuild + reposGetLatestPagesBuild: ReposGetLatestPagesBuild + reposGetPagesBuild: ReposGetPagesBuild + reposCreatePagesDeployment: ReposCreatePagesDeployment + reposGetPagesDeployment: ReposGetPagesDeployment + reposCancelPagesDeployment: ReposCancelPagesDeployment + reposGetPagesHealthCheck: ReposGetPagesHealthCheck + reposCheckPrivateVulnerabilityReporting: ReposCheckPrivateVulnerabilityReporting + reposEnablePrivateVulnerabilityReporting: ReposEnablePrivateVulnerabilityReporting + reposDisablePrivateVulnerabilityReporting: ReposDisablePrivateVulnerabilityReporting + projectsListForRepo: ProjectsListForRepo + projectsCreateForRepo: ProjectsCreateForRepo + reposGetCustomPropertiesValues: ReposGetCustomPropertiesValues + reposCreateOrUpdateCustomPropertiesValues: ReposCreateOrUpdateCustomPropertiesValues + pullsList: PullsList + pullsCreate: PullsCreate + pullsListReviewCommentsForRepo: PullsListReviewCommentsForRepo + pullsGetReviewComment: PullsGetReviewComment + pullsUpdateReviewComment: PullsUpdateReviewComment + pullsDeleteReviewComment: PullsDeleteReviewComment + reactionsListForPullRequestReviewComment: ReactionsListForPullRequestReviewComment + reactionsCreateForPullRequestReviewComment: ReactionsCreateForPullRequestReviewComment + reactionsDeleteForPullRequestComment: ReactionsDeleteForPullRequestComment + pullsGet: PullsGet + pullsUpdate: PullsUpdate + codespacesCreateWithPrForAuthenticatedUser: CodespacesCreateWithPrForAuthenticatedUser + pullsListReviewComments: PullsListReviewComments + pullsCreateReviewComment: PullsCreateReviewComment + pullsCreateReplyForReviewComment: PullsCreateReplyForReviewComment + pullsListCommits: PullsListCommits + pullsListFiles: PullsListFiles + pullsCheckIfMerged: PullsCheckIfMerged + pullsMerge: PullsMerge + pullsListRequestedReviewers: PullsListRequestedReviewers + pullsRequestReviewers: PullsRequestReviewers + pullsRemoveRequestedReviewers: PullsRemoveRequestedReviewers + pullsListReviews: PullsListReviews + pullsCreateReview: PullsCreateReview + pullsGetReview: PullsGetReview + pullsUpdateReview: PullsUpdateReview + pullsDeletePendingReview: PullsDeletePendingReview + pullsListCommentsForReview: PullsListCommentsForReview + pullsDismissReview: PullsDismissReview + pullsSubmitReview: PullsSubmitReview + pullsUpdateBranch: PullsUpdateBranch + reposGetReadme: ReposGetReadme + reposGetReadmeInDirectory: ReposGetReadmeInDirectory + reposListReleases: ReposListReleases + reposCreateRelease: ReposCreateRelease + reposGetReleaseAsset: ReposGetReleaseAsset + reposUpdateReleaseAsset: ReposUpdateReleaseAsset + reposDeleteReleaseAsset: ReposDeleteReleaseAsset + reposGenerateReleaseNotes: ReposGenerateReleaseNotes + reposGetLatestRelease: ReposGetLatestRelease + reposGetReleaseByTag: ReposGetReleaseByTag + reposGetRelease: ReposGetRelease + reposUpdateRelease: ReposUpdateRelease + reposDeleteRelease: ReposDeleteRelease + reposListReleaseAssets: ReposListReleaseAssets + reposUploadReleaseAsset: ReposUploadReleaseAsset + reactionsListForRelease: ReactionsListForRelease + reactionsCreateForRelease: ReactionsCreateForRelease + reactionsDeleteForRelease: ReactionsDeleteForRelease + reposGetBranchRules: ReposGetBranchRules + reposGetRepoRulesets: ReposGetRepoRulesets + reposCreateRepoRuleset: ReposCreateRepoRuleset + reposGetRepoRuleSuites: ReposGetRepoRuleSuites + reposGetRepoRuleSuite: ReposGetRepoRuleSuite + reposGetRepoRuleset: ReposGetRepoRuleset + reposUpdateRepoRuleset: ReposUpdateRepoRuleset + reposDeleteRepoRuleset: ReposDeleteRepoRuleset + reposGetRepoRulesetHistory: ReposGetRepoRulesetHistory + reposGetRepoRulesetVersion: ReposGetRepoRulesetVersion + secretScanningListAlertsForRepo: SecretScanningListAlertsForRepo + secretScanningGetAlert: SecretScanningGetAlert + secretScanningUpdateAlert: SecretScanningUpdateAlert + secretScanningListLocationsForAlert: SecretScanningListLocationsForAlert + secretScanningCreatePushProtectionBypass: SecretScanningCreatePushProtectionBypass + secretScanningGetScanHistory: SecretScanningGetScanHistory + securityAdvisoriesListRepositoryAdvisories: SecurityAdvisoriesListRepositoryAdvisories + securityAdvisoriesCreateRepositoryAdvisory: SecurityAdvisoriesCreateRepositoryAdvisory + securityAdvisoriesCreatePrivateVulnerabilityReport: SecurityAdvisoriesCreatePrivateVulnerabilityReport + securityAdvisoriesGetRepositoryAdvisory: SecurityAdvisoriesGetRepositoryAdvisory + securityAdvisoriesUpdateRepositoryAdvisory: SecurityAdvisoriesUpdateRepositoryAdvisory + securityAdvisoriesCreateRepositoryAdvisoryCveRequest: SecurityAdvisoriesCreateRepositoryAdvisoryCveRequest + securityAdvisoriesCreateFork: SecurityAdvisoriesCreateFork + activityListStargazersForRepo: ActivityListStargazersForRepo + reposGetCodeFrequencyStats: ReposGetCodeFrequencyStats + reposGetCommitActivityStats: ReposGetCommitActivityStats + reposGetContributorsStats: ReposGetContributorsStats + reposGetParticipationStats: ReposGetParticipationStats + reposGetPunchCardStats: ReposGetPunchCardStats + reposCreateCommitStatus: ReposCreateCommitStatus + activityListWatchersForRepo: ActivityListWatchersForRepo + activityGetRepoSubscription: ActivityGetRepoSubscription + activitySetRepoSubscription: ActivitySetRepoSubscription + activityDeleteRepoSubscription: ActivityDeleteRepoSubscription + reposListTags: ReposListTags + reposListTagProtection: ReposListTagProtection + reposCreateTagProtection: ReposCreateTagProtection + reposDeleteTagProtection: ReposDeleteTagProtection + reposDownloadTarballArchive: ReposDownloadTarballArchive + reposListTeams: ReposListTeams + reposGetAllTopics: ReposGetAllTopics + reposReplaceAllTopics: ReposReplaceAllTopics + reposGetClones: ReposGetClones + reposGetTopPaths: ReposGetTopPaths + reposGetTopReferrers: ReposGetTopReferrers + reposGetViews: ReposGetViews + reposTransfer: ReposTransfer + reposCheckVulnerabilityAlerts: ReposCheckVulnerabilityAlerts + reposEnableVulnerabilityAlerts: ReposEnableVulnerabilityAlerts + reposDisableVulnerabilityAlerts: ReposDisableVulnerabilityAlerts + reposDownloadZipballArchive: ReposDownloadZipballArchive + reposCreateUsingTemplate: ReposCreateUsingTemplate + reposListPublic: ReposListPublic + searchCode: SearchCode + searchCommits: SearchCommits + searchIssuesAndPullRequests: SearchIssuesAndPullRequests + searchLabels: SearchLabels + searchRepos: SearchRepos + searchTopics: SearchTopics + searchUsers: SearchUsers + teamsGetLegacy: TeamsGetLegacy + teamsUpdateLegacy: TeamsUpdateLegacy + teamsDeleteLegacy: TeamsDeleteLegacy + teamsListDiscussionsLegacy: TeamsListDiscussionsLegacy + teamsCreateDiscussionLegacy: TeamsCreateDiscussionLegacy + teamsGetDiscussionLegacy: TeamsGetDiscussionLegacy + teamsUpdateDiscussionLegacy: TeamsUpdateDiscussionLegacy + teamsDeleteDiscussionLegacy: TeamsDeleteDiscussionLegacy + teamsListDiscussionCommentsLegacy: TeamsListDiscussionCommentsLegacy + teamsCreateDiscussionCommentLegacy: TeamsCreateDiscussionCommentLegacy + teamsGetDiscussionCommentLegacy: TeamsGetDiscussionCommentLegacy + teamsUpdateDiscussionCommentLegacy: TeamsUpdateDiscussionCommentLegacy + teamsDeleteDiscussionCommentLegacy: TeamsDeleteDiscussionCommentLegacy + reactionsListForTeamDiscussionCommentLegacy: ReactionsListForTeamDiscussionCommentLegacy + reactionsCreateForTeamDiscussionCommentLegacy: ReactionsCreateForTeamDiscussionCommentLegacy + reactionsListForTeamDiscussionLegacy: ReactionsListForTeamDiscussionLegacy + reactionsCreateForTeamDiscussionLegacy: ReactionsCreateForTeamDiscussionLegacy + teamsListPendingInvitationsLegacy: TeamsListPendingInvitationsLegacy + teamsListMembersLegacy: TeamsListMembersLegacy + teamsGetMemberLegacy: TeamsGetMemberLegacy + teamsAddMemberLegacy: TeamsAddMemberLegacy + teamsRemoveMemberLegacy: TeamsRemoveMemberLegacy + teamsGetMembershipForUserLegacy: TeamsGetMembershipForUserLegacy + teamsAddOrUpdateMembershipForUserLegacy: TeamsAddOrUpdateMembershipForUserLegacy + teamsRemoveMembershipForUserLegacy: TeamsRemoveMembershipForUserLegacy + teamsListProjectsLegacy: TeamsListProjectsLegacy + teamsCheckPermissionsForProjectLegacy: TeamsCheckPermissionsForProjectLegacy + teamsAddOrUpdateProjectPermissionsLegacy: TeamsAddOrUpdateProjectPermissionsLegacy + teamsRemoveProjectLegacy: TeamsRemoveProjectLegacy + teamsListReposLegacy: TeamsListReposLegacy + teamsCheckPermissionsForRepoLegacy: TeamsCheckPermissionsForRepoLegacy + teamsAddOrUpdateRepoPermissionsLegacy: TeamsAddOrUpdateRepoPermissionsLegacy + teamsRemoveRepoLegacy: TeamsRemoveRepoLegacy + teamsListChildLegacy: TeamsListChildLegacy + usersGetAuthenticated: UsersGetAuthenticated + usersUpdateAuthenticated: UsersUpdateAuthenticated + usersListBlockedByAuthenticatedUser: UsersListBlockedByAuthenticatedUser + usersCheckBlocked: UsersCheckBlocked + usersBlock: UsersBlock + usersUnblock: UsersUnblock + codespacesListForAuthenticatedUser: CodespacesListForAuthenticatedUser + codespacesCreateForAuthenticatedUser: CodespacesCreateForAuthenticatedUser + codespacesListSecretsForAuthenticatedUser: CodespacesListSecretsForAuthenticatedUser + codespacesGetPublicKeyForAuthenticatedUser: CodespacesGetPublicKeyForAuthenticatedUser + codespacesGetSecretForAuthenticatedUser: CodespacesGetSecretForAuthenticatedUser + codespacesCreateOrUpdateSecretForAuthenticatedUser: CodespacesCreateOrUpdateSecretForAuthenticatedUser + codespacesDeleteSecretForAuthenticatedUser: CodespacesDeleteSecretForAuthenticatedUser + codespacesListRepositoriesForSecretForAuthenticatedUser: CodespacesListRepositoriesForSecretForAuthenticatedUser + codespacesSetRepositoriesForSecretForAuthenticatedUser: CodespacesSetRepositoriesForSecretForAuthenticatedUser + codespacesAddRepositoryForSecretForAuthenticatedUser: CodespacesAddRepositoryForSecretForAuthenticatedUser + codespacesRemoveRepositoryForSecretForAuthenticatedUser: CodespacesRemoveRepositoryForSecretForAuthenticatedUser + codespacesGetForAuthenticatedUser: CodespacesGetForAuthenticatedUser + codespacesUpdateForAuthenticatedUser: CodespacesUpdateForAuthenticatedUser + codespacesDeleteForAuthenticatedUser: CodespacesDeleteForAuthenticatedUser + codespacesExportForAuthenticatedUser: CodespacesExportForAuthenticatedUser + codespacesGetExportDetailsForAuthenticatedUser: CodespacesGetExportDetailsForAuthenticatedUser + codespacesCodespaceMachinesForAuthenticatedUser: CodespacesCodespaceMachinesForAuthenticatedUser + codespacesPublishForAuthenticatedUser: CodespacesPublishForAuthenticatedUser + codespacesStartForAuthenticatedUser: CodespacesStartForAuthenticatedUser + codespacesStopForAuthenticatedUser: CodespacesStopForAuthenticatedUser + packagesListDockerMigrationConflictingPackagesForAuthenticatedUser: PackagesListDockerMigrationConflictingPackagesForAuthenticatedUser + usersSetPrimaryEmailVisibilityForAuthenticatedUser: UsersSetPrimaryEmailVisibilityForAuthenticatedUser + usersListEmailsForAuthenticatedUser: UsersListEmailsForAuthenticatedUser + usersAddEmailForAuthenticatedUser: UsersAddEmailForAuthenticatedUser + usersDeleteEmailForAuthenticatedUser: UsersDeleteEmailForAuthenticatedUser + usersListFollowersForAuthenticatedUser: UsersListFollowersForAuthenticatedUser + usersListFollowedByAuthenticatedUser: UsersListFollowedByAuthenticatedUser + usersCheckPersonIsFollowedByAuthenticated: UsersCheckPersonIsFollowedByAuthenticated + usersFollow: UsersFollow + usersUnfollow: UsersUnfollow + usersListGpgKeysForAuthenticatedUser: UsersListGpgKeysForAuthenticatedUser + usersCreateGpgKeyForAuthenticatedUser: UsersCreateGpgKeyForAuthenticatedUser + usersGetGpgKeyForAuthenticatedUser: UsersGetGpgKeyForAuthenticatedUser + usersDeleteGpgKeyForAuthenticatedUser: UsersDeleteGpgKeyForAuthenticatedUser + appsListInstallationsForAuthenticatedUser: AppsListInstallationsForAuthenticatedUser + appsListInstallationReposForAuthenticatedUser: AppsListInstallationReposForAuthenticatedUser + appsAddRepoToInstallationForAuthenticatedUser: AppsAddRepoToInstallationForAuthenticatedUser + appsRemoveRepoFromInstallationForAuthenticatedUser: AppsRemoveRepoFromInstallationForAuthenticatedUser + interactionsGetRestrictionsForAuthenticatedUser: InteractionsGetRestrictionsForAuthenticatedUser + interactionsSetRestrictionsForAuthenticatedUser: InteractionsSetRestrictionsForAuthenticatedUser + interactionsRemoveRestrictionsForAuthenticatedUser: InteractionsRemoveRestrictionsForAuthenticatedUser + issuesListForAuthenticatedUser: IssuesListForAuthenticatedUser + usersListPublicSshKeysForAuthenticatedUser: UsersListPublicSshKeysForAuthenticatedUser + usersCreatePublicSshKeyForAuthenticatedUser: UsersCreatePublicSshKeyForAuthenticatedUser + usersGetPublicSshKeyForAuthenticatedUser: UsersGetPublicSshKeyForAuthenticatedUser + usersDeletePublicSshKeyForAuthenticatedUser: UsersDeletePublicSshKeyForAuthenticatedUser + appsListSubscriptionsForAuthenticatedUser: AppsListSubscriptionsForAuthenticatedUser + appsListSubscriptionsForAuthenticatedUserStubbed: AppsListSubscriptionsForAuthenticatedUserStubbed + orgsListMembershipsForAuthenticatedUser: OrgsListMembershipsForAuthenticatedUser + orgsGetMembershipForAuthenticatedUser: OrgsGetMembershipForAuthenticatedUser + orgsUpdateMembershipForAuthenticatedUser: OrgsUpdateMembershipForAuthenticatedUser + migrationsListForAuthenticatedUser: MigrationsListForAuthenticatedUser + migrationsStartForAuthenticatedUser: MigrationsStartForAuthenticatedUser + migrationsGetStatusForAuthenticatedUser: MigrationsGetStatusForAuthenticatedUser + migrationsGetArchiveForAuthenticatedUser: MigrationsGetArchiveForAuthenticatedUser + migrationsDeleteArchiveForAuthenticatedUser: MigrationsDeleteArchiveForAuthenticatedUser + migrationsUnlockRepoForAuthenticatedUser: MigrationsUnlockRepoForAuthenticatedUser + migrationsListReposForAuthenticatedUser: MigrationsListReposForAuthenticatedUser + orgsListForAuthenticatedUser: OrgsListForAuthenticatedUser + packagesListPackagesForAuthenticatedUser: PackagesListPackagesForAuthenticatedUser + packagesGetPackageForAuthenticatedUser: PackagesGetPackageForAuthenticatedUser + packagesDeletePackageForAuthenticatedUser: PackagesDeletePackageForAuthenticatedUser + packagesRestorePackageForAuthenticatedUser: PackagesRestorePackageForAuthenticatedUser + packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUser: PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUser + packagesGetPackageVersionForAuthenticatedUser: PackagesGetPackageVersionForAuthenticatedUser + packagesDeletePackageVersionForAuthenticatedUser: PackagesDeletePackageVersionForAuthenticatedUser + packagesRestorePackageVersionForAuthenticatedUser: PackagesRestorePackageVersionForAuthenticatedUser + projectsCreateForAuthenticatedUser: ProjectsCreateForAuthenticatedUser + usersListPublicEmailsForAuthenticatedUser: UsersListPublicEmailsForAuthenticatedUser + reposListForAuthenticatedUser: ReposListForAuthenticatedUser + reposCreateForAuthenticatedUser: ReposCreateForAuthenticatedUser + reposListInvitationsForAuthenticatedUser: ReposListInvitationsForAuthenticatedUser + reposAcceptInvitationForAuthenticatedUser: ReposAcceptInvitationForAuthenticatedUser + reposDeclineInvitationForAuthenticatedUser: ReposDeclineInvitationForAuthenticatedUser + usersListSocialAccountsForAuthenticatedUser: UsersListSocialAccountsForAuthenticatedUser + usersAddSocialAccountForAuthenticatedUser: UsersAddSocialAccountForAuthenticatedUser + usersDeleteSocialAccountForAuthenticatedUser: UsersDeleteSocialAccountForAuthenticatedUser + usersListSshSigningKeysForAuthenticatedUser: UsersListSshSigningKeysForAuthenticatedUser + usersCreateSshSigningKeyForAuthenticatedUser: UsersCreateSshSigningKeyForAuthenticatedUser + usersGetSshSigningKeyForAuthenticatedUser: UsersGetSshSigningKeyForAuthenticatedUser + usersDeleteSshSigningKeyForAuthenticatedUser: UsersDeleteSshSigningKeyForAuthenticatedUser + activityListReposStarredByAuthenticatedUser: ActivityListReposStarredByAuthenticatedUser + activityCheckRepoIsStarredByAuthenticatedUser: ActivityCheckRepoIsStarredByAuthenticatedUser + activityStarRepoForAuthenticatedUser: ActivityStarRepoForAuthenticatedUser + activityUnstarRepoForAuthenticatedUser: ActivityUnstarRepoForAuthenticatedUser + activityListWatchedReposForAuthenticatedUser: ActivityListWatchedReposForAuthenticatedUser + teamsListForAuthenticatedUser: TeamsListForAuthenticatedUser + usersGetById: UsersGetById + usersList: UsersList + usersGetByUsername: UsersGetByUsername + usersListAttestations: UsersListAttestations + packagesListDockerMigrationConflictingPackagesForUser: PackagesListDockerMigrationConflictingPackagesForUser + activityListEventsForAuthenticatedUser: ActivityListEventsForAuthenticatedUser + activityListOrgEventsForAuthenticatedUser: ActivityListOrgEventsForAuthenticatedUser + activityListPublicEventsForUser: ActivityListPublicEventsForUser + usersListFollowersForUser: UsersListFollowersForUser + usersListFollowingForUser: UsersListFollowingForUser + usersCheckFollowingForUser: UsersCheckFollowingForUser + gistsListForUser: GistsListForUser + usersListGpgKeysForUser: UsersListGpgKeysForUser + usersGetContextForUser: UsersGetContextForUser + appsGetUserInstallation: AppsGetUserInstallation + usersListPublicKeysForUser: UsersListPublicKeysForUser + orgsListForUser: OrgsListForUser + packagesListPackagesForUser: PackagesListPackagesForUser + packagesGetPackageForUser: PackagesGetPackageForUser + packagesDeletePackageForUser: PackagesDeletePackageForUser + packagesRestorePackageForUser: PackagesRestorePackageForUser + packagesGetAllPackageVersionsForPackageOwnedByUser: PackagesGetAllPackageVersionsForPackageOwnedByUser + packagesGetPackageVersionForUser: PackagesGetPackageVersionForUser + packagesDeletePackageVersionForUser: PackagesDeletePackageVersionForUser + packagesRestorePackageVersionForUser: PackagesRestorePackageVersionForUser + projectsListForUser: ProjectsListForUser + activityListReceivedEventsForUser: ActivityListReceivedEventsForUser + activityListReceivedPublicEventsForUser: ActivityListReceivedPublicEventsForUser + reposListForUser: ReposListForUser + billingGetGithubActionsBillingUser: BillingGetGithubActionsBillingUser + billingGetGithubPackagesBillingUser: BillingGetGithubPackagesBillingUser + billingGetSharedStorageBillingUser: BillingGetSharedStorageBillingUser + usersListSocialAccountsForUser: UsersListSocialAccountsForUser + usersListSshSigningKeysForUser: UsersListSshSigningKeysForUser + activityListReposStarredByUser: ActivityListReposStarredByUser + activityListReposWatchedByUser: ActivityListReposWatchedByUser + metaGetAllVersions: MetaGetAllVersions + metaGetZen: MetaGetZen +} + +export function createRouter(implementation: Implementation): Router { + const router = Router() + + const metaRootResponseBodyValidator = responseValidationFactory( + [["200", s_root]], + undefined, + ) + + // metaRoot + router.get(`/`, async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .metaRoot(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(metaRootResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }) + + const securityAdvisoriesListGlobalAdvisoriesQuerySchema = z.object({ + ghsa_id: z.string().optional(), + type: z + .enum(["reviewed", "malware", "unreviewed"]) + .optional() + .default("reviewed"), + cve_id: z.string().optional(), + ecosystem: s_security_advisory_ecosystems.optional(), + severity: z + .enum(["unknown", "low", "medium", "high", "critical"]) + .optional(), + cwes: z.union([z.string(), z.array(z.string())]).optional(), + is_withdrawn: PermissiveBoolean.optional(), + affects: z.union([z.string(), z.array(z.string()).max(1000)]).optional(), + published: z.string().optional(), + updated: z.string().optional(), + modified: z.string().optional(), + epss_percentage: z.string().optional(), + epss_percentile: z.string().optional(), + before: z.string().optional(), + after: z.string().optional(), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().min(1).max(100).optional().default(30), + sort: z + .enum(["updated", "published", "epss_percentage", "epss_percentile"]) + .optional() + .default("published"), + }) + + const securityAdvisoriesListGlobalAdvisoriesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_global_advisory)], + ["422", s_validation_error_simple], + ["429", s_basic_error], + ], + undefined, + ) + + // securityAdvisoriesListGlobalAdvisories + router.get( + `/advisories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + securityAdvisoriesListGlobalAdvisoriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesListGlobalAdvisories( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesListGlobalAdvisoriesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesGetGlobalAdvisoryParamSchema = z.object({ + ghsa_id: z.string(), + }) + + const securityAdvisoriesGetGlobalAdvisoryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_global_advisory], + ["404", s_basic_error], + ], + undefined, + ) + + // securityAdvisoriesGetGlobalAdvisory + router.get( + `/advisories/:ghsa_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesGetGlobalAdvisoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesGetGlobalAdvisory(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesGetGlobalAdvisoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetAuthenticatedResponseBodyValidator = responseValidationFactory( + [["200", s_integration]], + undefined, + ) + + // appsGetAuthenticated + router.get( + `/app`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetAuthenticated(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsGetAuthenticatedResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsCreateFromManifestParamSchema = z.object({ code: z.string() }) + + const appsCreateFromManifestResponseBodyValidator = responseValidationFactory( + [ + [ + "201", + z.intersection( + s_integration, + z.intersection( + z.object({ + client_id: z.string(), + client_secret: z.string(), + webhook_secret: z.string().nullable(), + pem: z.string(), + }), + z.record(z.unknown()), + ), + ), + ], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // appsCreateFromManifest + router.post( + `/app-manifests/:code/conversions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsCreateFromManifestParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse< + t_integration & { + client_id: string + client_secret: string + pem: string + webhook_secret: string | null + [key: string]: unknown | undefined + } + >(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsCreateFromManifest(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsCreateFromManifestResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetWebhookConfigForAppResponseBodyValidator = + responseValidationFactory([["200", s_webhook_config]], undefined) + + // appsGetWebhookConfigForApp + router.get( + `/app/hook/config`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetWebhookConfigForApp(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsGetWebhookConfigForAppResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsUpdateWebhookConfigForAppRequestBodySchema = z.object({ + url: s_webhook_config_url.optional(), + content_type: s_webhook_config_content_type.optional(), + secret: s_webhook_config_secret.optional(), + insecure_ssl: s_webhook_config_insecure_ssl.optional(), + }) + + const appsUpdateWebhookConfigForAppResponseBodyValidator = + responseValidationFactory([["200", s_webhook_config]], undefined) + + // appsUpdateWebhookConfigForApp + router.patch( + `/app/hook/config`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + appsUpdateWebhookConfigForAppRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsUpdateWebhookConfigForApp(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsUpdateWebhookConfigForAppResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListWebhookDeliveriesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + cursor: z.string().optional(), + }) + + const appsListWebhookDeliveriesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_hook_delivery_item)], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // appsListWebhookDeliveries + router.get( + `/app/hook/deliveries`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListWebhookDeliveriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListWebhookDeliveries(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsListWebhookDeliveriesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetWebhookDeliveryParamSchema = z.object({ + delivery_id: z.coerce.number(), + }) + + const appsGetWebhookDeliveryResponseBodyValidator = responseValidationFactory( + [ + ["200", s_hook_delivery], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // appsGetWebhookDelivery + router.get( + `/app/hook/deliveries/:delivery_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsGetWebhookDeliveryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetWebhookDelivery(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsGetWebhookDeliveryResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsRedeliverWebhookDeliveryParamSchema = z.object({ + delivery_id: z.coerce.number(), + }) + + const appsRedeliverWebhookDeliveryResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // appsRedeliverWebhookDelivery + router.post( + `/app/hook/deliveries/:delivery_id/attempts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsRedeliverWebhookDeliveryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsRedeliverWebhookDelivery(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsRedeliverWebhookDeliveryResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListInstallationRequestsForAuthenticatedAppQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListInstallationRequestsForAuthenticatedAppResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_integration_installation_request)], + ["304", z.undefined()], + ["401", s_basic_error], + ], + undefined, + ) + + // appsListInstallationRequestsForAuthenticatedApp + router.get( + `/app/installation-requests`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListInstallationRequestsForAuthenticatedAppQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_integration_installation_request[] + >(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListInstallationRequestsForAuthenticatedApp( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsListInstallationRequestsForAuthenticatedAppResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListInstallationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + since: z.string().datetime({ offset: true }).optional(), + outdated: z.string().optional(), + }) + + const appsListInstallationsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_installation)]], + undefined, + ) + + // appsListInstallations + router.get( + `/app/installations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListInstallationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListInstallations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsListInstallationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetInstallationParamSchema = z.object({ + installation_id: z.coerce.number(), + }) + + const appsGetInstallationResponseBodyValidator = responseValidationFactory( + [ + ["200", s_installation], + ["404", s_basic_error], + ], + undefined, + ) + + // appsGetInstallation + router.get( + `/app/installations/:installation_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsGetInstallationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetInstallation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsGetInstallationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsDeleteInstallationParamSchema = z.object({ + installation_id: z.coerce.number(), + }) + + const appsDeleteInstallationResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // appsDeleteInstallation + router.delete( + `/app/installations/:installation_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsDeleteInstallationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsDeleteInstallation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsDeleteInstallationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsCreateInstallationAccessTokenParamSchema = z.object({ + installation_id: z.coerce.number(), + }) + + const appsCreateInstallationAccessTokenRequestBodySchema = z + .object({ + repositories: z.array(z.string()).optional(), + repository_ids: z.array(z.coerce.number()).optional(), + permissions: s_app_permissions.optional(), + }) + .optional() + + const appsCreateInstallationAccessTokenResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_installation_token], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // appsCreateInstallationAccessToken + router.post( + `/app/installations/:installation_id/access_tokens`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsCreateInstallationAccessTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + appsCreateInstallationAccessTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsCreateInstallationAccessToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsCreateInstallationAccessTokenResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsSuspendInstallationParamSchema = z.object({ + installation_id: z.coerce.number(), + }) + + const appsSuspendInstallationResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // appsSuspendInstallation + router.put( + `/app/installations/:installation_id/suspended`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsSuspendInstallationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsSuspendInstallation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsSuspendInstallationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsUnsuspendInstallationParamSchema = z.object({ + installation_id: z.coerce.number(), + }) + + const appsUnsuspendInstallationResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // appsUnsuspendInstallation + router.delete( + `/app/installations/:installation_id/suspended`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsUnsuspendInstallationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsUnsuspendInstallation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsUnsuspendInstallationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsDeleteAuthorizationParamSchema = z.object({ client_id: z.string() }) + + const appsDeleteAuthorizationRequestBodySchema = z.object({ + access_token: z.string(), + }) + + const appsDeleteAuthorizationResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // appsDeleteAuthorization + router.delete( + `/applications/:client_id/grant`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsDeleteAuthorizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + appsDeleteAuthorizationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsDeleteAuthorization(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsDeleteAuthorizationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsCheckTokenParamSchema = z.object({ client_id: z.string() }) + + const appsCheckTokenRequestBodySchema = z.object({ access_token: z.string() }) + + const appsCheckTokenResponseBodyValidator = responseValidationFactory( + [ + ["200", s_authorization], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // appsCheckToken + router.post( + `/applications/:client_id/token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsCheckTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + appsCheckTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsCheckToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsCheckTokenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsResetTokenParamSchema = z.object({ client_id: z.string() }) + + const appsResetTokenRequestBodySchema = z.object({ access_token: z.string() }) + + const appsResetTokenResponseBodyValidator = responseValidationFactory( + [ + ["200", s_authorization], + ["422", s_validation_error], + ], + undefined, + ) + + // appsResetToken + router.patch( + `/applications/:client_id/token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsResetTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + appsResetTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsResetToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsResetTokenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsDeleteTokenParamSchema = z.object({ client_id: z.string() }) + + const appsDeleteTokenRequestBodySchema = z.object({ + access_token: z.string(), + }) + + const appsDeleteTokenResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // appsDeleteToken + router.delete( + `/applications/:client_id/token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsDeleteTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + appsDeleteTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsDeleteToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsDeleteTokenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsScopeTokenParamSchema = z.object({ client_id: z.string() }) + + const appsScopeTokenRequestBodySchema = z.object({ + access_token: z.string(), + target: z.string().optional(), + target_id: z.coerce.number().optional(), + repositories: z.array(z.string()).optional(), + repository_ids: z.array(z.coerce.number()).optional(), + permissions: s_app_permissions.optional(), + }) + + const appsScopeTokenResponseBodyValidator = responseValidationFactory( + [ + ["200", s_authorization], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // appsScopeToken + router.post( + `/applications/:client_id/token/scoped`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsScopeTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + appsScopeTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsScopeToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsScopeTokenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetBySlugParamSchema = z.object({ app_slug: z.string() }) + + const appsGetBySlugResponseBodyValidator = responseValidationFactory( + [ + ["200", s_integration], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // appsGetBySlug + router.get( + `/apps/:app_slug`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsGetBySlugParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetBySlug(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsGetBySlugResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const classroomGetAnAssignmentParamSchema = z.object({ + assignment_id: z.coerce.number(), + }) + + const classroomGetAnAssignmentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_classroom_assignment], + ["404", s_basic_error], + ], + undefined, + ) + + // classroomGetAnAssignment + router.get( + `/assignments/:assignment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + classroomGetAnAssignmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .classroomGetAnAssignment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(classroomGetAnAssignmentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const classroomListAcceptedAssignmentsForAnAssignmentParamSchema = z.object({ + assignment_id: z.coerce.number(), + }) + + const classroomListAcceptedAssignmentsForAnAssignmentQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const classroomListAcceptedAssignmentsForAnAssignmentResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_classroom_accepted_assignment)]], + undefined, + ) + + // classroomListAcceptedAssignmentsForAnAssignment + router.get( + `/assignments/:assignment_id/accepted_assignments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + classroomListAcceptedAssignmentsForAnAssignmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + classroomListAcceptedAssignmentsForAnAssignmentQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_classroom_accepted_assignment[] + >(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .classroomListAcceptedAssignmentsForAnAssignment( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + classroomListAcceptedAssignmentsForAnAssignmentResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const classroomGetAssignmentGradesParamSchema = z.object({ + assignment_id: z.coerce.number(), + }) + + const classroomGetAssignmentGradesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_classroom_assignment_grade)], + ["404", s_basic_error], + ], + undefined, + ) + + // classroomGetAssignmentGrades + router.get( + `/assignments/:assignment_id/grades`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + classroomGetAssignmentGradesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .classroomGetAssignmentGrades(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + classroomGetAssignmentGradesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const classroomListClassroomsQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const classroomListClassroomsResponseBodyValidator = + responseValidationFactory([["200", z.array(s_simple_classroom)]], undefined) + + // classroomListClassrooms + router.get( + `/classrooms`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + classroomListClassroomsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .classroomListClassrooms(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(classroomListClassroomsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const classroomGetAClassroomParamSchema = z.object({ + classroom_id: z.coerce.number(), + }) + + const classroomGetAClassroomResponseBodyValidator = responseValidationFactory( + [ + ["200", s_classroom], + ["404", s_basic_error], + ], + undefined, + ) + + // classroomGetAClassroom + router.get( + `/classrooms/:classroom_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + classroomGetAClassroomParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .classroomGetAClassroom(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(classroomGetAClassroomResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const classroomListAssignmentsForAClassroomParamSchema = z.object({ + classroom_id: z.coerce.number(), + }) + + const classroomListAssignmentsForAClassroomQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const classroomListAssignmentsForAClassroomResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_simple_classroom_assignment)]], + undefined, + ) + + // classroomListAssignmentsForAClassroom + router.get( + `/classrooms/:classroom_id/assignments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + classroomListAssignmentsForAClassroomParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + classroomListAssignmentsForAClassroomQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .classroomListAssignmentsForAClassroom( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + classroomListAssignmentsForAClassroomResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codesOfConductGetAllCodesOfConductResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_of_conduct)], + ["304", z.undefined()], + ], + undefined, + ) + + // codesOfConductGetAllCodesOfConduct + router.get( + `/codes_of_conduct`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codesOfConductGetAllCodesOfConduct(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codesOfConductGetAllCodesOfConductResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codesOfConductGetConductCodeParamSchema = z.object({ key: z.string() }) + + const codesOfConductGetConductCodeResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_of_conduct], + ["304", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // codesOfConductGetConductCode + router.get( + `/codes_of_conduct/:key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codesOfConductGetConductCodeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codesOfConductGetConductCode(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codesOfConductGetConductCodeResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const emojisGetResponseBodyValidator = responseValidationFactory( + [ + ["200", z.record(z.string())], + ["304", z.undefined()], + ], + undefined, + ) + + // emojisGet + router.get( + `/emojis`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + [key: string]: string | undefined + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .emojisGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(emojisGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetConfigurationsForEnterpriseParamSchema = z.object({ + enterprise: z.string(), + }) + + const codeSecurityGetConfigurationsForEnterpriseQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + }) + + const codeSecurityGetConfigurationsForEnterpriseResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_security_configuration)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityGetConfigurationsForEnterprise + router.get( + `/enterprises/:enterprise/code-security/configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetConfigurationsForEnterpriseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeSecurityGetConfigurationsForEnterpriseQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetConfigurationsForEnterprise( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetConfigurationsForEnterpriseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityCreateConfigurationForEnterpriseParamSchema = z.object({ + enterprise: z.string(), + }) + + const codeSecurityCreateConfigurationForEnterpriseRequestBodySchema = + z.object({ + name: z.string(), + description: z.string().max(255), + advanced_security: z + .enum(["enabled", "disabled", "code_security", "secret_protection"]) + .optional() + .default("disabled"), + dependency_graph: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("enabled"), + dependency_graph_autosubmit_action: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + dependency_graph_autosubmit_action_options: z + .object({ + labeled_runners: PermissiveBoolean.optional().default(false), + }) + .optional(), + dependabot_alerts: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + dependabot_security_updates: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + code_scanning_default_setup: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + code_scanning_default_setup_options: + s_code_scanning_default_setup_options.optional(), + code_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_push_protection: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_validity_checks: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_non_provider_patterns: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_generic_secrets: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + private_vulnerability_reporting: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + enforcement: z + .enum(["enforced", "unenforced"]) + .optional() + .default("enforced"), + }) + + const codeSecurityCreateConfigurationForEnterpriseResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_code_security_configuration], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityCreateConfigurationForEnterprise + router.post( + `/enterprises/:enterprise/code-security/configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityCreateConfigurationForEnterpriseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecurityCreateConfigurationForEnterpriseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse( + 201, + ) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityCreateConfigurationForEnterprise( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityCreateConfigurationForEnterpriseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetDefaultConfigurationsForEnterpriseParamSchema = z.object( + { enterprise: z.string() }, + ) + + const codeSecurityGetDefaultConfigurationsForEnterpriseResponseBodyValidator = + responseValidationFactory( + [["200", s_code_security_default_configurations]], + undefined, + ) + + // codeSecurityGetDefaultConfigurationsForEnterprise + router.get( + `/enterprises/:enterprise/code-security/configurations/defaults`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetDefaultConfigurationsForEnterpriseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetDefaultConfigurationsForEnterprise( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetDefaultConfigurationsForEnterpriseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetSingleConfigurationForEnterpriseParamSchema = z.object({ + enterprise: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityGetSingleConfigurationForEnterpriseResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_security_configuration], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityGetSingleConfigurationForEnterprise + router.get( + `/enterprises/:enterprise/code-security/configurations/:configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetSingleConfigurationForEnterpriseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetSingleConfigurationForEnterprise( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetSingleConfigurationForEnterpriseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityUpdateEnterpriseConfigurationParamSchema = z.object({ + enterprise: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityUpdateEnterpriseConfigurationRequestBodySchema = z.object({ + name: z.string().optional(), + description: z.string().max(255).optional(), + advanced_security: z + .enum(["enabled", "disabled", "code_security", "secret_protection"]) + .optional(), + dependency_graph: z.enum(["enabled", "disabled", "not_set"]).optional(), + dependency_graph_autosubmit_action: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + dependency_graph_autosubmit_action_options: z + .object({ labeled_runners: PermissiveBoolean.optional() }) + .optional(), + dependabot_alerts: z.enum(["enabled", "disabled", "not_set"]).optional(), + dependabot_security_updates: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + code_scanning_default_setup: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + code_scanning_default_setup_options: + s_code_scanning_default_setup_options.optional(), + code_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning: z.enum(["enabled", "disabled", "not_set"]).optional(), + secret_scanning_push_protection: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_validity_checks: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_non_provider_patterns: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_generic_secrets: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + private_vulnerability_reporting: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + enforcement: z.enum(["enforced", "unenforced"]).optional(), + }) + + const codeSecurityUpdateEnterpriseConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_security_configuration], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // codeSecurityUpdateEnterpriseConfiguration + router.patch( + `/enterprises/:enterprise/code-security/configurations/:configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityUpdateEnterpriseConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecurityUpdateEnterpriseConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityUpdateEnterpriseConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityUpdateEnterpriseConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityDeleteConfigurationForEnterpriseParamSchema = z.object({ + enterprise: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityDeleteConfigurationForEnterpriseResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // codeSecurityDeleteConfigurationForEnterprise + router.delete( + `/enterprises/:enterprise/code-security/configurations/:configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityDeleteConfigurationForEnterpriseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityDeleteConfigurationForEnterprise( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityDeleteConfigurationForEnterpriseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityAttachEnterpriseConfigurationParamSchema = z.object({ + enterprise: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityAttachEnterpriseConfigurationRequestBodySchema = z.object({ + scope: z.enum(["all", "all_without_configurations"]), + }) + + const codeSecurityAttachEnterpriseConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // codeSecurityAttachEnterpriseConfiguration + router.post( + `/enterprises/:enterprise/code-security/configurations/:configuration_id/attach`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityAttachEnterpriseConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecurityAttachEnterpriseConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityAttachEnterpriseConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityAttachEnterpriseConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecuritySetConfigurationAsDefaultForEnterpriseParamSchema = + z.object({ enterprise: z.string(), configuration_id: z.coerce.number() }) + + const codeSecuritySetConfigurationAsDefaultForEnterpriseRequestBodySchema = + z.object({ + default_for_new_repos: z + .enum(["all", "none", "private_and_internal", "public"]) + .optional(), + }) + + const codeSecuritySetConfigurationAsDefaultForEnterpriseResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + default_for_new_repos: z + .enum(["all", "none", "private_and_internal", "public"]) + .optional(), + configuration: s_code_security_configuration.optional(), + }), + ], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecuritySetConfigurationAsDefaultForEnterprise + router.put( + `/enterprises/:enterprise/code-security/configurations/:configuration_id/defaults`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecuritySetConfigurationAsDefaultForEnterpriseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecuritySetConfigurationAsDefaultForEnterpriseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + configuration?: t_code_security_configuration | undefined + default_for_new_repos?: + | ("all" | "none" | "private_and_internal" | "public") + | undefined + }>(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecuritySetConfigurationAsDefaultForEnterprise( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecuritySetConfigurationAsDefaultForEnterpriseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetRepositoriesForEnterpriseConfigurationParamSchema = + z.object({ enterprise: z.string(), configuration_id: z.coerce.number() }) + + const codeSecurityGetRepositoriesForEnterpriseConfigurationQuerySchema = + z.object({ + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + status: z.string().optional().default("all"), + }) + + const codeSecurityGetRepositoriesForEnterpriseConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_security_configuration_repositories)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityGetRepositoriesForEnterpriseConfiguration + router.get( + `/enterprises/:enterprise/code-security/configurations/:configuration_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetRepositoriesForEnterpriseConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeSecurityGetRepositoriesForEnterpriseConfigurationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_code_security_configuration_repositories[] + >(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetRepositoriesForEnterpriseConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetRepositoriesForEnterpriseConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotListAlertsForEnterpriseParamSchema = z.object({ + enterprise: z.string(), + }) + + const dependabotListAlertsForEnterpriseQuerySchema = z.object({ + state: z.string().optional(), + severity: z.string().optional(), + ecosystem: z.string().optional(), + package: z.string().optional(), + epss_percentage: z.string().optional(), + scope: z.enum(["development", "runtime"]).optional(), + sort: z + .enum(["created", "updated", "epss_percentage"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + before: z.string().optional(), + after: z.string().optional(), + first: z.coerce.number().min(1).max(100).optional().default(30), + last: z.coerce.number().min(1).max(100).optional(), + per_page: z.coerce.number().optional().default(30), + }) + + const dependabotListAlertsForEnterpriseResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_dependabot_alert_with_repository)], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // dependabotListAlertsForEnterprise + router.get( + `/enterprises/:enterprise/dependabot/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotListAlertsForEnterpriseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + dependabotListAlertsForEnterpriseQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_dependabot_alert_with_repository[] + >(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotListAlertsForEnterprise(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotListAlertsForEnterpriseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const secretScanningListAlertsForEnterpriseParamSchema = z.object({ + enterprise: z.string(), + }) + + const secretScanningListAlertsForEnterpriseQuerySchema = z.object({ + state: z.enum(["open", "resolved"]).optional(), + secret_type: z.string().optional(), + resolution: z.string().optional(), + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + validity: z.string().optional(), + is_publicly_leaked: PermissiveBoolean.optional().default(false), + is_multi_repo: PermissiveBoolean.optional().default(false), + }) + + const secretScanningListAlertsForEnterpriseResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_organization_secret_scanning_alert)], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // secretScanningListAlertsForEnterprise + router.get( + `/enterprises/:enterprise/secret-scanning/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + secretScanningListAlertsForEnterpriseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + secretScanningListAlertsForEnterpriseQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_organization_secret_scanning_alert[] + >(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .secretScanningListAlertsForEnterprise( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + secretScanningListAlertsForEnterpriseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListPublicEventsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListPublicEventsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_event)], + ["304", z.undefined()], + ["403", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // activityListPublicEvents + router.get( + `/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + activityListPublicEventsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListPublicEvents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(activityListPublicEventsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityGetFeedsResponseBodyValidator = responseValidationFactory( + [["200", s_feed]], + undefined, + ) + + // activityGetFeeds + router.get( + `/feeds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityGetFeeds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(activityGetFeedsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsListQuerySchema = z.object({ + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const gistsListResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_base_gist)], + ["304", z.undefined()], + ["403", s_basic_error], + ], + undefined, + ) + + // gistsList + router.get( + `/gists`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + gistsListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsListResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsCreateRequestBodySchema = z.object({ + description: z.string().optional(), + files: z.record(z.object({ content: z.string() })), + public: z + .union([ + PermissiveBoolean.default(false), + z.enum(["true", "false"]).default("false"), + ]) + .optional(), + }) + + const gistsCreateResponseBodyValidator = responseValidationFactory( + [ + ["201", s_gist_simple], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gistsCreate + router.post( + `/gists`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + gistsCreateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsCreate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsCreateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsListPublicQuerySchema = z.object({ + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const gistsListPublicResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_base_gist)], + ["304", z.undefined()], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gistsListPublic + router.get( + `/gists/public`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + gistsListPublicQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsListPublic(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsListPublicResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsListStarredQuerySchema = z.object({ + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const gistsListStarredResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_base_gist)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // gistsListStarred + router.get( + `/gists/starred`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + gistsListStarredQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsListStarred(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsListStarredResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsGetParamSchema = z.object({ gist_id: z.string() }) + + const gistsGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_gist_simple], + ["304", z.undefined()], + [ + "403", + z.object({ + block: z + .object({ + reason: z.string().optional(), + created_at: z.string().optional(), + html_url: z.string().nullable().optional(), + }) + .optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsGet + router.get( + `/gists/:gist_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse<{ + block?: + | { + created_at?: string | undefined + html_url?: (string | null) | undefined + reason?: string | undefined + } + | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsUpdateParamSchema = z.object({ gist_id: z.string() }) + + const gistsUpdateRequestBodySchema = z + .object({ + description: z.string().optional(), + files: z + .record( + z + .object({ + content: z.string().optional(), + filename: z.string().nullable().optional(), + }) + .nullable(), + ) + .optional(), + }) + .nullable() + + const gistsUpdateResponseBodyValidator = responseValidationFactory( + [ + ["200", s_gist_simple], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gistsUpdate + router.patch( + `/gists/:gist_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gistsUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsDeleteParamSchema = z.object({ gist_id: z.string() }) + + const gistsDeleteResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsDelete + router.delete( + `/gists/:gist_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsDeleteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsDelete(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsDeleteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsListCommentsParamSchema = z.object({ gist_id: z.string() }) + + const gistsListCommentsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const gistsListCommentsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_gist_comment)], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsListComments + router.get( + `/gists/:gist_id/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsListCommentsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + gistsListCommentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsListComments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsListCommentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsCreateCommentParamSchema = z.object({ gist_id: z.string() }) + + const gistsCreateCommentRequestBodySchema = z.object({ + body: z.string().max(65535), + }) + + const gistsCreateCommentResponseBodyValidator = responseValidationFactory( + [ + ["201", s_gist_comment], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsCreateComment + router.post( + `/gists/:gist_id/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsCreateCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gistsCreateCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsCreateComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsCreateCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsGetCommentParamSchema = z.object({ + gist_id: z.string(), + comment_id: z.coerce.number(), + }) + + const gistsGetCommentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_gist_comment], + ["304", z.undefined()], + [ + "403", + z.object({ + block: z + .object({ + reason: z.string().optional(), + created_at: z.string().optional(), + html_url: z.string().nullable().optional(), + }) + .optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsGetComment + router.get( + `/gists/:gist_id/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsGetCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse<{ + block?: + | { + created_at?: string | undefined + html_url?: (string | null) | undefined + reason?: string | undefined + } + | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsGetComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsGetCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsUpdateCommentParamSchema = z.object({ + gist_id: z.string(), + comment_id: z.coerce.number(), + }) + + const gistsUpdateCommentRequestBodySchema = z.object({ + body: z.string().max(65535), + }) + + const gistsUpdateCommentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_gist_comment], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsUpdateComment + router.patch( + `/gists/:gist_id/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsUpdateCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gistsUpdateCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsUpdateComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsUpdateCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsDeleteCommentParamSchema = z.object({ + gist_id: z.string(), + comment_id: z.coerce.number(), + }) + + const gistsDeleteCommentResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsDeleteComment + router.delete( + `/gists/:gist_id/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsDeleteCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsDeleteComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsDeleteCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsListCommitsParamSchema = z.object({ gist_id: z.string() }) + + const gistsListCommitsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const gistsListCommitsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_gist_commit)], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsListCommits + router.get( + `/gists/:gist_id/commits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsListCommitsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + gistsListCommitsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsListCommits(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsListCommitsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsListForksParamSchema = z.object({ gist_id: z.string() }) + + const gistsListForksQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const gistsListForksResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_gist_simple)], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsListForks + router.get( + `/gists/:gist_id/forks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsListForksParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + gistsListForksQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsListForks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsListForksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsForkParamSchema = z.object({ gist_id: z.string() }) + + const gistsForkResponseBodyValidator = responseValidationFactory( + [ + ["201", s_base_gist], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gistsFork + router.post( + `/gists/:gist_id/forks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsForkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsFork(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsForkResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsCheckIsStarredParamSchema = z.object({ gist_id: z.string() }) + + const gistsCheckIsStarredResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", z.object({})], + ], + undefined, + ) + + // gistsCheckIsStarred + router.get( + `/gists/:gist_id/star`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsCheckIsStarredParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsCheckIsStarred(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsCheckIsStarredResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsStarParamSchema = z.object({ gist_id: z.string() }) + + const gistsStarResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsStar + router.put( + `/gists/:gist_id/star`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsStarParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsStar(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsStarResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsUnstarParamSchema = z.object({ gist_id: z.string() }) + + const gistsUnstarResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // gistsUnstar + router.delete( + `/gists/:gist_id/star`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsUnstarParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsUnstar(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsUnstarResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsGetRevisionParamSchema = z.object({ + gist_id: z.string(), + sha: z.string(), + }) + + const gistsGetRevisionResponseBodyValidator = responseValidationFactory( + [ + ["200", s_gist_simple], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gistsGetRevision + router.get( + `/gists/:gist_id/:sha`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsGetRevisionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsGetRevision(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsGetRevisionResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitignoreGetAllTemplatesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(z.string())], + ["304", z.undefined()], + ], + undefined, + ) + + // gitignoreGetAllTemplates + router.get( + `/gitignore/templates`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitignoreGetAllTemplates(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitignoreGetAllTemplatesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitignoreGetTemplateParamSchema = z.object({ name: z.string() }) + + const gitignoreGetTemplateResponseBodyValidator = responseValidationFactory( + [ + ["200", s_gitignore_template], + ["304", z.undefined()], + ], + undefined, + ) + + // gitignoreGetTemplate + router.get( + `/gitignore/templates/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitignoreGetTemplateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitignoreGetTemplate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitignoreGetTemplateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListReposAccessibleToInstallationQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListReposAccessibleToInstallationResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repositories: z.array(s_repository), + repository_selection: z.string().optional(), + }), + ], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // appsListReposAccessibleToInstallation + router.get( + `/installation/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListReposAccessibleToInstallationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_repository[] + repository_selection?: string | undefined + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListReposAccessibleToInstallation( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsListReposAccessibleToInstallationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsRevokeInstallationAccessTokenResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // appsRevokeInstallationAccessToken + router.delete( + `/installation/token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsRevokeInstallationAccessToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsRevokeInstallationAccessTokenResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListQuerySchema = z.object({ + filter: z + .enum(["assigned", "created", "mentioned", "subscribed", "repos", "all"]) + .optional() + .default("assigned"), + state: z.enum(["open", "closed", "all"]).optional().default("open"), + labels: z.string().optional(), + sort: z + .enum(["created", "updated", "comments"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + since: z.string().datetime({ offset: true }).optional(), + collab: PermissiveBoolean.optional(), + orgs: PermissiveBoolean.optional(), + owned: PermissiveBoolean.optional(), + pulls: PermissiveBoolean.optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_issue)], + ["304", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesList + router.get( + `/issues`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + issuesListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const licensesGetAllCommonlyUsedQuerySchema = z.object({ + featured: PermissiveBoolean.optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const licensesGetAllCommonlyUsedResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_license_simple)], + ["304", z.undefined()], + ], + undefined, + ) + + // licensesGetAllCommonlyUsed + router.get( + `/licenses`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + licensesGetAllCommonlyUsedQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .licensesGetAllCommonlyUsed(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + licensesGetAllCommonlyUsedResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const licensesGetParamSchema = z.object({ license: z.string() }) + + const licensesGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_license], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // licensesGet + router.get( + `/licenses/:license`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + licensesGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .licensesGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(licensesGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const markdownRenderRequestBodySchema = z.object({ + text: z.string(), + mode: z.enum(["markdown", "gfm"]).optional().default("markdown"), + context: z.string().optional(), + }) + + const markdownRenderResponseBodyValidator = responseValidationFactory( + [ + ["200", z.string()], + ["304", z.undefined()], + ], + undefined, + ) + + // markdownRender + router.post( + `/markdown`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + markdownRenderRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .markdownRender(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(markdownRenderResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const markdownRenderRawRequestBodySchema = z.string().optional() + + const markdownRenderRawResponseBodyValidator = responseValidationFactory( + [ + ["200", z.string()], + ["304", z.undefined()], + ], + undefined, + ) + + // markdownRenderRaw + router.post( + `/markdown/raw`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + markdownRenderRawRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .markdownRenderRaw(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(markdownRenderRawResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetSubscriptionPlanForAccountParamSchema = z.object({ + account_id: z.coerce.number(), + }) + + const appsGetSubscriptionPlanForAccountResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_marketplace_purchase], + ["401", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // appsGetSubscriptionPlanForAccount + router.get( + `/marketplace_listing/accounts/:account_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsGetSubscriptionPlanForAccountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetSubscriptionPlanForAccount(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsGetSubscriptionPlanForAccountResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListPlansQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListPlansResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_marketplace_listing_plan)], + ["401", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // appsListPlans + router.get( + `/marketplace_listing/plans`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListPlansQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListPlans(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsListPlansResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListAccountsForPlanParamSchema = z.object({ + plan_id: z.coerce.number(), + }) + + const appsListAccountsForPlanQuerySchema = z.object({ + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListAccountsForPlanResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_marketplace_purchase)], + ["401", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // appsListAccountsForPlan + router.get( + `/marketplace_listing/plans/:plan_id/accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsListAccountsForPlanParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + appsListAccountsForPlanQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListAccountsForPlan(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsListAccountsForPlanResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetSubscriptionPlanForAccountStubbedParamSchema = z.object({ + account_id: z.coerce.number(), + }) + + const appsGetSubscriptionPlanForAccountStubbedResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_marketplace_purchase], + ["401", s_basic_error], + ["404", z.undefined()], + ], + undefined, + ) + + // appsGetSubscriptionPlanForAccountStubbed + router.get( + `/marketplace_listing/stubbed/accounts/:account_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsGetSubscriptionPlanForAccountStubbedParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetSubscriptionPlanForAccountStubbed( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsGetSubscriptionPlanForAccountStubbedResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListPlansStubbedQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListPlansStubbedResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_marketplace_listing_plan)], + ["401", s_basic_error], + ], + undefined, + ) + + // appsListPlansStubbed + router.get( + `/marketplace_listing/stubbed/plans`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListPlansStubbedQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListPlansStubbed(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsListPlansStubbedResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListAccountsForPlanStubbedParamSchema = z.object({ + plan_id: z.coerce.number(), + }) + + const appsListAccountsForPlanStubbedQuerySchema = z.object({ + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListAccountsForPlanStubbedResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_marketplace_purchase)], + ["401", s_basic_error], + ], + undefined, + ) + + // appsListAccountsForPlanStubbed + router.get( + `/marketplace_listing/stubbed/plans/:plan_id/accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsListAccountsForPlanStubbedParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + appsListAccountsForPlanStubbedQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListAccountsForPlanStubbed(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsListAccountsForPlanStubbedResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const metaGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_api_overview], + ["304", z.undefined()], + ], + undefined, + ) + + // metaGet + router.get( + `/meta`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .metaGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(metaGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListPublicEventsForRepoNetworkParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityListPublicEventsForRepoNetworkQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListPublicEventsForRepoNetworkResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_event)], + ["301", s_basic_error], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // activityListPublicEventsForRepoNetwork + router.get( + `/networks/:owner/:repo/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListPublicEventsForRepoNetworkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListPublicEventsForRepoNetworkQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListPublicEventsForRepoNetwork( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListPublicEventsForRepoNetworkResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListNotificationsForAuthenticatedUserQuerySchema = z.object({ + all: PermissiveBoolean.optional().default(false), + participating: PermissiveBoolean.optional().default(false), + since: z.string().datetime({ offset: true }).optional(), + before: z.string().datetime({ offset: true }).optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(50), + }) + + const activityListNotificationsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_thread)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // activityListNotificationsForAuthenticatedUser + router.get( + `/notifications`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + activityListNotificationsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListNotificationsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListNotificationsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityMarkNotificationsAsReadRequestBodySchema = z + .object({ + last_read_at: z.string().datetime({ offset: true }).optional(), + read: PermissiveBoolean.optional(), + }) + .optional() + + const activityMarkNotificationsAsReadResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.object({ message: z.string().optional() })], + ["205", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // activityMarkNotificationsAsRead + router.put( + `/notifications`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + activityMarkNotificationsAsReadRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + message?: string | undefined + }>(202) + }, + with205() { + return new ExpressRuntimeResponse(205) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityMarkNotificationsAsRead(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityMarkNotificationsAsReadResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityGetThreadParamSchema = z.object({ + thread_id: z.coerce.number(), + }) + + const activityGetThreadResponseBodyValidator = responseValidationFactory( + [ + ["200", s_thread], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // activityGetThread + router.get( + `/notifications/threads/:thread_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityGetThreadParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityGetThread(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(activityGetThreadResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityMarkThreadAsReadParamSchema = z.object({ + thread_id: z.coerce.number(), + }) + + const activityMarkThreadAsReadResponseBodyValidator = + responseValidationFactory( + [ + ["205", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ], + undefined, + ) + + // activityMarkThreadAsRead + router.patch( + `/notifications/threads/:thread_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityMarkThreadAsReadParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with205() { + return new ExpressRuntimeResponse(205) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityMarkThreadAsRead(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(activityMarkThreadAsReadResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityMarkThreadAsDoneParamSchema = z.object({ + thread_id: z.coerce.number(), + }) + + const activityMarkThreadAsDoneResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // activityMarkThreadAsDone + router.delete( + `/notifications/threads/:thread_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityMarkThreadAsDoneParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityMarkThreadAsDone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(activityMarkThreadAsDoneResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityGetThreadSubscriptionForAuthenticatedUserParamSchema = z.object( + { thread_id: z.coerce.number() }, + ) + + const activityGetThreadSubscriptionForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_thread_subscription], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // activityGetThreadSubscriptionForAuthenticatedUser + router.get( + `/notifications/threads/:thread_id/subscription`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityGetThreadSubscriptionForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityGetThreadSubscriptionForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityGetThreadSubscriptionForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activitySetThreadSubscriptionParamSchema = z.object({ + thread_id: z.coerce.number(), + }) + + const activitySetThreadSubscriptionRequestBodySchema = z + .object({ ignored: PermissiveBoolean.optional().default(false) }) + .optional() + + const activitySetThreadSubscriptionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_thread_subscription], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // activitySetThreadSubscription + router.put( + `/notifications/threads/:thread_id/subscription`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activitySetThreadSubscriptionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + activitySetThreadSubscriptionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activitySetThreadSubscription(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activitySetThreadSubscriptionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityDeleteThreadSubscriptionParamSchema = z.object({ + thread_id: z.coerce.number(), + }) + + const activityDeleteThreadSubscriptionResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // activityDeleteThreadSubscription + router.delete( + `/notifications/threads/:thread_id/subscription`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityDeleteThreadSubscriptionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityDeleteThreadSubscription(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityDeleteThreadSubscriptionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const metaGetOctocatQuerySchema = z.object({ s: z.string().optional() }) + + const metaGetOctocatResponseBodyValidator = responseValidationFactory( + [["200", z.string()]], + undefined, + ) + + // metaGetOctocat + router.get( + `/octocat`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + metaGetOctocatQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .metaGetOctocat(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(metaGetOctocatResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListQuerySchema = z.object({ + since: z.coerce.number().optional(), + per_page: z.coerce.number().optional().default(30), + }) + + const orgsListResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_organization_simple)], + ["304", z.undefined()], + ], + undefined, + ) + + // orgsList + router.get( + `/organizations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + orgsListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const billingGetGithubBillingUsageReportOrgParamSchema = z.object({ + org: z.string(), + }) + + const billingGetGithubBillingUsageReportOrgQuerySchema = z.object({ + year: z.coerce.number().optional(), + month: z.coerce.number().optional(), + day: z.coerce.number().optional(), + hour: z.coerce.number().optional(), + }) + + const billingGetGithubBillingUsageReportOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_billing_usage_report], + ["400", s_scim_error], + ["403", s_basic_error], + ["500", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // billingGetGithubBillingUsageReportOrg + router.get( + `/organizations/:org/settings/billing/usage`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + billingGetGithubBillingUsageReportOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + billingGetGithubBillingUsageReportOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .billingGetGithubBillingUsageReportOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + billingGetGithubBillingUsageReportOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetParamSchema = z.object({ org: z.string() }) + + const orgsGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_organization_full], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsGet + router.get( + `/orgs/:org`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsUpdateParamSchema = z.object({ org: z.string() }) + + const orgsUpdateRequestBodySchema = z + .object({ + billing_email: z.string().optional(), + company: z.string().optional(), + email: z.string().optional(), + twitter_username: z.string().optional(), + location: z.string().optional(), + name: z.string().optional(), + description: z.string().optional(), + has_organization_projects: PermissiveBoolean.optional(), + has_repository_projects: PermissiveBoolean.optional(), + default_repository_permission: z + .enum(["read", "write", "admin", "none"]) + .optional() + .default("read"), + members_can_create_repositories: + PermissiveBoolean.optional().default(true), + members_can_create_internal_repositories: PermissiveBoolean.optional(), + members_can_create_private_repositories: PermissiveBoolean.optional(), + members_can_create_public_repositories: PermissiveBoolean.optional(), + members_allowed_repository_creation_type: z + .enum(["all", "private", "none"]) + .optional(), + members_can_create_pages: PermissiveBoolean.optional().default(true), + members_can_create_public_pages: + PermissiveBoolean.optional().default(true), + members_can_create_private_pages: + PermissiveBoolean.optional().default(true), + members_can_fork_private_repositories: + PermissiveBoolean.optional().default(false), + web_commit_signoff_required: PermissiveBoolean.optional().default(false), + blog: z.string().optional(), + advanced_security_enabled_for_new_repositories: + PermissiveBoolean.optional(), + dependabot_alerts_enabled_for_new_repositories: + PermissiveBoolean.optional(), + dependabot_security_updates_enabled_for_new_repositories: + PermissiveBoolean.optional(), + dependency_graph_enabled_for_new_repositories: + PermissiveBoolean.optional(), + secret_scanning_enabled_for_new_repositories: + PermissiveBoolean.optional(), + secret_scanning_push_protection_enabled_for_new_repositories: + PermissiveBoolean.optional(), + secret_scanning_push_protection_custom_link_enabled: + PermissiveBoolean.optional(), + secret_scanning_push_protection_custom_link: z.string().optional(), + deploy_keys_enabled_for_repositories: PermissiveBoolean.optional(), + }) + .optional() + + const orgsUpdateResponseBodyValidator = responseValidationFactory( + [ + ["200", s_organization_full], + ["409", s_basic_error], + ["422", z.union([s_validation_error, s_validation_error_simple])], + ], + undefined, + ) + + // orgsUpdate + router.patch( + `/orgs/:org`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse< + t_validation_error | t_validation_error_simple + >(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsDeleteParamSchema = z.object({ org: z.string() }) + + const orgsDeleteResponseBodyValidator = responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsDelete + router.delete( + `/orgs/:org`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsDeleteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsDelete(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsDeleteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetActionsCacheUsageForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetActionsCacheUsageForOrgResponseBodyValidator = + responseValidationFactory( + [["200", s_actions_cache_usage_org_enterprise]], + undefined, + ) + + // actionsGetActionsCacheUsageForOrg + router.get( + `/orgs/:org/actions/cache/usage`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetActionsCacheUsageForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetActionsCacheUsageForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetActionsCacheUsageForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetActionsCacheUsageByRepoForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetActionsCacheUsageByRepoForOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsGetActionsCacheUsageByRepoForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repository_cache_usages: z.array( + s_actions_cache_usage_by_repository, + ), + }), + ], + ], + undefined, + ) + + // actionsGetActionsCacheUsageByRepoForOrg + router.get( + `/orgs/:org/actions/cache/usage-by-repository`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetActionsCacheUsageByRepoForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsGetActionsCacheUsageByRepoForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repository_cache_usages: t_actions_cache_usage_by_repository[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetActionsCacheUsageByRepoForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetActionsCacheUsageByRepoForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListHostedRunnersForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsListHostedRunnersForOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListHostedRunnersForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + runners: z.array(s_actions_hosted_runner), + }), + ], + ], + undefined, + ) + + // actionsListHostedRunnersForOrg + router.get( + `/orgs/:org/actions/hosted-runners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListHostedRunnersForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListHostedRunnersForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + runners: t_actions_hosted_runner[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListHostedRunnersForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListHostedRunnersForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateHostedRunnerForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsCreateHostedRunnerForOrgRequestBodySchema = z.object({ + name: z.string(), + image: z.object({ + id: z.string().optional(), + source: z.enum(["github", "partner", "custom"]).optional(), + }), + size: z.string(), + runner_group_id: z.coerce.number(), + maximum_runners: z.coerce.number().optional(), + enable_static_ip: PermissiveBoolean.optional(), + }) + + const actionsCreateHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory([["201", s_actions_hosted_runner]], undefined) + + // actionsCreateHostedRunnerForOrg + router.post( + `/orgs/:org/actions/hosted-runners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateHostedRunnerForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateHostedRunnerForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateHostedRunnerForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetHostedRunnersGithubOwnedImagesForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetHostedRunnersGithubOwnedImagesForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + images: z.array(s_actions_hosted_runner_image), + }), + ], + ], + undefined, + ) + + // actionsGetHostedRunnersGithubOwnedImagesForOrg + router.get( + `/orgs/:org/actions/hosted-runners/images/github-owned`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetHostedRunnersGithubOwnedImagesForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + images: t_actions_hosted_runner_image[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetHostedRunnersGithubOwnedImagesForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetHostedRunnersGithubOwnedImagesForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetHostedRunnersPartnerImagesForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetHostedRunnersPartnerImagesForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + images: z.array(s_actions_hosted_runner_image), + }), + ], + ], + undefined, + ) + + // actionsGetHostedRunnersPartnerImagesForOrg + router.get( + `/orgs/:org/actions/hosted-runners/images/partner`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetHostedRunnersPartnerImagesForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + images: t_actions_hosted_runner_image[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetHostedRunnersPartnerImagesForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetHostedRunnersPartnerImagesForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetHostedRunnersLimitsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetHostedRunnersLimitsForOrgResponseBodyValidator = + responseValidationFactory( + [["200", s_actions_hosted_runner_limits]], + undefined, + ) + + // actionsGetHostedRunnersLimitsForOrg + router.get( + `/orgs/:org/actions/hosted-runners/limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetHostedRunnersLimitsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetHostedRunnersLimitsForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetHostedRunnersLimitsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetHostedRunnersMachineSpecsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetHostedRunnersMachineSpecsForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + machine_specs: z.array(s_actions_hosted_runner_machine_spec), + }), + ], + ], + undefined, + ) + + // actionsGetHostedRunnersMachineSpecsForOrg + router.get( + `/orgs/:org/actions/hosted-runners/machine-sizes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetHostedRunnersMachineSpecsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + machine_specs: t_actions_hosted_runner_machine_spec[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetHostedRunnersMachineSpecsForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetHostedRunnersMachineSpecsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetHostedRunnersPlatformsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetHostedRunnersPlatformsForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + platforms: z.array(z.string()), + }), + ], + ], + undefined, + ) + + // actionsGetHostedRunnersPlatformsForOrg + router.get( + `/orgs/:org/actions/hosted-runners/platforms`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetHostedRunnersPlatformsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + platforms: string[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetHostedRunnersPlatformsForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetHostedRunnersPlatformsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetHostedRunnerForOrgParamSchema = z.object({ + org: z.string(), + hosted_runner_id: z.coerce.number(), + }) + + const actionsGetHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory([["200", s_actions_hosted_runner]], undefined) + + // actionsGetHostedRunnerForOrg + router.get( + `/orgs/:org/actions/hosted-runners/:hosted_runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetHostedRunnerForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetHostedRunnerForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsUpdateHostedRunnerForOrgParamSchema = z.object({ + org: z.string(), + hosted_runner_id: z.coerce.number(), + }) + + const actionsUpdateHostedRunnerForOrgRequestBodySchema = z.object({ + name: z.string().optional(), + runner_group_id: z.coerce.number().optional(), + maximum_runners: z.coerce.number().optional(), + enable_static_ip: PermissiveBoolean.optional(), + }) + + const actionsUpdateHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory([["200", s_actions_hosted_runner]], undefined) + + // actionsUpdateHostedRunnerForOrg + router.patch( + `/orgs/:org/actions/hosted-runners/:hosted_runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsUpdateHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsUpdateHostedRunnerForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsUpdateHostedRunnerForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsUpdateHostedRunnerForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteHostedRunnerForOrgParamSchema = z.object({ + org: z.string(), + hosted_runner_id: z.coerce.number(), + }) + + const actionsDeleteHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory([["202", s_actions_hosted_runner]], undefined) + + // actionsDeleteHostedRunnerForOrg + router.delete( + `/orgs/:org/actions/hosted-runners/:hosted_runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteHostedRunnerForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteHostedRunnerForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const oidcGetOidcCustomSubTemplateForOrgParamSchema = z.object({ + org: z.string(), + }) + + const oidcGetOidcCustomSubTemplateForOrgResponseBodyValidator = + responseValidationFactory([["200", s_oidc_custom_sub]], undefined) + + // oidcGetOidcCustomSubTemplateForOrg + router.get( + `/orgs/:org/actions/oidc/customization/sub`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + oidcGetOidcCustomSubTemplateForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .oidcGetOidcCustomSubTemplateForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + oidcGetOidcCustomSubTemplateForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const oidcUpdateOidcCustomSubTemplateForOrgParamSchema = z.object({ + org: z.string(), + }) + + const oidcUpdateOidcCustomSubTemplateForOrgRequestBodySchema = + s_oidc_custom_sub + + const oidcUpdateOidcCustomSubTemplateForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // oidcUpdateOidcCustomSubTemplateForOrg + router.put( + `/orgs/:org/actions/oidc/customization/sub`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + oidcUpdateOidcCustomSubTemplateForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + oidcUpdateOidcCustomSubTemplateForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .oidcUpdateOidcCustomSubTemplateForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + oidcUpdateOidcCustomSubTemplateForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetGithubActionsPermissionsOrganizationParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetGithubActionsPermissionsOrganizationResponseBodyValidator = + responseValidationFactory( + [["200", s_actions_organization_permissions]], + undefined, + ) + + // actionsGetGithubActionsPermissionsOrganization + router.get( + `/orgs/:org/actions/permissions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetGithubActionsPermissionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetGithubActionsPermissionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetGithubActionsPermissionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetGithubActionsPermissionsOrganizationParamSchema = z.object({ + org: z.string(), + }) + + const actionsSetGithubActionsPermissionsOrganizationRequestBodySchema = + z.object({ + enabled_repositories: s_enabled_repositories, + allowed_actions: s_allowed_actions.optional(), + }) + + const actionsSetGithubActionsPermissionsOrganizationResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetGithubActionsPermissionsOrganization + router.put( + `/orgs/:org/actions/permissions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetGithubActionsPermissionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetGithubActionsPermissionsOrganizationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetGithubActionsPermissionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetGithubActionsPermissionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema = + z.object({ org: z.string() }) + + const actionsListSelectedRepositoriesEnabledGithubActionsOrganizationQuerySchema = + z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repositories: z.array(s_repository), + }), + ], + ], + undefined, + ) + + // actionsListSelectedRepositoriesEnabledGithubActionsOrganization + router.get( + `/orgs/:org/actions/permissions/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListSelectedRepositoriesEnabledGithubActionsOrganizationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_repository[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListSelectedRepositoriesEnabledGithubActionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema = + z.object({ org: z.string() }) + + const actionsSetSelectedRepositoriesEnabledGithubActionsOrganizationRequestBodySchema = + z.object({ selected_repository_ids: z.array(z.coerce.number()) }) + + const actionsSetSelectedRepositoriesEnabledGithubActionsOrganizationResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetSelectedRepositoriesEnabledGithubActionsOrganization + router.put( + `/orgs/:org/actions/permissions/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetSelectedRepositoriesEnabledGithubActionsOrganizationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetSelectedRepositoriesEnabledGithubActionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetSelectedRepositoriesEnabledGithubActionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsEnableSelectedRepositoryGithubActionsOrganizationParamSchema = + z.object({ org: z.string(), repository_id: z.coerce.number() }) + + const actionsEnableSelectedRepositoryGithubActionsOrganizationResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsEnableSelectedRepositoryGithubActionsOrganization + router.put( + `/orgs/:org/actions/permissions/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsEnableSelectedRepositoryGithubActionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsEnableSelectedRepositoryGithubActionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsEnableSelectedRepositoryGithubActionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDisableSelectedRepositoryGithubActionsOrganizationParamSchema = + z.object({ org: z.string(), repository_id: z.coerce.number() }) + + const actionsDisableSelectedRepositoryGithubActionsOrganizationResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDisableSelectedRepositoryGithubActionsOrganization + router.delete( + `/orgs/:org/actions/permissions/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDisableSelectedRepositoryGithubActionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDisableSelectedRepositoryGithubActionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDisableSelectedRepositoryGithubActionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetAllowedActionsOrganizationParamSchema = z.object({ + org: z.string(), + }) + + const actionsGetAllowedActionsOrganizationResponseBodyValidator = + responseValidationFactory([["200", s_selected_actions]], undefined) + + // actionsGetAllowedActionsOrganization + router.get( + `/orgs/:org/actions/permissions/selected-actions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetAllowedActionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetAllowedActionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetAllowedActionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetAllowedActionsOrganizationParamSchema = z.object({ + org: z.string(), + }) + + const actionsSetAllowedActionsOrganizationRequestBodySchema = + s_selected_actions.optional() + + const actionsSetAllowedActionsOrganizationResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetAllowedActionsOrganization + router.put( + `/orgs/:org/actions/permissions/selected-actions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetAllowedActionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetAllowedActionsOrganizationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetAllowedActionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetAllowedActionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema = + z.object({ org: z.string() }) + + const actionsGetGithubActionsDefaultWorkflowPermissionsOrganizationResponseBodyValidator = + responseValidationFactory( + [["200", s_actions_get_default_workflow_permissions]], + undefined, + ) + + // actionsGetGithubActionsDefaultWorkflowPermissionsOrganization + router.get( + `/orgs/:org/actions/permissions/workflow`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetGithubActionsDefaultWorkflowPermissionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetGithubActionsDefaultWorkflowPermissionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema = + z.object({ org: z.string() }) + + const actionsSetGithubActionsDefaultWorkflowPermissionsOrganizationRequestBodySchema = + s_actions_set_default_workflow_permissions.optional() + + const actionsSetGithubActionsDefaultWorkflowPermissionsOrganizationResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetGithubActionsDefaultWorkflowPermissionsOrganization + router.put( + `/orgs/:org/actions/permissions/workflow`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetGithubActionsDefaultWorkflowPermissionsOrganizationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetGithubActionsDefaultWorkflowPermissionsOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetGithubActionsDefaultWorkflowPermissionsOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListSelfHostedRunnerGroupsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsListSelfHostedRunnerGroupsForOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + visible_to_repository: z.string().optional(), + }) + + const actionsListSelfHostedRunnerGroupsForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + runner_groups: z.array(s_runner_groups_org), + }), + ], + ], + undefined, + ) + + // actionsListSelfHostedRunnerGroupsForOrg + router.get( + `/orgs/:org/actions/runner-groups`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListSelfHostedRunnerGroupsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListSelfHostedRunnerGroupsForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + runner_groups: t_runner_groups_org[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListSelfHostedRunnerGroupsForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListSelfHostedRunnerGroupsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateSelfHostedRunnerGroupForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsCreateSelfHostedRunnerGroupForOrgRequestBodySchema = z.object({ + name: z.string(), + visibility: z + .enum(["selected", "all", "private"]) + .optional() + .default("all"), + selected_repository_ids: z.array(z.coerce.number()).optional(), + runners: z.array(z.coerce.number()).optional(), + allows_public_repositories: PermissiveBoolean.optional().default(false), + restricted_to_workflows: PermissiveBoolean.optional().default(false), + selected_workflows: z.array(z.string()).optional(), + network_configuration_id: z.string().optional(), + }) + + const actionsCreateSelfHostedRunnerGroupForOrgResponseBodyValidator = + responseValidationFactory([["201", s_runner_groups_org]], undefined) + + // actionsCreateSelfHostedRunnerGroupForOrg + router.post( + `/orgs/:org/actions/runner-groups`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateSelfHostedRunnerGroupForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateSelfHostedRunnerGroupForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateSelfHostedRunnerGroupForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateSelfHostedRunnerGroupForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetSelfHostedRunnerGroupForOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + }) + + const actionsGetSelfHostedRunnerGroupForOrgResponseBodyValidator = + responseValidationFactory([["200", s_runner_groups_org]], undefined) + + // actionsGetSelfHostedRunnerGroupForOrg + router.get( + `/orgs/:org/actions/runner-groups/:runner_group_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetSelfHostedRunnerGroupForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetSelfHostedRunnerGroupForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetSelfHostedRunnerGroupForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsUpdateSelfHostedRunnerGroupForOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + }) + + const actionsUpdateSelfHostedRunnerGroupForOrgRequestBodySchema = z.object({ + name: z.string(), + visibility: z.enum(["selected", "all", "private"]).optional(), + allows_public_repositories: PermissiveBoolean.optional().default(false), + restricted_to_workflows: PermissiveBoolean.optional().default(false), + selected_workflows: z.array(z.string()).optional(), + network_configuration_id: z.string().nullable().optional(), + }) + + const actionsUpdateSelfHostedRunnerGroupForOrgResponseBodyValidator = + responseValidationFactory([["200", s_runner_groups_org]], undefined) + + // actionsUpdateSelfHostedRunnerGroupForOrg + router.patch( + `/orgs/:org/actions/runner-groups/:runner_group_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsUpdateSelfHostedRunnerGroupForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsUpdateSelfHostedRunnerGroupForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsUpdateSelfHostedRunnerGroupForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsUpdateSelfHostedRunnerGroupForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteSelfHostedRunnerGroupFromOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + }) + + const actionsDeleteSelfHostedRunnerGroupFromOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteSelfHostedRunnerGroupFromOrg + router.delete( + `/orgs/:org/actions/runner-groups/:runner_group_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteSelfHostedRunnerGroupFromOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteSelfHostedRunnerGroupFromOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteSelfHostedRunnerGroupFromOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListGithubHostedRunnersInGroupForOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + }) + + const actionsListGithubHostedRunnersInGroupForOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListGithubHostedRunnersInGroupForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + runners: z.array(s_actions_hosted_runner), + }), + ], + ], + undefined, + ) + + // actionsListGithubHostedRunnersInGroupForOrg + router.get( + `/orgs/:org/actions/runner-groups/:runner_group_id/hosted-runners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListGithubHostedRunnersInGroupForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListGithubHostedRunnersInGroupForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + runners: t_actions_hosted_runner[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListGithubHostedRunnersInGroupForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListGithubHostedRunnersInGroupForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListRepoAccessToSelfHostedRunnerGroupInOrgParamSchema = z.object( + { org: z.string(), runner_group_id: z.coerce.number() }, + ) + + const actionsListRepoAccessToSelfHostedRunnerGroupInOrgQuerySchema = z.object( + { + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }, + ) + + const actionsListRepoAccessToSelfHostedRunnerGroupInOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repositories: z.array(s_minimal_repository), + }), + ], + ], + undefined, + ) + + // actionsListRepoAccessToSelfHostedRunnerGroupInOrg + router.get( + `/orgs/:org/actions/runner-groups/:runner_group_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListRepoAccessToSelfHostedRunnerGroupInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListRepoAccessToSelfHostedRunnerGroupInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListRepoAccessToSelfHostedRunnerGroupInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetRepoAccessToSelfHostedRunnerGroupInOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + }) + + const actionsSetRepoAccessToSelfHostedRunnerGroupInOrgRequestBodySchema = + z.object({ selected_repository_ids: z.array(z.coerce.number()) }) + + const actionsSetRepoAccessToSelfHostedRunnerGroupInOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetRepoAccessToSelfHostedRunnerGroupInOrg + router.put( + `/orgs/:org/actions/runner-groups/:runner_group_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetRepoAccessToSelfHostedRunnerGroupInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetRepoAccessToSelfHostedRunnerGroupInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetRepoAccessToSelfHostedRunnerGroupInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsAddRepoAccessToSelfHostedRunnerGroupInOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + repository_id: z.coerce.number(), + }) + + const actionsAddRepoAccessToSelfHostedRunnerGroupInOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsAddRepoAccessToSelfHostedRunnerGroupInOrg + router.put( + `/orgs/:org/actions/runner-groups/:runner_group_id/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsAddRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsAddRepoAccessToSelfHostedRunnerGroupInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsAddRepoAccessToSelfHostedRunnerGroupInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgParamSchema = + z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + repository_id: z.coerce.number(), + }) + + const actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg + router.delete( + `/orgs/:org/actions/runner-groups/:runner_group_id/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListSelfHostedRunnersInGroupForOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + }) + + const actionsListSelfHostedRunnersInGroupForOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListSelfHostedRunnersInGroupForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + runners: z.array(s_runner), + }), + ], + ], + undefined, + ) + + // actionsListSelfHostedRunnersInGroupForOrg + router.get( + `/orgs/:org/actions/runner-groups/:runner_group_id/runners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListSelfHostedRunnersInGroupForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListSelfHostedRunnersInGroupForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + runners: t_runner[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListSelfHostedRunnersInGroupForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListSelfHostedRunnersInGroupForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetSelfHostedRunnersInGroupForOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + }) + + const actionsSetSelfHostedRunnersInGroupForOrgRequestBodySchema = z.object({ + runners: z.array(z.coerce.number()), + }) + + const actionsSetSelfHostedRunnersInGroupForOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetSelfHostedRunnersInGroupForOrg + router.put( + `/orgs/:org/actions/runner-groups/:runner_group_id/runners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetSelfHostedRunnersInGroupForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetSelfHostedRunnersInGroupForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetSelfHostedRunnersInGroupForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetSelfHostedRunnersInGroupForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsAddSelfHostedRunnerToGroupForOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + runner_id: z.coerce.number(), + }) + + const actionsAddSelfHostedRunnerToGroupForOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsAddSelfHostedRunnerToGroupForOrg + router.put( + `/orgs/:org/actions/runner-groups/:runner_group_id/runners/:runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsAddSelfHostedRunnerToGroupForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsAddSelfHostedRunnerToGroupForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsAddSelfHostedRunnerToGroupForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsRemoveSelfHostedRunnerFromGroupForOrgParamSchema = z.object({ + org: z.string(), + runner_group_id: z.coerce.number(), + runner_id: z.coerce.number(), + }) + + const actionsRemoveSelfHostedRunnerFromGroupForOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsRemoveSelfHostedRunnerFromGroupForOrg + router.delete( + `/orgs/:org/actions/runner-groups/:runner_group_id/runners/:runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsRemoveSelfHostedRunnerFromGroupForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsRemoveSelfHostedRunnerFromGroupForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsRemoveSelfHostedRunnerFromGroupForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListSelfHostedRunnersForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsListSelfHostedRunnersForOrgQuerySchema = z.object({ + name: z.string().optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListSelfHostedRunnersForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + runners: z.array(s_runner), + }), + ], + ], + undefined, + ) + + // actionsListSelfHostedRunnersForOrg + router.get( + `/orgs/:org/actions/runners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListSelfHostedRunnersForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListSelfHostedRunnersForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + runners: t_runner[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListSelfHostedRunnersForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListSelfHostedRunnersForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListRunnerApplicationsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsListRunnerApplicationsForOrgResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_runner_application)]], + undefined, + ) + + // actionsListRunnerApplicationsForOrg + router.get( + `/orgs/:org/actions/runners/downloads`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListRunnerApplicationsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListRunnerApplicationsForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListRunnerApplicationsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGenerateRunnerJitconfigForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsGenerateRunnerJitconfigForOrgRequestBodySchema = z.object({ + name: z.string(), + runner_group_id: z.coerce.number(), + labels: z.array(z.string()).min(1).max(100), + work_folder: z.string().optional().default("_work"), + }) + + const actionsGenerateRunnerJitconfigForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["201", z.object({ runner: s_runner, encoded_jit_config: z.string() })], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsGenerateRunnerJitconfigForOrg + router.post( + `/orgs/:org/actions/runners/generate-jitconfig`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGenerateRunnerJitconfigForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsGenerateRunnerJitconfigForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse<{ + encoded_jit_config: string + runner: t_runner + }>(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGenerateRunnerJitconfigForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGenerateRunnerJitconfigForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateRegistrationTokenForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsCreateRegistrationTokenForOrgResponseBodyValidator = + responseValidationFactory([["201", s_authentication_token]], undefined) + + // actionsCreateRegistrationTokenForOrg + router.post( + `/orgs/:org/actions/runners/registration-token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateRegistrationTokenForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateRegistrationTokenForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateRegistrationTokenForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateRemoveTokenForOrgParamSchema = z.object({ + org: z.string(), + }) + + const actionsCreateRemoveTokenForOrgResponseBodyValidator = + responseValidationFactory([["201", s_authentication_token]], undefined) + + // actionsCreateRemoveTokenForOrg + router.post( + `/orgs/:org/actions/runners/remove-token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateRemoveTokenForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateRemoveTokenForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateRemoveTokenForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetSelfHostedRunnerForOrgParamSchema = z.object({ + org: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsGetSelfHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory([["200", s_runner]], undefined) + + // actionsGetSelfHostedRunnerForOrg + router.get( + `/orgs/:org/actions/runners/:runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetSelfHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetSelfHostedRunnerForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetSelfHostedRunnerForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteSelfHostedRunnerFromOrgParamSchema = z.object({ + org: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsDeleteSelfHostedRunnerFromOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteSelfHostedRunnerFromOrg + router.delete( + `/orgs/:org/actions/runners/:runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteSelfHostedRunnerFromOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteSelfHostedRunnerFromOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteSelfHostedRunnerFromOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListLabelsForSelfHostedRunnerForOrgParamSchema = z.object({ + org: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsListLabelsForSelfHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // actionsListLabelsForSelfHostedRunnerForOrg + router.get( + `/orgs/:org/actions/runners/:runner_id/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListLabelsForSelfHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListLabelsForSelfHostedRunnerForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListLabelsForSelfHostedRunnerForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsAddCustomLabelsToSelfHostedRunnerForOrgParamSchema = z.object({ + org: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsAddCustomLabelsToSelfHostedRunnerForOrgRequestBodySchema = + z.object({ labels: z.array(z.string()).min(1).max(100) }) + + const actionsAddCustomLabelsToSelfHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsAddCustomLabelsToSelfHostedRunnerForOrg + router.post( + `/orgs/:org/actions/runners/:runner_id/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsAddCustomLabelsToSelfHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsAddCustomLabelsToSelfHostedRunnerForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsAddCustomLabelsToSelfHostedRunnerForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsAddCustomLabelsToSelfHostedRunnerForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetCustomLabelsForSelfHostedRunnerForOrgParamSchema = z.object({ + org: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsSetCustomLabelsForSelfHostedRunnerForOrgRequestBodySchema = + z.object({ labels: z.array(z.string()).min(0).max(100) }) + + const actionsSetCustomLabelsForSelfHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsSetCustomLabelsForSelfHostedRunnerForOrg + router.put( + `/orgs/:org/actions/runners/:runner_id/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetCustomLabelsForSelfHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetCustomLabelsForSelfHostedRunnerForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetCustomLabelsForSelfHostedRunnerForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetCustomLabelsForSelfHostedRunnerForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgParamSchema = + z.object({ org: z.string(), runner_id: z.coerce.number() }) + + const actionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // actionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrg + router.delete( + `/orgs/:org/actions/runners/:runner_id/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsRemoveCustomLabelFromSelfHostedRunnerForOrgParamSchema = + z.object({ + org: z.string(), + runner_id: z.coerce.number(), + name: z.string(), + }) + + const actionsRemoveCustomLabelFromSelfHostedRunnerForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsRemoveCustomLabelFromSelfHostedRunnerForOrg + router.delete( + `/orgs/:org/actions/runners/:runner_id/labels/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsRemoveCustomLabelFromSelfHostedRunnerForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsRemoveCustomLabelFromSelfHostedRunnerForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsRemoveCustomLabelFromSelfHostedRunnerForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListOrgSecretsParamSchema = z.object({ org: z.string() }) + + const actionsListOrgSecretsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListOrgSecretsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_organization_actions_secret), + }), + ], + ], + undefined, + ) + + // actionsListOrgSecrets + router.get( + `/orgs/:org/actions/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListOrgSecretsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListOrgSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_organization_actions_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListOrgSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsListOrgSecretsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetOrgPublicKeyParamSchema = z.object({ org: z.string() }) + + const actionsGetOrgPublicKeyResponseBodyValidator = responseValidationFactory( + [["200", s_actions_public_key]], + undefined, + ) + + // actionsGetOrgPublicKey + router.get( + `/orgs/:org/actions/secrets/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetOrgPublicKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetOrgPublicKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetOrgPublicKeyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const actionsGetOrgSecretResponseBodyValidator = responseValidationFactory( + [["200", s_organization_actions_secret]], + undefined, + ) + + // actionsGetOrgSecret + router.get( + `/orgs/:org/actions/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetOrgSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateOrUpdateOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const actionsCreateOrUpdateOrgSecretRequestBodySchema = z.object({ + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ), + key_id: z.string(), + visibility: z.enum(["all", "private", "selected"]), + selected_repository_ids: z.array(z.coerce.number()).optional(), + }) + + const actionsCreateOrUpdateOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["204", z.undefined()], + ], + undefined, + ) + + // actionsCreateOrUpdateOrgSecret + router.put( + `/orgs/:org/actions/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateOrUpdateOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateOrUpdateOrgSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateOrUpdateOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateOrUpdateOrgSecretResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const actionsDeleteOrgSecretResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // actionsDeleteOrgSecret + router.delete( + `/orgs/:org/actions/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsDeleteOrgSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListSelectedReposForOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const actionsListSelectedReposForOrgSecretQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const actionsListSelectedReposForOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repositories: z.array(s_minimal_repository), + }), + ], + ], + undefined, + ) + + // actionsListSelectedReposForOrgSecret + router.get( + `/orgs/:org/actions/secrets/:secret_name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListSelectedReposForOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListSelectedReposForOrgSecretQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListSelectedReposForOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListSelectedReposForOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetSelectedReposForOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const actionsSetSelectedReposForOrgSecretRequestBodySchema = z.object({ + selected_repository_ids: z.array(z.coerce.number()), + }) + + const actionsSetSelectedReposForOrgSecretResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetSelectedReposForOrgSecret + router.put( + `/orgs/:org/actions/secrets/:secret_name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetSelectedReposForOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetSelectedReposForOrgSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetSelectedReposForOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetSelectedReposForOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsAddSelectedRepoToOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + repository_id: z.coerce.number(), + }) + + const actionsAddSelectedRepoToOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // actionsAddSelectedRepoToOrgSecret + router.put( + `/orgs/:org/actions/secrets/:secret_name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsAddSelectedRepoToOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsAddSelectedRepoToOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsAddSelectedRepoToOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsRemoveSelectedRepoFromOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + repository_id: z.coerce.number(), + }) + + const actionsRemoveSelectedRepoFromOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // actionsRemoveSelectedRepoFromOrgSecret + router.delete( + `/orgs/:org/actions/secrets/:secret_name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsRemoveSelectedRepoFromOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsRemoveSelectedRepoFromOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsRemoveSelectedRepoFromOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListOrgVariablesParamSchema = z.object({ org: z.string() }) + + const actionsListOrgVariablesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(10), + page: z.coerce.number().optional().default(1), + }) + + const actionsListOrgVariablesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + variables: z.array(s_organization_actions_variable), + }), + ], + ], + undefined, + ) + + // actionsListOrgVariables + router.get( + `/orgs/:org/actions/variables`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListOrgVariablesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListOrgVariablesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + total_count: number + variables: t_organization_actions_variable[] + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListOrgVariables(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsListOrgVariablesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateOrgVariableParamSchema = z.object({ org: z.string() }) + + const actionsCreateOrgVariableRequestBodySchema = z.object({ + name: z.string(), + value: z.string(), + visibility: z.enum(["all", "private", "selected"]), + selected_repository_ids: z.array(z.coerce.number()).optional(), + }) + + const actionsCreateOrgVariableResponseBodyValidator = + responseValidationFactory([["201", s_empty_object]], undefined) + + // actionsCreateOrgVariable + router.post( + `/orgs/:org/actions/variables`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateOrgVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateOrgVariableRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateOrgVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsCreateOrgVariableResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetOrgVariableParamSchema = z.object({ + org: z.string(), + name: z.string(), + }) + + const actionsGetOrgVariableResponseBodyValidator = responseValidationFactory( + [["200", s_organization_actions_variable]], + undefined, + ) + + // actionsGetOrgVariable + router.get( + `/orgs/:org/actions/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetOrgVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetOrgVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetOrgVariableResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsUpdateOrgVariableParamSchema = z.object({ + org: z.string(), + name: z.string(), + }) + + const actionsUpdateOrgVariableRequestBodySchema = z.object({ + name: z.string().optional(), + value: z.string().optional(), + visibility: z.enum(["all", "private", "selected"]).optional(), + selected_repository_ids: z.array(z.coerce.number()).optional(), + }) + + const actionsUpdateOrgVariableResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsUpdateOrgVariable + router.patch( + `/orgs/:org/actions/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsUpdateOrgVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsUpdateOrgVariableRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsUpdateOrgVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsUpdateOrgVariableResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteOrgVariableParamSchema = z.object({ + org: z.string(), + name: z.string(), + }) + + const actionsDeleteOrgVariableResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteOrgVariable + router.delete( + `/orgs/:org/actions/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteOrgVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteOrgVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsDeleteOrgVariableResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListSelectedReposForOrgVariableParamSchema = z.object({ + org: z.string(), + name: z.string(), + }) + + const actionsListSelectedReposForOrgVariableQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const actionsListSelectedReposForOrgVariableResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repositories: z.array(s_minimal_repository), + }), + ], + ["409", z.undefined()], + ], + undefined, + ) + + // actionsListSelectedReposForOrgVariable + router.get( + `/orgs/:org/actions/variables/:name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListSelectedReposForOrgVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListSelectedReposForOrgVariableQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }>(200) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListSelectedReposForOrgVariable( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListSelectedReposForOrgVariableResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetSelectedReposForOrgVariableParamSchema = z.object({ + org: z.string(), + name: z.string(), + }) + + const actionsSetSelectedReposForOrgVariableRequestBodySchema = z.object({ + selected_repository_ids: z.array(z.coerce.number()), + }) + + const actionsSetSelectedReposForOrgVariableResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // actionsSetSelectedReposForOrgVariable + router.put( + `/orgs/:org/actions/variables/:name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetSelectedReposForOrgVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetSelectedReposForOrgVariableRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetSelectedReposForOrgVariable( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetSelectedReposForOrgVariableResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsAddSelectedRepoToOrgVariableParamSchema = z.object({ + org: z.string(), + name: z.string(), + repository_id: z.coerce.number(), + }) + + const actionsAddSelectedRepoToOrgVariableResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // actionsAddSelectedRepoToOrgVariable + router.put( + `/orgs/:org/actions/variables/:name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsAddSelectedRepoToOrgVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsAddSelectedRepoToOrgVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsAddSelectedRepoToOrgVariableResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsRemoveSelectedRepoFromOrgVariableParamSchema = z.object({ + org: z.string(), + name: z.string(), + repository_id: z.coerce.number(), + }) + + const actionsRemoveSelectedRepoFromOrgVariableResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // actionsRemoveSelectedRepoFromOrgVariable + router.delete( + `/orgs/:org/actions/variables/:name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsRemoveSelectedRepoFromOrgVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsRemoveSelectedRepoFromOrgVariable( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsRemoveSelectedRepoFromOrgVariableResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListAttestationsParamSchema = z.object({ + org: z.string(), + subject_digest: z.string(), + }) + + const orgsListAttestationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + predicate_type: z.string().optional(), + }) + + const orgsListAttestationsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + attestations: z + .array( + z.object({ + bundle: z + .object({ + mediaType: z.string().optional(), + verificationMaterial: z.record(z.unknown()).optional(), + dsseEnvelope: z.record(z.unknown()).optional(), + }) + .optional(), + repository_id: z.coerce.number().optional(), + bundle_url: z.string().optional(), + }), + ) + .optional(), + }), + ], + ], + undefined, + ) + + // orgsListAttestations + router.get( + `/orgs/:org/attestations/:subject_digest`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListAttestationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListAttestationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + attestations?: + | { + bundle?: + | { + dsseEnvelope?: + | { + [key: string]: unknown | undefined + } + | undefined + mediaType?: string | undefined + verificationMaterial?: + | { + [key: string]: unknown | undefined + } + | undefined + } + | undefined + bundle_url?: string | undefined + repository_id?: number | undefined + }[] + | undefined + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListAttestations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListAttestationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListBlockedUsersParamSchema = z.object({ org: z.string() }) + + const orgsListBlockedUsersQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListBlockedUsersResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_simple_user)]], + undefined, + ) + + // orgsListBlockedUsers + router.get( + `/orgs/:org/blocks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListBlockedUsersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListBlockedUsersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListBlockedUsers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListBlockedUsersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCheckBlockedUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsCheckBlockedUserResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsCheckBlockedUser + router.get( + `/orgs/:org/blocks/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCheckBlockedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCheckBlockedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsCheckBlockedUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsBlockUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsBlockUserResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsBlockUser + router.put( + `/orgs/:org/blocks/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsBlockUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsBlockUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsBlockUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsUnblockUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsUnblockUserResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // orgsUnblockUser + router.delete( + `/orgs/:org/blocks/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsUnblockUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsUnblockUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsUnblockUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const campaignsListOrgCampaignsParamSchema = z.object({ org: z.string() }) + + const campaignsListOrgCampaignsQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + state: s_campaign_state.optional(), + sort: z + .enum(["created", "updated", "ends_at", "published"]) + .optional() + .default("created"), + }) + + const campaignsListOrgCampaignsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_campaign_summary)], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // campaignsListOrgCampaigns + router.get( + `/orgs/:org/campaigns`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + campaignsListOrgCampaignsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + campaignsListOrgCampaignsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .campaignsListOrgCampaigns(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(campaignsListOrgCampaignsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const campaignsCreateCampaignParamSchema = z.object({ org: z.string() }) + + const campaignsCreateCampaignRequestBodySchema = z.object({ + name: z.string().min(1).max(50), + description: z.string().min(1).max(255), + managers: z.array(z.string()).max(10).optional(), + team_managers: z.array(z.string()).max(10).optional(), + ends_at: z.string().datetime({ offset: true }), + contact_link: z.string().nullable().optional(), + code_scanning_alerts: z + .array( + z.object({ + repository_id: z.coerce.number(), + alert_numbers: z.array(z.coerce.number()).min(1), + }), + ) + .min(1), + generate_issues: PermissiveBoolean.optional().default(false), + }) + + const campaignsCreateCampaignResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_campaign_summary], + ["400", s_basic_error], + ["404", s_basic_error], + ["422", s_basic_error], + ["429", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // campaignsCreateCampaign + router.post( + `/orgs/:org/campaigns`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + campaignsCreateCampaignParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + campaignsCreateCampaignRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .campaignsCreateCampaign(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(campaignsCreateCampaignResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const campaignsGetCampaignSummaryParamSchema = z.object({ + org: z.string(), + campaign_number: z.coerce.number(), + }) + + const campaignsGetCampaignSummaryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_campaign_summary], + ["404", s_basic_error], + ["422", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // campaignsGetCampaignSummary + router.get( + `/orgs/:org/campaigns/:campaign_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + campaignsGetCampaignSummaryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .campaignsGetCampaignSummary(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + campaignsGetCampaignSummaryResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const campaignsUpdateCampaignParamSchema = z.object({ + org: z.string(), + campaign_number: z.coerce.number(), + }) + + const campaignsUpdateCampaignRequestBodySchema = z.object({ + name: z.string().min(1).max(50).optional(), + description: z.string().min(1).max(255).optional(), + managers: z.array(z.string()).max(10).optional(), + team_managers: z.array(z.string()).max(10).optional(), + ends_at: z.string().datetime({ offset: true }).optional(), + contact_link: z.string().nullable().optional(), + state: s_campaign_state.optional(), + }) + + const campaignsUpdateCampaignResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_campaign_summary], + ["400", s_basic_error], + ["404", s_basic_error], + ["422", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // campaignsUpdateCampaign + router.patch( + `/orgs/:org/campaigns/:campaign_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + campaignsUpdateCampaignParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + campaignsUpdateCampaignRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .campaignsUpdateCampaign(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(campaignsUpdateCampaignResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const campaignsDeleteCampaignParamSchema = z.object({ + org: z.string(), + campaign_number: z.coerce.number(), + }) + + const campaignsDeleteCampaignResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // campaignsDeleteCampaign + router.delete( + `/orgs/:org/campaigns/:campaign_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + campaignsDeleteCampaignParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .campaignsDeleteCampaign(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(campaignsDeleteCampaignResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningListAlertsForOrgParamSchema = z.object({ org: z.string() }) + + const codeScanningListAlertsForOrgQuerySchema = z.object({ + tool_name: s_code_scanning_analysis_tool_name.optional(), + tool_guid: s_code_scanning_analysis_tool_guid.optional(), + before: z.string().optional(), + after: z.string().optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + state: s_code_scanning_alert_state_query.optional(), + sort: z.enum(["created", "updated"]).optional().default("created"), + severity: s_code_scanning_alert_severity.optional(), + }) + + const codeScanningListAlertsForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_scanning_organization_alert_items)], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningListAlertsForOrg + router.get( + `/orgs/:org/code-scanning/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningListAlertsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeScanningListAlertsForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_code_scanning_organization_alert_items[] + >(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningListAlertsForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningListAlertsForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetConfigurationsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const codeSecurityGetConfigurationsForOrgQuerySchema = z.object({ + target_type: z.enum(["global", "all"]).optional().default("all"), + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + }) + + const codeSecurityGetConfigurationsForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_security_configuration)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityGetConfigurationsForOrg + router.get( + `/orgs/:org/code-security/configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetConfigurationsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeSecurityGetConfigurationsForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetConfigurationsForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetConfigurationsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityCreateConfigurationParamSchema = z.object({ + org: z.string(), + }) + + const codeSecurityCreateConfigurationRequestBodySchema = z.object({ + name: z.string(), + description: z.string().max(255), + advanced_security: z + .enum(["enabled", "disabled", "code_security", "secret_protection"]) + .optional() + .default("disabled"), + dependency_graph: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("enabled"), + dependency_graph_autosubmit_action: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + dependency_graph_autosubmit_action_options: z + .object({ labeled_runners: PermissiveBoolean.optional().default(false) }) + .optional(), + dependabot_alerts: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + dependabot_security_updates: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + code_scanning_default_setup: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + code_scanning_default_setup_options: + s_code_scanning_default_setup_options.optional(), + code_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("not_set"), + secret_scanning: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_push_protection: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_delegated_bypass: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_delegated_bypass_options: z + .object({ + reviewers: z + .array( + z.object({ + reviewer_id: z.coerce.number(), + reviewer_type: z.enum(["TEAM", "ROLE"]), + }), + ) + .optional(), + }) + .optional(), + secret_scanning_validity_checks: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_non_provider_patterns: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_generic_secrets: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + private_vulnerability_reporting: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + enforcement: z + .enum(["enforced", "unenforced"]) + .optional() + .default("enforced"), + }) + + const codeSecurityCreateConfigurationResponseBodyValidator = + responseValidationFactory( + [["201", s_code_security_configuration]], + undefined, + ) + + // codeSecurityCreateConfiguration + router.post( + `/orgs/:org/code-security/configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityCreateConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecurityCreateConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse( + 201, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityCreateConfiguration(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityCreateConfigurationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetDefaultConfigurationsParamSchema = z.object({ + org: z.string(), + }) + + const codeSecurityGetDefaultConfigurationsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_security_default_configurations], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityGetDefaultConfigurations + router.get( + `/orgs/:org/code-security/configurations/defaults`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetDefaultConfigurationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetDefaultConfigurations( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetDefaultConfigurationsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityDetachConfigurationParamSchema = z.object({ + org: z.string(), + }) + + const codeSecurityDetachConfigurationRequestBodySchema = z.object({ + selected_repository_ids: z.array(z.coerce.number()).optional(), + }) + + const codeSecurityDetachConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // codeSecurityDetachConfiguration + router.delete( + `/orgs/:org/code-security/configurations/detach`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityDetachConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecurityDetachConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityDetachConfiguration(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityDetachConfigurationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityGetConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_security_configuration], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityGetConfiguration + router.get( + `/orgs/:org/code-security/configurations/:configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetConfiguration(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetConfigurationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityUpdateConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityUpdateConfigurationRequestBodySchema = z.object({ + name: z.string().optional(), + description: z.string().max(255).optional(), + advanced_security: z + .enum(["enabled", "disabled", "code_security", "secret_protection"]) + .optional(), + dependency_graph: z.enum(["enabled", "disabled", "not_set"]).optional(), + dependency_graph_autosubmit_action: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + dependency_graph_autosubmit_action_options: z + .object({ labeled_runners: PermissiveBoolean.optional() }) + .optional(), + dependabot_alerts: z.enum(["enabled", "disabled", "not_set"]).optional(), + dependabot_security_updates: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + code_scanning_default_setup: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + code_scanning_default_setup_options: + s_code_scanning_default_setup_options.optional(), + code_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional() + .default("disabled"), + secret_scanning: z.enum(["enabled", "disabled", "not_set"]).optional(), + secret_scanning_push_protection: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_delegated_bypass: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_delegated_bypass_options: z + .object({ + reviewers: z + .array( + z.object({ + reviewer_id: z.coerce.number(), + reviewer_type: z.enum(["TEAM", "ROLE"]), + }), + ) + .optional(), + }) + .optional(), + secret_scanning_validity_checks: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_non_provider_patterns: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_generic_secrets: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + private_vulnerability_reporting: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + enforcement: z.enum(["enforced", "unenforced"]).optional(), + }) + + const codeSecurityUpdateConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_security_configuration], + ["204", z.undefined()], + ], + undefined, + ) + + // codeSecurityUpdateConfiguration + router.patch( + `/orgs/:org/code-security/configurations/:configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityUpdateConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecurityUpdateConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityUpdateConfiguration(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityUpdateConfigurationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityDeleteConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityDeleteConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // codeSecurityDeleteConfiguration + router.delete( + `/orgs/:org/code-security/configurations/:configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityDeleteConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityDeleteConfiguration(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityDeleteConfigurationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityAttachConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityAttachConfigurationRequestBodySchema = z.object({ + scope: z.enum([ + "all", + "all_without_configurations", + "public", + "private_or_internal", + "selected", + ]), + selected_repository_ids: z.array(z.coerce.number()).optional(), + }) + + const codeSecurityAttachConfigurationResponseBodyValidator = + responseValidationFactory([["202", z.record(z.unknown())]], undefined) + + // codeSecurityAttachConfiguration + router.post( + `/orgs/:org/code-security/configurations/:configuration_id/attach`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityAttachConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecurityAttachConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityAttachConfiguration(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityAttachConfigurationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecuritySetConfigurationAsDefaultParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecuritySetConfigurationAsDefaultRequestBodySchema = z.object({ + default_for_new_repos: z + .enum(["all", "none", "private_and_internal", "public"]) + .optional(), + }) + + const codeSecuritySetConfigurationAsDefaultResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + default_for_new_repos: z + .enum(["all", "none", "private_and_internal", "public"]) + .optional(), + configuration: s_code_security_configuration.optional(), + }), + ], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecuritySetConfigurationAsDefault + router.put( + `/orgs/:org/code-security/configurations/:configuration_id/defaults`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecuritySetConfigurationAsDefaultParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeSecuritySetConfigurationAsDefaultRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + configuration?: t_code_security_configuration | undefined + default_for_new_repos?: + | ("all" | "none" | "private_and_internal" | "public") + | undefined + }>(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecuritySetConfigurationAsDefault( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecuritySetConfigurationAsDefaultResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetRepositoriesForConfigurationParamSchema = z.object({ + org: z.string(), + configuration_id: z.coerce.number(), + }) + + const codeSecurityGetRepositoriesForConfigurationQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + status: z.string().optional().default("all"), + }) + + const codeSecurityGetRepositoriesForConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_security_configuration_repositories)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityGetRepositoriesForConfiguration + router.get( + `/orgs/:org/code-security/configurations/:configuration_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetRepositoriesForConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeSecurityGetRepositoriesForConfigurationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_code_security_configuration_repositories[] + >(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetRepositoriesForConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetRepositoriesForConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListInOrganizationParamSchema = z.object({ org: z.string() }) + + const codespacesListInOrganizationQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const codespacesListInOrganizationResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + codespaces: z.array(s_codespace), + }), + ], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesListInOrganization + router.get( + `/orgs/:org/codespaces`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesListInOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesListInOrganizationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + codespaces: t_codespace[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListInOrganization(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesListInOrganizationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesSetCodespacesAccessParamSchema = z.object({ org: z.string() }) + + const codespacesSetCodespacesAccessRequestBodySchema = z.object({ + visibility: z.enum([ + "disabled", + "selected_members", + "all_members", + "all_members_and_outside_collaborators", + ]), + selected_usernames: z.array(z.string()).max(100).optional(), + }) + + const codespacesSetCodespacesAccessResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["400", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesSetCodespacesAccess + router.put( + `/orgs/:org/codespaces/access`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesSetCodespacesAccessParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesSetCodespacesAccessRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesSetCodespacesAccess(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesSetCodespacesAccessResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesSetCodespacesAccessUsersParamSchema = z.object({ + org: z.string(), + }) + + const codespacesSetCodespacesAccessUsersRequestBodySchema = z.object({ + selected_usernames: z.array(z.string()).max(100), + }) + + const codespacesSetCodespacesAccessUsersResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["400", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesSetCodespacesAccessUsers + router.post( + `/orgs/:org/codespaces/access/selected_users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesSetCodespacesAccessUsersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesSetCodespacesAccessUsersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesSetCodespacesAccessUsers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesSetCodespacesAccessUsersResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesDeleteCodespacesAccessUsersParamSchema = z.object({ + org: z.string(), + }) + + const codespacesDeleteCodespacesAccessUsersRequestBodySchema = z.object({ + selected_usernames: z.array(z.string()).max(100), + }) + + const codespacesDeleteCodespacesAccessUsersResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["400", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesDeleteCodespacesAccessUsers + router.delete( + `/orgs/:org/codespaces/access/selected_users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesDeleteCodespacesAccessUsersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesDeleteCodespacesAccessUsersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesDeleteCodespacesAccessUsers( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesDeleteCodespacesAccessUsersResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListOrgSecretsParamSchema = z.object({ org: z.string() }) + + const codespacesListOrgSecretsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const codespacesListOrgSecretsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_codespaces_org_secret), + }), + ], + ], + undefined, + ) + + // codespacesListOrgSecrets + router.get( + `/orgs/:org/codespaces/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesListOrgSecretsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesListOrgSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_codespaces_org_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListOrgSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codespacesListOrgSecretsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetOrgPublicKeyParamSchema = z.object({ org: z.string() }) + + const codespacesGetOrgPublicKeyResponseBodyValidator = + responseValidationFactory([["200", s_codespaces_public_key]], undefined) + + // codespacesGetOrgPublicKey + router.get( + `/orgs/:org/codespaces/secrets/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesGetOrgPublicKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetOrgPublicKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codespacesGetOrgPublicKeyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const codespacesGetOrgSecretResponseBodyValidator = responseValidationFactory( + [["200", s_codespaces_org_secret]], + undefined, + ) + + // codespacesGetOrgSecret + router.get( + `/orgs/:org/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesGetOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codespacesGetOrgSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesCreateOrUpdateOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const codespacesCreateOrUpdateOrgSecretRequestBodySchema = z.object({ + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ) + .optional(), + key_id: z.string().optional(), + visibility: z.enum(["all", "private", "selected"]), + selected_repository_ids: z.array(z.coerce.number()).optional(), + }) + + const codespacesCreateOrUpdateOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // codespacesCreateOrUpdateOrgSecret + router.put( + `/orgs/:org/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesCreateOrUpdateOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesCreateOrUpdateOrgSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesCreateOrUpdateOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesCreateOrUpdateOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesDeleteOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const codespacesDeleteOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // codespacesDeleteOrgSecret + router.delete( + `/orgs/:org/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesDeleteOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesDeleteOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codespacesDeleteOrgSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListSelectedReposForOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const codespacesListSelectedReposForOrgSecretQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const codespacesListSelectedReposForOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repositories: z.array(s_minimal_repository), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // codespacesListSelectedReposForOrgSecret + router.get( + `/orgs/:org/codespaces/secrets/:secret_name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesListSelectedReposForOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesListSelectedReposForOrgSecretQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListSelectedReposForOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesListSelectedReposForOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesSetSelectedReposForOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const codespacesSetSelectedReposForOrgSecretRequestBodySchema = z.object({ + selected_repository_ids: z.array(z.coerce.number()), + }) + + const codespacesSetSelectedReposForOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["409", z.undefined()], + ], + undefined, + ) + + // codespacesSetSelectedReposForOrgSecret + router.put( + `/orgs/:org/codespaces/secrets/:secret_name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesSetSelectedReposForOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesSetSelectedReposForOrgSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesSetSelectedReposForOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesSetSelectedReposForOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesAddSelectedRepoToOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + repository_id: z.coerce.number(), + }) + + const codespacesAddSelectedRepoToOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["409", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // codespacesAddSelectedRepoToOrgSecret + router.put( + `/orgs/:org/codespaces/secrets/:secret_name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesAddSelectedRepoToOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesAddSelectedRepoToOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesAddSelectedRepoToOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesRemoveSelectedRepoFromOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + repository_id: z.coerce.number(), + }) + + const codespacesRemoveSelectedRepoFromOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["409", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // codespacesRemoveSelectedRepoFromOrgSecret + router.delete( + `/orgs/:org/codespaces/secrets/:secret_name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesRemoveSelectedRepoFromOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesRemoveSelectedRepoFromOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesRemoveSelectedRepoFromOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotGetCopilotOrganizationDetailsParamSchema = z.object({ + org: z.string(), + }) + + const copilotGetCopilotOrganizationDetailsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_copilot_organization_details], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotGetCopilotOrganizationDetails + router.get( + `/orgs/:org/copilot/billing`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotGetCopilotOrganizationDetailsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotGetCopilotOrganizationDetails( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + copilotGetCopilotOrganizationDetailsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotListCopilotSeatsParamSchema = z.object({ org: z.string() }) + + const copilotListCopilotSeatsQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(50), + }) + + const copilotListCopilotSeatsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_seats: z.coerce.number().optional(), + seats: z.array(s_copilot_seat_details).optional(), + }), + ], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotListCopilotSeats + router.get( + `/orgs/:org/copilot/billing/seats`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotListCopilotSeatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + copilotListCopilotSeatsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + seats?: t_copilot_seat_details[] | undefined + total_seats?: number | undefined + }>(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotListCopilotSeats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(copilotListCopilotSeatsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotAddCopilotSeatsForTeamsParamSchema = z.object({ + org: z.string(), + }) + + const copilotAddCopilotSeatsForTeamsRequestBodySchema = z.object({ + selected_teams: z.array(z.string()).min(1), + }) + + const copilotAddCopilotSeatsForTeamsResponseBodyValidator = + responseValidationFactory( + [ + ["201", z.object({ seats_created: z.coerce.number() })], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotAddCopilotSeatsForTeams + router.post( + `/orgs/:org/copilot/billing/selected_teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotAddCopilotSeatsForTeamsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + copilotAddCopilotSeatsForTeamsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse<{ + seats_created: number + }>(201) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotAddCopilotSeatsForTeams(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + copilotAddCopilotSeatsForTeamsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotCancelCopilotSeatAssignmentForTeamsParamSchema = z.object({ + org: z.string(), + }) + + const copilotCancelCopilotSeatAssignmentForTeamsRequestBodySchema = z.object({ + selected_teams: z.array(z.string()).min(1), + }) + + const copilotCancelCopilotSeatAssignmentForTeamsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.object({ seats_cancelled: z.coerce.number() })], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotCancelCopilotSeatAssignmentForTeams + router.delete( + `/orgs/:org/copilot/billing/selected_teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotCancelCopilotSeatAssignmentForTeamsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + copilotCancelCopilotSeatAssignmentForTeamsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + seats_cancelled: number + }>(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotCancelCopilotSeatAssignmentForTeams( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + copilotCancelCopilotSeatAssignmentForTeamsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotAddCopilotSeatsForUsersParamSchema = z.object({ + org: z.string(), + }) + + const copilotAddCopilotSeatsForUsersRequestBodySchema = z.object({ + selected_usernames: z.array(z.string()).min(1), + }) + + const copilotAddCopilotSeatsForUsersResponseBodyValidator = + responseValidationFactory( + [ + ["201", z.object({ seats_created: z.coerce.number() })], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotAddCopilotSeatsForUsers + router.post( + `/orgs/:org/copilot/billing/selected_users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotAddCopilotSeatsForUsersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + copilotAddCopilotSeatsForUsersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse<{ + seats_created: number + }>(201) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotAddCopilotSeatsForUsers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + copilotAddCopilotSeatsForUsersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotCancelCopilotSeatAssignmentForUsersParamSchema = z.object({ + org: z.string(), + }) + + const copilotCancelCopilotSeatAssignmentForUsersRequestBodySchema = z.object({ + selected_usernames: z.array(z.string()).min(1), + }) + + const copilotCancelCopilotSeatAssignmentForUsersResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.object({ seats_cancelled: z.coerce.number() })], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotCancelCopilotSeatAssignmentForUsers + router.delete( + `/orgs/:org/copilot/billing/selected_users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotCancelCopilotSeatAssignmentForUsersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + copilotCancelCopilotSeatAssignmentForUsersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + seats_cancelled: number + }>(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotCancelCopilotSeatAssignmentForUsers( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + copilotCancelCopilotSeatAssignmentForUsersResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotCopilotMetricsForOrganizationParamSchema = z.object({ + org: z.string(), + }) + + const copilotCopilotMetricsForOrganizationQuerySchema = z.object({ + since: z.string().optional(), + until: z.string().optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(28), + }) + + const copilotCopilotMetricsForOrganizationResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_copilot_usage_metrics_day)], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotCopilotMetricsForOrganization + router.get( + `/orgs/:org/copilot/metrics`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotCopilotMetricsForOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + copilotCopilotMetricsForOrganizationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotCopilotMetricsForOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + copilotCopilotMetricsForOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotListAlertsForOrgParamSchema = z.object({ org: z.string() }) + + const dependabotListAlertsForOrgQuerySchema = z.object({ + state: z.string().optional(), + severity: z.string().optional(), + ecosystem: z.string().optional(), + package: z.string().optional(), + epss_percentage: z.string().optional(), + scope: z.enum(["development", "runtime"]).optional(), + sort: z + .enum(["created", "updated", "epss_percentage"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + before: z.string().optional(), + after: z.string().optional(), + first: z.coerce.number().min(1).max(100).optional().default(30), + last: z.coerce.number().min(1).max(100).optional(), + per_page: z.coerce.number().optional().default(30), + }) + + const dependabotListAlertsForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_dependabot_alert_with_repository)], + ["304", z.undefined()], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // dependabotListAlertsForOrg + router.get( + `/orgs/:org/dependabot/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotListAlertsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + dependabotListAlertsForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_dependabot_alert_with_repository[] + >(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotListAlertsForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotListAlertsForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotListOrgSecretsParamSchema = z.object({ org: z.string() }) + + const dependabotListOrgSecretsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const dependabotListOrgSecretsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_organization_dependabot_secret), + }), + ], + ], + undefined, + ) + + // dependabotListOrgSecrets + router.get( + `/orgs/:org/dependabot/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotListOrgSecretsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + dependabotListOrgSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_organization_dependabot_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotListOrgSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependabotListOrgSecretsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotGetOrgPublicKeyParamSchema = z.object({ org: z.string() }) + + const dependabotGetOrgPublicKeyResponseBodyValidator = + responseValidationFactory([["200", s_dependabot_public_key]], undefined) + + // dependabotGetOrgPublicKey + router.get( + `/orgs/:org/dependabot/secrets/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotGetOrgPublicKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotGetOrgPublicKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependabotGetOrgPublicKeyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotGetOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const dependabotGetOrgSecretResponseBodyValidator = responseValidationFactory( + [["200", s_organization_dependabot_secret]], + undefined, + ) + + // dependabotGetOrgSecret + router.get( + `/orgs/:org/dependabot/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotGetOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotGetOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependabotGetOrgSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotCreateOrUpdateOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const dependabotCreateOrUpdateOrgSecretRequestBodySchema = z.object({ + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ) + .optional(), + key_id: z.string().optional(), + visibility: z.enum(["all", "private", "selected"]), + selected_repository_ids: z.array(z.string()).optional(), + }) + + const dependabotCreateOrUpdateOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["204", z.undefined()], + ], + undefined, + ) + + // dependabotCreateOrUpdateOrgSecret + router.put( + `/orgs/:org/dependabot/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotCreateOrUpdateOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + dependabotCreateOrUpdateOrgSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotCreateOrUpdateOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotCreateOrUpdateOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotDeleteOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const dependabotDeleteOrgSecretResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // dependabotDeleteOrgSecret + router.delete( + `/orgs/:org/dependabot/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotDeleteOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotDeleteOrgSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependabotDeleteOrgSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotListSelectedReposForOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const dependabotListSelectedReposForOrgSecretQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const dependabotListSelectedReposForOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repositories: z.array(s_minimal_repository), + }), + ], + ], + undefined, + ) + + // dependabotListSelectedReposForOrgSecret + router.get( + `/orgs/:org/dependabot/secrets/:secret_name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotListSelectedReposForOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + dependabotListSelectedReposForOrgSecretQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotListSelectedReposForOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotListSelectedReposForOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotSetSelectedReposForOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const dependabotSetSelectedReposForOrgSecretRequestBodySchema = z.object({ + selected_repository_ids: z.array(z.coerce.number()), + }) + + const dependabotSetSelectedReposForOrgSecretResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // dependabotSetSelectedReposForOrgSecret + router.put( + `/orgs/:org/dependabot/secrets/:secret_name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotSetSelectedReposForOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + dependabotSetSelectedReposForOrgSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotSetSelectedReposForOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotSetSelectedReposForOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotAddSelectedRepoToOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + repository_id: z.coerce.number(), + }) + + const dependabotAddSelectedRepoToOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // dependabotAddSelectedRepoToOrgSecret + router.put( + `/orgs/:org/dependabot/secrets/:secret_name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotAddSelectedRepoToOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotAddSelectedRepoToOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotAddSelectedRepoToOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotRemoveSelectedRepoFromOrgSecretParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + repository_id: z.coerce.number(), + }) + + const dependabotRemoveSelectedRepoFromOrgSecretResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // dependabotRemoveSelectedRepoFromOrgSecret + router.delete( + `/orgs/:org/dependabot/secrets/:secret_name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotRemoveSelectedRepoFromOrgSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotRemoveSelectedRepoFromOrgSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotRemoveSelectedRepoFromOrgSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesListDockerMigrationConflictingPackagesForOrganizationParamSchema = + z.object({ org: z.string() }) + + const packagesListDockerMigrationConflictingPackagesForOrganizationResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_package)], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // packagesListDockerMigrationConflictingPackagesForOrganization + router.get( + `/orgs/:org/docker/conflicts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesListDockerMigrationConflictingPackagesForOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesListDockerMigrationConflictingPackagesForOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesListDockerMigrationConflictingPackagesForOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListPublicOrgEventsParamSchema = z.object({ org: z.string() }) + + const activityListPublicOrgEventsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListPublicOrgEventsResponseBodyValidator = + responseValidationFactory([["200", z.array(s_event)]], undefined) + + // activityListPublicOrgEvents + router.get( + `/orgs/:org/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListPublicOrgEventsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListPublicOrgEventsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListPublicOrgEvents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListPublicOrgEventsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListFailedInvitationsParamSchema = z.object({ org: z.string() }) + + const orgsListFailedInvitationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListFailedInvitationsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_organization_invitation)], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsListFailedInvitations + router.get( + `/orgs/:org/failed_invitations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListFailedInvitationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListFailedInvitationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListFailedInvitations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListFailedInvitationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListWebhooksParamSchema = z.object({ org: z.string() }) + + const orgsListWebhooksQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListWebhooksResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_org_hook)], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsListWebhooks + router.get( + `/orgs/:org/hooks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListWebhooksParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListWebhooksQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListWebhooks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListWebhooksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCreateWebhookParamSchema = z.object({ org: z.string() }) + + const orgsCreateWebhookRequestBodySchema = z.object({ + name: z.string(), + config: z.object({ + url: s_webhook_config_url, + content_type: s_webhook_config_content_type.optional(), + secret: s_webhook_config_secret.optional(), + insecure_ssl: s_webhook_config_insecure_ssl.optional(), + username: z.string().optional(), + password: z.string().optional(), + }), + events: z.array(z.string()).optional().default(["push"]), + active: PermissiveBoolean.optional().default(true), + }) + + const orgsCreateWebhookResponseBodyValidator = responseValidationFactory( + [ + ["201", s_org_hook], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsCreateWebhook + router.post( + `/orgs/:org/hooks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCreateWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsCreateWebhookRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCreateWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsCreateWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetWebhookParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + }) + + const orgsGetWebhookResponseBodyValidator = responseValidationFactory( + [ + ["200", s_org_hook], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsGetWebhook + router.get( + `/orgs/:org/hooks/:hook_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsGetWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsUpdateWebhookParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + }) + + const orgsUpdateWebhookRequestBodySchema = z + .object({ + config: z + .object({ + url: s_webhook_config_url, + content_type: s_webhook_config_content_type.optional(), + secret: s_webhook_config_secret.optional(), + insecure_ssl: s_webhook_config_insecure_ssl.optional(), + }) + .optional(), + events: z.array(z.string()).optional().default(["push"]), + active: PermissiveBoolean.optional().default(true), + name: z.string().optional(), + }) + .optional() + + const orgsUpdateWebhookResponseBodyValidator = responseValidationFactory( + [ + ["200", s_org_hook], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsUpdateWebhook + router.patch( + `/orgs/:org/hooks/:hook_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsUpdateWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsUpdateWebhookRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsUpdateWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsUpdateWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsDeleteWebhookParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + }) + + const orgsDeleteWebhookResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsDeleteWebhook + router.delete( + `/orgs/:org/hooks/:hook_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsDeleteWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsDeleteWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsDeleteWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetWebhookConfigForOrgParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + }) + + const orgsGetWebhookConfigForOrgResponseBodyValidator = + responseValidationFactory([["200", s_webhook_config]], undefined) + + // orgsGetWebhookConfigForOrg + router.get( + `/orgs/:org/hooks/:hook_id/config`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetWebhookConfigForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetWebhookConfigForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsGetWebhookConfigForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsUpdateWebhookConfigForOrgParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + }) + + const orgsUpdateWebhookConfigForOrgRequestBodySchema = z + .object({ + url: s_webhook_config_url.optional(), + content_type: s_webhook_config_content_type.optional(), + secret: s_webhook_config_secret.optional(), + insecure_ssl: s_webhook_config_insecure_ssl.optional(), + }) + .optional() + + const orgsUpdateWebhookConfigForOrgResponseBodyValidator = + responseValidationFactory([["200", s_webhook_config]], undefined) + + // orgsUpdateWebhookConfigForOrg + router.patch( + `/orgs/:org/hooks/:hook_id/config`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsUpdateWebhookConfigForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsUpdateWebhookConfigForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsUpdateWebhookConfigForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsUpdateWebhookConfigForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListWebhookDeliveriesParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + }) + + const orgsListWebhookDeliveriesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + cursor: z.string().optional(), + }) + + const orgsListWebhookDeliveriesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_hook_delivery_item)], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsListWebhookDeliveries + router.get( + `/orgs/:org/hooks/:hook_id/deliveries`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListWebhookDeliveriesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListWebhookDeliveriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListWebhookDeliveries(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListWebhookDeliveriesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetWebhookDeliveryParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + delivery_id: z.coerce.number(), + }) + + const orgsGetWebhookDeliveryResponseBodyValidator = responseValidationFactory( + [ + ["200", s_hook_delivery], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsGetWebhookDelivery + router.get( + `/orgs/:org/hooks/:hook_id/deliveries/:delivery_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetWebhookDeliveryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetWebhookDelivery(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsGetWebhookDeliveryResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRedeliverWebhookDeliveryParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + delivery_id: z.coerce.number(), + }) + + const orgsRedeliverWebhookDeliveryResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsRedeliverWebhookDelivery + router.post( + `/orgs/:org/hooks/:hook_id/deliveries/:delivery_id/attempts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRedeliverWebhookDeliveryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRedeliverWebhookDelivery(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsRedeliverWebhookDeliveryResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsPingWebhookParamSchema = z.object({ + org: z.string(), + hook_id: z.coerce.number(), + }) + + const orgsPingWebhookResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsPingWebhook + router.post( + `/orgs/:org/hooks/:hook_id/pings`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsPingWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsPingWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsPingWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetRouteStatsByActorParamSchema = z.object({ + org: z.string(), + actor_type: z.enum([ + "installation", + "classic_pat", + "fine_grained_pat", + "oauth_app", + "github_app_user_to_server", + ]), + actor_id: z.coerce.number(), + }) + + const apiInsightsGetRouteStatsByActorQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + sort: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z + .enum([ + "last_rate_limited_timestamp", + "last_request_timestamp", + "rate_limited_request_count", + "http_method", + "api_route", + "total_request_count", + ]) + .default("total_request_count"), + ), + ) + .optional(), + api_route_substring: z.string().optional(), + }) + + const apiInsightsGetRouteStatsByActorResponseBodyValidator = + responseValidationFactory([["200", s_api_insights_route_stats]], undefined) + + // apiInsightsGetRouteStatsByActor + router.get( + `/orgs/:org/insights/api/route-stats/:actor_type/:actor_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetRouteStatsByActorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetRouteStatsByActorQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetRouteStatsByActor(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + apiInsightsGetRouteStatsByActorResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetSubjectStatsParamSchema = z.object({ org: z.string() }) + + const apiInsightsGetSubjectStatsQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + sort: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z + .enum([ + "last_rate_limited_timestamp", + "last_request_timestamp", + "rate_limited_request_count", + "subject_name", + "total_request_count", + ]) + .default("total_request_count"), + ), + ) + .optional(), + subject_name_substring: z.string().optional(), + }) + + const apiInsightsGetSubjectStatsResponseBodyValidator = + responseValidationFactory( + [["200", s_api_insights_subject_stats]], + undefined, + ) + + // apiInsightsGetSubjectStats + router.get( + `/orgs/:org/insights/api/subject-stats`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetSubjectStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetSubjectStatsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetSubjectStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + apiInsightsGetSubjectStatsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetSummaryStatsParamSchema = z.object({ org: z.string() }) + + const apiInsightsGetSummaryStatsQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + }) + + const apiInsightsGetSummaryStatsResponseBodyValidator = + responseValidationFactory( + [["200", s_api_insights_summary_stats]], + undefined, + ) + + // apiInsightsGetSummaryStats + router.get( + `/orgs/:org/insights/api/summary-stats`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetSummaryStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetSummaryStatsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetSummaryStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + apiInsightsGetSummaryStatsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetSummaryStatsByUserParamSchema = z.object({ + org: z.string(), + user_id: z.string(), + }) + + const apiInsightsGetSummaryStatsByUserQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + }) + + const apiInsightsGetSummaryStatsByUserResponseBodyValidator = + responseValidationFactory( + [["200", s_api_insights_summary_stats]], + undefined, + ) + + // apiInsightsGetSummaryStatsByUser + router.get( + `/orgs/:org/insights/api/summary-stats/users/:user_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetSummaryStatsByUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetSummaryStatsByUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetSummaryStatsByUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + apiInsightsGetSummaryStatsByUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetSummaryStatsByActorParamSchema = z.object({ + org: z.string(), + actor_type: z.enum([ + "installation", + "classic_pat", + "fine_grained_pat", + "oauth_app", + "github_app_user_to_server", + ]), + actor_id: z.coerce.number(), + }) + + const apiInsightsGetSummaryStatsByActorQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + }) + + const apiInsightsGetSummaryStatsByActorResponseBodyValidator = + responseValidationFactory( + [["200", s_api_insights_summary_stats]], + undefined, + ) + + // apiInsightsGetSummaryStatsByActor + router.get( + `/orgs/:org/insights/api/summary-stats/:actor_type/:actor_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetSummaryStatsByActorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetSummaryStatsByActorQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetSummaryStatsByActor(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + apiInsightsGetSummaryStatsByActorResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetTimeStatsParamSchema = z.object({ org: z.string() }) + + const apiInsightsGetTimeStatsQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + timestamp_increment: z.string(), + }) + + const apiInsightsGetTimeStatsResponseBodyValidator = + responseValidationFactory([["200", s_api_insights_time_stats]], undefined) + + // apiInsightsGetTimeStats + router.get( + `/orgs/:org/insights/api/time-stats`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetTimeStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetTimeStatsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetTimeStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(apiInsightsGetTimeStatsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetTimeStatsByUserParamSchema = z.object({ + org: z.string(), + user_id: z.string(), + }) + + const apiInsightsGetTimeStatsByUserQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + timestamp_increment: z.string(), + }) + + const apiInsightsGetTimeStatsByUserResponseBodyValidator = + responseValidationFactory([["200", s_api_insights_time_stats]], undefined) + + // apiInsightsGetTimeStatsByUser + router.get( + `/orgs/:org/insights/api/time-stats/users/:user_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetTimeStatsByUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetTimeStatsByUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetTimeStatsByUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + apiInsightsGetTimeStatsByUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetTimeStatsByActorParamSchema = z.object({ + org: z.string(), + actor_type: z.enum([ + "installation", + "classic_pat", + "fine_grained_pat", + "oauth_app", + "github_app_user_to_server", + ]), + actor_id: z.coerce.number(), + }) + + const apiInsightsGetTimeStatsByActorQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + timestamp_increment: z.string(), + }) + + const apiInsightsGetTimeStatsByActorResponseBodyValidator = + responseValidationFactory([["200", s_api_insights_time_stats]], undefined) + + // apiInsightsGetTimeStatsByActor + router.get( + `/orgs/:org/insights/api/time-stats/:actor_type/:actor_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetTimeStatsByActorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetTimeStatsByActorQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetTimeStatsByActor(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + apiInsightsGetTimeStatsByActorResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const apiInsightsGetUserStatsParamSchema = z.object({ + org: z.string(), + user_id: z.string(), + }) + + const apiInsightsGetUserStatsQuerySchema = z.object({ + min_timestamp: z.string(), + max_timestamp: z.string().optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + sort: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z + .enum([ + "last_rate_limited_timestamp", + "last_request_timestamp", + "rate_limited_request_count", + "subject_name", + "total_request_count", + ]) + .default("total_request_count"), + ), + ) + .optional(), + actor_name_substring: z.string().optional(), + }) + + const apiInsightsGetUserStatsResponseBodyValidator = + responseValidationFactory([["200", s_api_insights_user_stats]], undefined) + + // apiInsightsGetUserStats + router.get( + `/orgs/:org/insights/api/user-stats/:user_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + apiInsightsGetUserStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + apiInsightsGetUserStatsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .apiInsightsGetUserStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(apiInsightsGetUserStatsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetOrgInstallationParamSchema = z.object({ org: z.string() }) + + const appsGetOrgInstallationResponseBodyValidator = responseValidationFactory( + [["200", s_installation]], + undefined, + ) + + // appsGetOrgInstallation + router.get( + `/orgs/:org/installation`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsGetOrgInstallationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetOrgInstallation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsGetOrgInstallationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListAppInstallationsParamSchema = z.object({ org: z.string() }) + + const orgsListAppInstallationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListAppInstallationsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + installations: z.array(s_installation), + }), + ], + ], + undefined, + ) + + // orgsListAppInstallations + router.get( + `/orgs/:org/installations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListAppInstallationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListAppInstallationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + installations: t_installation[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListAppInstallations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListAppInstallationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsGetRestrictionsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const interactionsGetRestrictionsForOrgResponseBodyValidator = + responseValidationFactory( + [["200", z.union([s_interaction_limit_response, z.object({})])]], + undefined, + ) + + // interactionsGetRestrictionsForOrg + router.get( + `/orgs/:org/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + interactionsGetRestrictionsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_interaction_limit_response | EmptyObject + >(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsGetRestrictionsForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsGetRestrictionsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsSetRestrictionsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const interactionsSetRestrictionsForOrgRequestBodySchema = s_interaction_limit + + const interactionsSetRestrictionsForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_interaction_limit_response], + ["422", s_validation_error], + ], + undefined, + ) + + // interactionsSetRestrictionsForOrg + router.put( + `/orgs/:org/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + interactionsSetRestrictionsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + interactionsSetRestrictionsForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsSetRestrictionsForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsSetRestrictionsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsRemoveRestrictionsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const interactionsRemoveRestrictionsForOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // interactionsRemoveRestrictionsForOrg + router.delete( + `/orgs/:org/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + interactionsRemoveRestrictionsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsRemoveRestrictionsForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsRemoveRestrictionsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListPendingInvitationsParamSchema = z.object({ org: z.string() }) + + const orgsListPendingInvitationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + role: z + .enum([ + "all", + "admin", + "direct_member", + "billing_manager", + "hiring_manager", + ]) + .optional() + .default("all"), + invitation_source: z + .enum(["all", "member", "scim"]) + .optional() + .default("all"), + }) + + const orgsListPendingInvitationsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_organization_invitation)], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsListPendingInvitations + router.get( + `/orgs/:org/invitations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListPendingInvitationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListPendingInvitationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListPendingInvitations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsListPendingInvitationsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCreateInvitationParamSchema = z.object({ org: z.string() }) + + const orgsCreateInvitationRequestBodySchema = z + .object({ + invitee_id: z.coerce.number().optional(), + email: z.string().optional(), + role: z + .enum(["admin", "direct_member", "billing_manager", "reinstate"]) + .optional() + .default("direct_member"), + team_ids: z.array(z.coerce.number()).optional(), + }) + .optional() + + const orgsCreateInvitationResponseBodyValidator = responseValidationFactory( + [ + ["201", s_organization_invitation], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsCreateInvitation + router.post( + `/orgs/:org/invitations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCreateInvitationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsCreateInvitationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCreateInvitation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsCreateInvitationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCancelInvitationParamSchema = z.object({ + org: z.string(), + invitation_id: z.coerce.number(), + }) + + const orgsCancelInvitationResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsCancelInvitation + router.delete( + `/orgs/:org/invitations/:invitation_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCancelInvitationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCancelInvitation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsCancelInvitationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListInvitationTeamsParamSchema = z.object({ + org: z.string(), + invitation_id: z.coerce.number(), + }) + + const orgsListInvitationTeamsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListInvitationTeamsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_team)], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsListInvitationTeams + router.get( + `/orgs/:org/invitations/:invitation_id/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListInvitationTeamsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListInvitationTeamsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListInvitationTeams(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListInvitationTeamsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListIssueTypesParamSchema = z.object({ org: z.string() }) + + const orgsListIssueTypesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_issue_type)], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsListIssueTypes + router.get( + `/orgs/:org/issue-types`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListIssueTypesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListIssueTypes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListIssueTypesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCreateIssueTypeParamSchema = z.object({ org: z.string() }) + + const orgsCreateIssueTypeRequestBodySchema = s_organization_create_issue_type + + const orgsCreateIssueTypeResponseBodyValidator = responseValidationFactory( + [ + ["200", s_issue_type], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // orgsCreateIssueType + router.post( + `/orgs/:org/issue-types`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCreateIssueTypeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsCreateIssueTypeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCreateIssueType(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsCreateIssueTypeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsUpdateIssueTypeParamSchema = z.object({ + org: z.string(), + issue_type_id: z.coerce.number(), + }) + + const orgsUpdateIssueTypeRequestBodySchema = s_organization_update_issue_type + + const orgsUpdateIssueTypeResponseBodyValidator = responseValidationFactory( + [ + ["200", s_issue_type], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // orgsUpdateIssueType + router.put( + `/orgs/:org/issue-types/:issue_type_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsUpdateIssueTypeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsUpdateIssueTypeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsUpdateIssueType(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsUpdateIssueTypeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsDeleteIssueTypeParamSchema = z.object({ + org: z.string(), + issue_type_id: z.coerce.number(), + }) + + const orgsDeleteIssueTypeResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // orgsDeleteIssueType + router.delete( + `/orgs/:org/issue-types/:issue_type_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsDeleteIssueTypeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsDeleteIssueType(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsDeleteIssueTypeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListForOrgParamSchema = z.object({ org: z.string() }) + + const issuesListForOrgQuerySchema = z.object({ + filter: z + .enum(["assigned", "created", "mentioned", "subscribed", "repos", "all"]) + .optional() + .default("assigned"), + state: z.enum(["open", "closed", "all"]).optional().default("open"), + labels: z.string().optional(), + type: z.string().optional(), + sort: z + .enum(["created", "updated", "comments"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListForOrgResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_issue)], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesListForOrg + router.get( + `/orgs/:org/issues`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListForOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListMembersParamSchema = z.object({ org: z.string() }) + + const orgsListMembersQuerySchema = z.object({ + filter: z.enum(["2fa_disabled", "all"]).optional().default("all"), + role: z.enum(["all", "admin", "member"]).optional().default("all"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListMembersResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsListMembers + router.get( + `/orgs/:org/members`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListMembersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListMembersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListMembers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListMembersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCheckMembershipForUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsCheckMembershipForUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["302", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // orgsCheckMembershipForUser + router.get( + `/orgs/:org/members/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCheckMembershipForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with302() { + return new ExpressRuntimeResponse(302) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCheckMembershipForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsCheckMembershipForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRemoveMemberParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsRemoveMemberResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ], + undefined, + ) + + // orgsRemoveMember + router.delete( + `/orgs/:org/members/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRemoveMemberParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRemoveMember(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsRemoveMemberResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetCodespacesForUserInOrgParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const codespacesGetCodespacesForUserInOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const codespacesGetCodespacesForUserInOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + codespaces: z.array(s_codespace), + }), + ], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesGetCodespacesForUserInOrg + router.get( + `/orgs/:org/members/:username/codespaces`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesGetCodespacesForUserInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesGetCodespacesForUserInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + codespaces: t_codespace[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetCodespacesForUserInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesGetCodespacesForUserInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesDeleteFromOrganizationParamSchema = z.object({ + org: z.string(), + username: z.string(), + codespace_name: z.string(), + }) + + const codespacesDeleteFromOrganizationResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesDeleteFromOrganization + router.delete( + `/orgs/:org/members/:username/codespaces/:codespace_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesDeleteFromOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesDeleteFromOrganization(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesDeleteFromOrganizationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesStopInOrganizationParamSchema = z.object({ + org: z.string(), + username: z.string(), + codespace_name: z.string(), + }) + + const codespacesStopInOrganizationResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_codespace], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesStopInOrganization + router.post( + `/orgs/:org/members/:username/codespaces/:codespace_name/stop`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesStopInOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesStopInOrganization(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesStopInOrganizationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotGetCopilotSeatDetailsForUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const copilotGetCopilotSeatDetailsForUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_copilot_seat_details], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotGetCopilotSeatDetailsForUser + router.get( + `/orgs/:org/members/:username/copilot`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotGetCopilotSeatDetailsForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotGetCopilotSeatDetailsForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + copilotGetCopilotSeatDetailsForUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetMembershipForUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsGetMembershipForUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_org_membership], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsGetMembershipForUser + router.get( + `/orgs/:org/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetMembershipForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetMembershipForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsGetMembershipForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsSetMembershipForUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsSetMembershipForUserRequestBodySchema = z + .object({ role: z.enum(["admin", "member"]).optional().default("member") }) + .optional() + + const orgsSetMembershipForUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_org_membership], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsSetMembershipForUser + router.put( + `/orgs/:org/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsSetMembershipForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsSetMembershipForUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsSetMembershipForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsSetMembershipForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRemoveMembershipForUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsRemoveMembershipForUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsRemoveMembershipForUser + router.delete( + `/orgs/:org/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRemoveMembershipForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRemoveMembershipForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsRemoveMembershipForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsListForOrgParamSchema = z.object({ org: z.string() }) + + const migrationsListForOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.enum(["repositories"])), + ) + .optional(), + }) + + const migrationsListForOrgResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_migration)]], + undefined, + ) + + // migrationsListForOrg + router.get( + `/orgs/:org/migrations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsListForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + migrationsListForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsListForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsListForOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsStartForOrgParamSchema = z.object({ org: z.string() }) + + const migrationsStartForOrgRequestBodySchema = z.object({ + repositories: z.array(z.string()), + lock_repositories: PermissiveBoolean.optional().default(false), + exclude_metadata: PermissiveBoolean.optional().default(false), + exclude_git_data: PermissiveBoolean.optional().default(false), + exclude_attachments: PermissiveBoolean.optional().default(false), + exclude_releases: PermissiveBoolean.optional().default(false), + exclude_owner_projects: PermissiveBoolean.optional().default(false), + org_metadata_only: PermissiveBoolean.optional().default(false), + exclude: z.array(z.enum(["repositories"])).optional(), + }) + + const migrationsStartForOrgResponseBodyValidator = responseValidationFactory( + [ + ["201", s_migration], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // migrationsStartForOrg + router.post( + `/orgs/:org/migrations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsStartForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + migrationsStartForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsStartForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsStartForOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsGetStatusForOrgParamSchema = z.object({ + org: z.string(), + migration_id: z.coerce.number(), + }) + + const migrationsGetStatusForOrgQuerySchema = z.object({ + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.enum(["repositories"])), + ) + .optional(), + }) + + const migrationsGetStatusForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_migration], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsGetStatusForOrg + router.get( + `/orgs/:org/migrations/:migration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsGetStatusForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + migrationsGetStatusForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsGetStatusForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsGetStatusForOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsDownloadArchiveForOrgParamSchema = z.object({ + org: z.string(), + migration_id: z.coerce.number(), + }) + + const migrationsDownloadArchiveForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["302", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsDownloadArchiveForOrg + router.get( + `/orgs/:org/migrations/:migration_id/archive`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsDownloadArchiveForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with302() { + return new ExpressRuntimeResponse(302) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsDownloadArchiveForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsDownloadArchiveForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsDeleteArchiveForOrgParamSchema = z.object({ + org: z.string(), + migration_id: z.coerce.number(), + }) + + const migrationsDeleteArchiveForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsDeleteArchiveForOrg + router.delete( + `/orgs/:org/migrations/:migration_id/archive`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsDeleteArchiveForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsDeleteArchiveForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsDeleteArchiveForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsUnlockRepoForOrgParamSchema = z.object({ + org: z.string(), + migration_id: z.coerce.number(), + repo_name: z.string(), + }) + + const migrationsUnlockRepoForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsUnlockRepoForOrg + router.delete( + `/orgs/:org/migrations/:migration_id/repos/:repo_name/lock`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsUnlockRepoForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsUnlockRepoForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsUnlockRepoForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsListReposForOrgParamSchema = z.object({ + org: z.string(), + migration_id: z.coerce.number(), + }) + + const migrationsListReposForOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const migrationsListReposForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_minimal_repository)], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsListReposForOrg + router.get( + `/orgs/:org/migrations/:migration_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsListReposForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + migrationsListReposForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsListReposForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsListReposForOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListOrgRolesParamSchema = z.object({ org: z.string() }) + + const orgsListOrgRolesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number().optional(), + roles: z.array(s_organization_role).optional(), + }), + ], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsListOrgRoles + router.get( + `/orgs/:org/organization-roles`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListOrgRolesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + roles?: t_organization_role[] | undefined + total_count?: number | undefined + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListOrgRoles(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListOrgRolesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRevokeAllOrgRolesTeamParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const orgsRevokeAllOrgRolesTeamResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // orgsRevokeAllOrgRolesTeam + router.delete( + `/orgs/:org/organization-roles/teams/:team_slug`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRevokeAllOrgRolesTeamParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRevokeAllOrgRolesTeam(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsRevokeAllOrgRolesTeamResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsAssignTeamToOrgRoleParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + role_id: z.coerce.number(), + }) + + const orgsAssignTeamToOrgRoleResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // orgsAssignTeamToOrgRole + router.put( + `/orgs/:org/organization-roles/teams/:team_slug/:role_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsAssignTeamToOrgRoleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsAssignTeamToOrgRole(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsAssignTeamToOrgRoleResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRevokeOrgRoleTeamParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + role_id: z.coerce.number(), + }) + + const orgsRevokeOrgRoleTeamResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // orgsRevokeOrgRoleTeam + router.delete( + `/orgs/:org/organization-roles/teams/:team_slug/:role_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRevokeOrgRoleTeamParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRevokeOrgRoleTeam(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsRevokeOrgRoleTeamResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRevokeAllOrgRolesUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsRevokeAllOrgRolesUserResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // orgsRevokeAllOrgRolesUser + router.delete( + `/orgs/:org/organization-roles/users/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRevokeAllOrgRolesUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRevokeAllOrgRolesUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsRevokeAllOrgRolesUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsAssignUserToOrgRoleParamSchema = z.object({ + org: z.string(), + username: z.string(), + role_id: z.coerce.number(), + }) + + const orgsAssignUserToOrgRoleResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // orgsAssignUserToOrgRole + router.put( + `/orgs/:org/organization-roles/users/:username/:role_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsAssignUserToOrgRoleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsAssignUserToOrgRole(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsAssignUserToOrgRoleResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRevokeOrgRoleUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + role_id: z.coerce.number(), + }) + + const orgsRevokeOrgRoleUserResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // orgsRevokeOrgRoleUser + router.delete( + `/orgs/:org/organization-roles/users/:username/:role_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRevokeOrgRoleUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRevokeOrgRoleUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsRevokeOrgRoleUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetOrgRoleParamSchema = z.object({ + org: z.string(), + role_id: z.coerce.number(), + }) + + const orgsGetOrgRoleResponseBodyValidator = responseValidationFactory( + [ + ["200", s_organization_role], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsGetOrgRole + router.get( + `/orgs/:org/organization-roles/:role_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetOrgRoleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetOrgRole(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsGetOrgRoleResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListOrgRoleTeamsParamSchema = z.object({ + org: z.string(), + role_id: z.coerce.number(), + }) + + const orgsListOrgRoleTeamsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListOrgRoleTeamsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_team_role_assignment)], + ["404", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // orgsListOrgRoleTeams + router.get( + `/orgs/:org/organization-roles/:role_id/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListOrgRoleTeamsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListOrgRoleTeamsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListOrgRoleTeams(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListOrgRoleTeamsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListOrgRoleUsersParamSchema = z.object({ + org: z.string(), + role_id: z.coerce.number(), + }) + + const orgsListOrgRoleUsersQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListOrgRoleUsersResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_user_role_assignment)], + ["404", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // orgsListOrgRoleUsers + router.get( + `/orgs/:org/organization-roles/:role_id/users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListOrgRoleUsersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListOrgRoleUsersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListOrgRoleUsers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListOrgRoleUsersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListOutsideCollaboratorsParamSchema = z.object({ org: z.string() }) + + const orgsListOutsideCollaboratorsQuerySchema = z.object({ + filter: z.enum(["2fa_disabled", "all"]).optional().default("all"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListOutsideCollaboratorsResponseBodyValidator = + responseValidationFactory([["200", z.array(s_simple_user)]], undefined) + + // orgsListOutsideCollaborators + router.get( + `/orgs/:org/outside_collaborators`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListOutsideCollaboratorsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListOutsideCollaboratorsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListOutsideCollaborators(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsListOutsideCollaboratorsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsConvertMemberToOutsideCollaboratorParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsConvertMemberToOutsideCollaboratorRequestBodySchema = z + .object({ async: PermissiveBoolean.optional().default(false) }) + .optional() + + const orgsConvertMemberToOutsideCollaboratorResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.object({})], + ["204", z.undefined()], + ["403", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsConvertMemberToOutsideCollaborator + router.put( + `/orgs/:org/outside_collaborators/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsConvertMemberToOutsideCollaboratorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsConvertMemberToOutsideCollaboratorRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsConvertMemberToOutsideCollaborator( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsConvertMemberToOutsideCollaboratorResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRemoveOutsideCollaboratorParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsRemoveOutsideCollaboratorResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + [ + "422", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // orgsRemoveOutsideCollaborator + router.delete( + `/orgs/:org/outside_collaborators/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRemoveOutsideCollaboratorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with422() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }>(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRemoveOutsideCollaborator(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsRemoveOutsideCollaboratorResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesListPackagesForOrganizationParamSchema = z.object({ + org: z.string(), + }) + + const packagesListPackagesForOrganizationQuerySchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + visibility: z.enum(["public", "private", "internal"]).optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const packagesListPackagesForOrganizationResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_package)], + ["400", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // packagesListPackagesForOrganization + router.get( + `/orgs/:org/packages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesListPackagesForOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + packagesListPackagesForOrganizationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesListPackagesForOrganization(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesListPackagesForOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetPackageForOrganizationParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + org: z.string(), + }) + + const packagesGetPackageForOrganizationResponseBodyValidator = + responseValidationFactory([["200", s_package]], undefined) + + // packagesGetPackageForOrganization + router.get( + `/orgs/:org/packages/:package_type/:package_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetPackageForOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetPackageForOrganization(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesGetPackageForOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesDeletePackageForOrgParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + org: z.string(), + }) + + const packagesDeletePackageForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesDeletePackageForOrg + router.delete( + `/orgs/:org/packages/:package_type/:package_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesDeletePackageForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesDeletePackageForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesDeletePackageForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesRestorePackageForOrgParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + org: z.string(), + }) + + const packagesRestorePackageForOrgQuerySchema = z.object({ + token: z.string().optional(), + }) + + const packagesRestorePackageForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesRestorePackageForOrg + router.post( + `/orgs/:org/packages/:package_type/:package_name/restore`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesRestorePackageForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + packagesRestorePackageForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesRestorePackageForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesRestorePackageForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetAllPackageVersionsForPackageOwnedByOrgParamSchema = z.object( + { + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + org: z.string(), + }, + ) + + const packagesGetAllPackageVersionsForPackageOwnedByOrgQuerySchema = z.object( + { + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + state: z.enum(["active", "deleted"]).optional().default("active"), + }, + ) + + const packagesGetAllPackageVersionsForPackageOwnedByOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_package_version)], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesGetAllPackageVersionsForPackageOwnedByOrg + router.get( + `/orgs/:org/packages/:package_type/:package_name/versions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetAllPackageVersionsForPackageOwnedByOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + packagesGetAllPackageVersionsForPackageOwnedByOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetAllPackageVersionsForPackageOwnedByOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesGetAllPackageVersionsForPackageOwnedByOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetPackageVersionForOrganizationParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + org: z.string(), + package_version_id: z.coerce.number(), + }) + + const packagesGetPackageVersionForOrganizationResponseBodyValidator = + responseValidationFactory([["200", s_package_version]], undefined) + + // packagesGetPackageVersionForOrganization + router.get( + `/orgs/:org/packages/:package_type/:package_name/versions/:package_version_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetPackageVersionForOrganizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetPackageVersionForOrganization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesGetPackageVersionForOrganizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesDeletePackageVersionForOrgParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + org: z.string(), + package_version_id: z.coerce.number(), + }) + + const packagesDeletePackageVersionForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesDeletePackageVersionForOrg + router.delete( + `/orgs/:org/packages/:package_type/:package_name/versions/:package_version_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesDeletePackageVersionForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesDeletePackageVersionForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesDeletePackageVersionForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesRestorePackageVersionForOrgParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + org: z.string(), + package_version_id: z.coerce.number(), + }) + + const packagesRestorePackageVersionForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesRestorePackageVersionForOrg + router.post( + `/orgs/:org/packages/:package_type/:package_name/versions/:package_version_id/restore`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesRestorePackageVersionForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesRestorePackageVersionForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesRestorePackageVersionForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListPatGrantRequestsParamSchema = z.object({ org: z.string() }) + + const orgsListPatGrantRequestsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + sort: z.enum(["created_at"]).optional().default("created_at"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + owner: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()).max(10), + ) + .optional(), + repository: z.string().optional(), + permission: z.string().optional(), + last_used_before: z.string().datetime({ offset: true }).optional(), + last_used_after: z.string().datetime({ offset: true }).optional(), + token_id: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()).max(50), + ) + .optional(), + }) + + const orgsListPatGrantRequestsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_organization_programmatic_access_grant_request)], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsListPatGrantRequests + router.get( + `/orgs/:org/personal-access-token-requests`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListPatGrantRequestsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListPatGrantRequestsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_organization_programmatic_access_grant_request[] + >(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListPatGrantRequests(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListPatGrantRequestsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsReviewPatGrantRequestsInBulkParamSchema = z.object({ + org: z.string(), + }) + + const orgsReviewPatGrantRequestsInBulkRequestBodySchema = z.object({ + pat_request_ids: z.array(z.coerce.number()).min(1).max(100).optional(), + action: z.enum(["approve", "deny"]), + reason: z.string().max(1024).nullable().optional(), + }) + + const orgsReviewPatGrantRequestsInBulkResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsReviewPatGrantRequestsInBulk + router.post( + `/orgs/:org/personal-access-token-requests`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsReviewPatGrantRequestsInBulkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsReviewPatGrantRequestsInBulkRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsReviewPatGrantRequestsInBulk(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsReviewPatGrantRequestsInBulkResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsReviewPatGrantRequestParamSchema = z.object({ + org: z.string(), + pat_request_id: z.coerce.number(), + }) + + const orgsReviewPatGrantRequestRequestBodySchema = z.object({ + action: z.enum(["approve", "deny"]), + reason: z.string().max(1024).nullable().optional(), + }) + + const orgsReviewPatGrantRequestResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsReviewPatGrantRequest + router.post( + `/orgs/:org/personal-access-token-requests/:pat_request_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsReviewPatGrantRequestParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsReviewPatGrantRequestRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsReviewPatGrantRequest(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsReviewPatGrantRequestResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListPatGrantRequestRepositoriesParamSchema = z.object({ + org: z.string(), + pat_request_id: z.coerce.number(), + }) + + const orgsListPatGrantRequestRepositoriesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListPatGrantRequestRepositoriesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_minimal_repository)], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsListPatGrantRequestRepositories + router.get( + `/orgs/:org/personal-access-token-requests/:pat_request_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListPatGrantRequestRepositoriesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListPatGrantRequestRepositoriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListPatGrantRequestRepositories(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsListPatGrantRequestRepositoriesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListPatGrantsParamSchema = z.object({ org: z.string() }) + + const orgsListPatGrantsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + sort: z.enum(["created_at"]).optional().default("created_at"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + owner: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()).max(10), + ) + .optional(), + repository: z.string().optional(), + permission: z.string().optional(), + last_used_before: z.string().datetime({ offset: true }).optional(), + last_used_after: z.string().datetime({ offset: true }).optional(), + token_id: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()).max(50), + ) + .optional(), + }) + + const orgsListPatGrantsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_organization_programmatic_access_grant)], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsListPatGrants + router.get( + `/orgs/:org/personal-access-tokens`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListPatGrantsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListPatGrantsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_organization_programmatic_access_grant[] + >(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListPatGrants(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListPatGrantsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsUpdatePatAccessesParamSchema = z.object({ org: z.string() }) + + const orgsUpdatePatAccessesRequestBodySchema = z.object({ + action: z.enum(["revoke"]), + pat_ids: z.array(z.coerce.number()).min(1).max(100), + }) + + const orgsUpdatePatAccessesResponseBodyValidator = responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsUpdatePatAccesses + router.post( + `/orgs/:org/personal-access-tokens`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsUpdatePatAccessesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsUpdatePatAccessesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsUpdatePatAccesses(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsUpdatePatAccessesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsUpdatePatAccessParamSchema = z.object({ + org: z.string(), + pat_id: z.coerce.number(), + }) + + const orgsUpdatePatAccessRequestBodySchema = z.object({ + action: z.enum(["revoke"]), + }) + + const orgsUpdatePatAccessResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsUpdatePatAccess + router.post( + `/orgs/:org/personal-access-tokens/:pat_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsUpdatePatAccessParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsUpdatePatAccessRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsUpdatePatAccess(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsUpdatePatAccessResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListPatGrantRepositoriesParamSchema = z.object({ + org: z.string(), + pat_id: z.coerce.number(), + }) + + const orgsListPatGrantRepositoriesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListPatGrantRepositoriesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_minimal_repository)], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsListPatGrantRepositories + router.get( + `/orgs/:org/personal-access-tokens/:pat_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListPatGrantRepositoriesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListPatGrantRepositoriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListPatGrantRepositories(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsListPatGrantRepositoriesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const privateRegistriesListOrgPrivateRegistriesParamSchema = z.object({ + org: z.string(), + }) + + const privateRegistriesListOrgPrivateRegistriesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const privateRegistriesListOrgPrivateRegistriesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + configurations: z.array(s_org_private_registry_configuration), + }), + ], + ["400", s_scim_error], + ["404", s_basic_error], + ], + undefined, + ) + + // privateRegistriesListOrgPrivateRegistries + router.get( + `/orgs/:org/private-registries`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + privateRegistriesListOrgPrivateRegistriesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + privateRegistriesListOrgPrivateRegistriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + configurations: t_org_private_registry_configuration[] + total_count: number + }>(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .privateRegistriesListOrgPrivateRegistries( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + privateRegistriesListOrgPrivateRegistriesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const privateRegistriesCreateOrgPrivateRegistryParamSchema = z.object({ + org: z.string(), + }) + + const privateRegistriesCreateOrgPrivateRegistryRequestBodySchema = z.object({ + registry_type: z.enum(["maven_repository"]), + username: z.string().nullable().optional(), + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ), + key_id: z.string(), + visibility: z.enum(["all", "private", "selected"]), + selected_repository_ids: z.array(z.coerce.number()).optional(), + }) + + const privateRegistriesCreateOrgPrivateRegistryResponseBodyValidator = + responseValidationFactory( + [ + [ + "201", + s_org_private_registry_configuration_with_selected_repositories, + ], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // privateRegistriesCreateOrgPrivateRegistry + router.post( + `/orgs/:org/private-registries`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + privateRegistriesCreateOrgPrivateRegistryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + privateRegistriesCreateOrgPrivateRegistryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse( + 201, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .privateRegistriesCreateOrgPrivateRegistry( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + privateRegistriesCreateOrgPrivateRegistryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const privateRegistriesGetOrgPublicKeyParamSchema = z.object({ + org: z.string(), + }) + + const privateRegistriesGetOrgPublicKeyResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.object({ key_id: z.string(), key: z.string() })], + ["404", s_basic_error], + ], + undefined, + ) + + // privateRegistriesGetOrgPublicKey + router.get( + `/orgs/:org/private-registries/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + privateRegistriesGetOrgPublicKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + key: string + key_id: string + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .privateRegistriesGetOrgPublicKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + privateRegistriesGetOrgPublicKeyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const privateRegistriesGetOrgPrivateRegistryParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const privateRegistriesGetOrgPrivateRegistryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_org_private_registry_configuration], + ["404", s_basic_error], + ], + undefined, + ) + + // privateRegistriesGetOrgPrivateRegistry + router.get( + `/orgs/:org/private-registries/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + privateRegistriesGetOrgPrivateRegistryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .privateRegistriesGetOrgPrivateRegistry( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + privateRegistriesGetOrgPrivateRegistryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const privateRegistriesUpdateOrgPrivateRegistryParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const privateRegistriesUpdateOrgPrivateRegistryRequestBodySchema = z.object({ + registry_type: z.enum(["maven_repository"]).optional(), + username: z.string().nullable().optional(), + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ) + .optional(), + key_id: z.string().optional(), + visibility: z.enum(["all", "private", "selected"]).optional(), + selected_repository_ids: z.array(z.coerce.number()).optional(), + }) + + const privateRegistriesUpdateOrgPrivateRegistryResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // privateRegistriesUpdateOrgPrivateRegistry + router.patch( + `/orgs/:org/private-registries/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + privateRegistriesUpdateOrgPrivateRegistryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + privateRegistriesUpdateOrgPrivateRegistryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .privateRegistriesUpdateOrgPrivateRegistry( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + privateRegistriesUpdateOrgPrivateRegistryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const privateRegistriesDeleteOrgPrivateRegistryParamSchema = z.object({ + org: z.string(), + secret_name: z.string(), + }) + + const privateRegistriesDeleteOrgPrivateRegistryResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["400", s_scim_error], + ["404", s_basic_error], + ], + undefined, + ) + + // privateRegistriesDeleteOrgPrivateRegistry + router.delete( + `/orgs/:org/private-registries/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + privateRegistriesDeleteOrgPrivateRegistryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .privateRegistriesDeleteOrgPrivateRegistry( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + privateRegistriesDeleteOrgPrivateRegistryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsListForOrgParamSchema = z.object({ org: z.string() }) + + const projectsListForOrgQuerySchema = z.object({ + state: z.enum(["open", "closed", "all"]).optional().default("open"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const projectsListForOrgResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_project)], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsListForOrg + router.get( + `/orgs/:org/projects`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsListForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + projectsListForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsListForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsListForOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsCreateForOrgParamSchema = z.object({ org: z.string() }) + + const projectsCreateForOrgRequestBodySchema = z.object({ + name: z.string(), + body: z.string().optional(), + }) + + const projectsCreateForOrgResponseBodyValidator = responseValidationFactory( + [ + ["201", s_project], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsCreateForOrg + router.post( + `/orgs/:org/projects`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsCreateForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsCreateForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsCreateForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsCreateForOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetAllCustomPropertiesParamSchema = z.object({ org: z.string() }) + + const orgsGetAllCustomPropertiesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_custom_property)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsGetAllCustomProperties + router.get( + `/orgs/:org/properties/schema`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetAllCustomPropertiesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetAllCustomProperties(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsGetAllCustomPropertiesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCreateOrUpdateCustomPropertiesParamSchema = z.object({ + org: z.string(), + }) + + const orgsCreateOrUpdateCustomPropertiesRequestBodySchema = z.object({ + properties: z.array(s_custom_property).min(1).max(100), + }) + + const orgsCreateOrUpdateCustomPropertiesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_custom_property)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsCreateOrUpdateCustomProperties + router.patch( + `/orgs/:org/properties/schema`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCreateOrUpdateCustomPropertiesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsCreateOrUpdateCustomPropertiesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCreateOrUpdateCustomProperties(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsCreateOrUpdateCustomPropertiesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetCustomPropertyParamSchema = z.object({ + org: z.string(), + custom_property_name: z.string(), + }) + + const orgsGetCustomPropertyResponseBodyValidator = responseValidationFactory( + [ + ["200", s_custom_property], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsGetCustomProperty + router.get( + `/orgs/:org/properties/schema/:custom_property_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetCustomPropertyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetCustomProperty(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsGetCustomPropertyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCreateOrUpdateCustomPropertyParamSchema = z.object({ + org: z.string(), + custom_property_name: z.string(), + }) + + const orgsCreateOrUpdateCustomPropertyRequestBodySchema = + s_custom_property_set_payload + + const orgsCreateOrUpdateCustomPropertyResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_custom_property], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsCreateOrUpdateCustomProperty + router.put( + `/orgs/:org/properties/schema/:custom_property_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCreateOrUpdateCustomPropertyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsCreateOrUpdateCustomPropertyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCreateOrUpdateCustomProperty(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsCreateOrUpdateCustomPropertyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRemoveCustomPropertyParamSchema = z.object({ + org: z.string(), + custom_property_name: z.string(), + }) + + const orgsRemoveCustomPropertyResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsRemoveCustomProperty + router.delete( + `/orgs/:org/properties/schema/:custom_property_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRemoveCustomPropertyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRemoveCustomProperty(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsRemoveCustomPropertyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListCustomPropertiesValuesForReposParamSchema = z.object({ + org: z.string(), + }) + + const orgsListCustomPropertiesValuesForReposQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + repository_query: z.string().optional(), + }) + + const orgsListCustomPropertiesValuesForReposResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_org_repo_custom_property_values)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsListCustomPropertiesValuesForRepos + router.get( + `/orgs/:org/properties/values`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListCustomPropertiesValuesForReposParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListCustomPropertiesValuesForReposQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_org_repo_custom_property_values[] + >(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListCustomPropertiesValuesForRepos( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsListCustomPropertiesValuesForReposResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCreateOrUpdateCustomPropertiesValuesForReposParamSchema = z.object({ + org: z.string(), + }) + + const orgsCreateOrUpdateCustomPropertiesValuesForReposRequestBodySchema = + z.object({ + repository_names: z.array(z.string()).min(1).max(30), + properties: z.array(s_custom_property_value), + }) + + const orgsCreateOrUpdateCustomPropertiesValuesForReposResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsCreateOrUpdateCustomPropertiesValuesForRepos + router.patch( + `/orgs/:org/properties/values`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCreateOrUpdateCustomPropertiesValuesForReposParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsCreateOrUpdateCustomPropertiesValuesForReposRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCreateOrUpdateCustomPropertiesValuesForRepos( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsCreateOrUpdateCustomPropertiesValuesForReposResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListPublicMembersParamSchema = z.object({ org: z.string() }) + + const orgsListPublicMembersQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListPublicMembersResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_simple_user)]], + undefined, + ) + + // orgsListPublicMembers + router.get( + `/orgs/:org/public_members`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListPublicMembersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListPublicMembersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListPublicMembers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListPublicMembersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsCheckPublicMembershipForUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsCheckPublicMembershipForUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // orgsCheckPublicMembershipForUser + router.get( + `/orgs/:org/public_members/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsCheckPublicMembershipForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsCheckPublicMembershipForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsCheckPublicMembershipForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsSetPublicMembershipForAuthenticatedUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsSetPublicMembershipForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ], + undefined, + ) + + // orgsSetPublicMembershipForAuthenticatedUser + router.put( + `/orgs/:org/public_members/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsSetPublicMembershipForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsSetPublicMembershipForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsSetPublicMembershipForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRemovePublicMembershipForAuthenticatedUserParamSchema = z.object({ + org: z.string(), + username: z.string(), + }) + + const orgsRemovePublicMembershipForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // orgsRemovePublicMembershipForAuthenticatedUser + router.delete( + `/orgs/:org/public_members/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRemovePublicMembershipForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRemovePublicMembershipForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsRemovePublicMembershipForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListForOrgParamSchema = z.object({ org: z.string() }) + + const reposListForOrgQuerySchema = z.object({ + type: z + .enum(["all", "public", "private", "forks", "sources", "member"]) + .optional() + .default("all"), + sort: z + .enum(["created", "updated", "pushed", "full_name"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListForOrgResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_minimal_repository)]], + undefined, + ) + + // reposListForOrg + router.get( + `/orgs/:org/repos`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListForOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateInOrgParamSchema = z.object({ org: z.string() }) + + const reposCreateInOrgRequestBodySchema = z.object({ + name: z.string(), + description: z.string().optional(), + homepage: z.string().optional(), + private: PermissiveBoolean.optional().default(false), + visibility: z.enum(["public", "private"]).optional(), + has_issues: PermissiveBoolean.optional().default(true), + has_projects: PermissiveBoolean.optional().default(true), + has_wiki: PermissiveBoolean.optional().default(true), + has_downloads: PermissiveBoolean.optional().default(true), + is_template: PermissiveBoolean.optional().default(false), + team_id: z.coerce.number().optional(), + auto_init: PermissiveBoolean.optional().default(false), + gitignore_template: z.string().optional(), + license_template: z.string().optional(), + allow_squash_merge: PermissiveBoolean.optional().default(true), + allow_merge_commit: PermissiveBoolean.optional().default(true), + allow_rebase_merge: PermissiveBoolean.optional().default(true), + allow_auto_merge: PermissiveBoolean.optional().default(false), + delete_branch_on_merge: PermissiveBoolean.optional().default(false), + use_squash_pr_title_as_default: PermissiveBoolean.optional().default(false), + squash_merge_commit_title: z + .enum(["PR_TITLE", "COMMIT_OR_PR_TITLE"]) + .optional(), + squash_merge_commit_message: z + .enum(["PR_BODY", "COMMIT_MESSAGES", "BLANK"]) + .optional(), + merge_commit_title: z.enum(["PR_TITLE", "MERGE_MESSAGE"]).optional(), + merge_commit_message: z.enum(["PR_BODY", "PR_TITLE", "BLANK"]).optional(), + custom_properties: z.record(z.unknown()).optional(), + }) + + const reposCreateInOrgResponseBodyValidator = responseValidationFactory( + [ + ["201", s_full_repository], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateInOrg + router.post( + `/orgs/:org/repos`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetOrgRulesetsParamSchema = z.object({ org: z.string() }) + + const reposGetOrgRulesetsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + targets: z.string().optional(), + }) + + const reposGetOrgRulesetsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_repository_ruleset)], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetOrgRulesets + router.get( + `/orgs/:org/rulesets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetOrgRulesetsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetOrgRulesetsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetOrgRulesets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetOrgRulesetsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateOrgRulesetParamSchema = z.object({ org: z.string() }) + + const reposCreateOrgRulesetRequestBodySchema = z.object({ + name: z.string(), + target: z + .enum(["branch", "tag", "push", "repository"]) + .optional() + .default("branch"), + enforcement: s_repository_rule_enforcement, + bypass_actors: z.array(s_repository_ruleset_bypass_actor).optional(), + conditions: s_org_ruleset_conditions.optional(), + rules: z.array(s_repository_rule).optional(), + }) + + const reposCreateOrgRulesetResponseBodyValidator = responseValidationFactory( + [ + ["201", s_repository_ruleset], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposCreateOrgRuleset + router.post( + `/orgs/:org/rulesets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateOrgRulesetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateOrgRulesetRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateOrgRuleset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateOrgRulesetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetOrgRuleSuitesParamSchema = z.object({ org: z.string() }) + + const reposGetOrgRuleSuitesQuerySchema = z.object({ + ref: z.string().optional(), + repository_name: z.string().optional(), + time_period: z + .enum(["hour", "day", "week", "month"]) + .optional() + .default("day"), + actor_name: z.string().optional(), + rule_suite_result: z + .enum(["pass", "fail", "bypass", "all"]) + .optional() + .default("all"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposGetOrgRuleSuitesResponseBodyValidator = responseValidationFactory( + [ + ["200", s_rule_suites], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetOrgRuleSuites + router.get( + `/orgs/:org/rulesets/rule-suites`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetOrgRuleSuitesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetOrgRuleSuitesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetOrgRuleSuites(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetOrgRuleSuitesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetOrgRuleSuiteParamSchema = z.object({ + org: z.string(), + rule_suite_id: z.coerce.number(), + }) + + const reposGetOrgRuleSuiteResponseBodyValidator = responseValidationFactory( + [ + ["200", s_rule_suite], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetOrgRuleSuite + router.get( + `/orgs/:org/rulesets/rule-suites/:rule_suite_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetOrgRuleSuiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetOrgRuleSuite(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetOrgRuleSuiteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetOrgRulesetParamSchema = z.object({ + org: z.string(), + ruleset_id: z.coerce.number(), + }) + + const reposGetOrgRulesetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_repository_ruleset], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetOrgRuleset + router.get( + `/orgs/:org/rulesets/:ruleset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetOrgRulesetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetOrgRuleset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetOrgRulesetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateOrgRulesetParamSchema = z.object({ + org: z.string(), + ruleset_id: z.coerce.number(), + }) + + const reposUpdateOrgRulesetRequestBodySchema = z + .object({ + name: z.string().optional(), + target: z.enum(["branch", "tag", "push", "repository"]).optional(), + enforcement: s_repository_rule_enforcement.optional(), + bypass_actors: z.array(s_repository_ruleset_bypass_actor).optional(), + conditions: s_org_ruleset_conditions.optional(), + rules: z.array(s_repository_rule).optional(), + }) + .optional() + + const reposUpdateOrgRulesetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_repository_ruleset], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposUpdateOrgRuleset + router.put( + `/orgs/:org/rulesets/:ruleset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateOrgRulesetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateOrgRulesetRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateOrgRuleset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUpdateOrgRulesetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteOrgRulesetParamSchema = z.object({ + org: z.string(), + ruleset_id: z.coerce.number(), + }) + + const reposDeleteOrgRulesetResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposDeleteOrgRuleset + router.delete( + `/orgs/:org/rulesets/:ruleset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteOrgRulesetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteOrgRuleset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteOrgRulesetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetOrgRulesetHistoryParamSchema = z.object({ + org: z.string(), + ruleset_id: z.coerce.number(), + }) + + const orgsGetOrgRulesetHistoryQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsGetOrgRulesetHistoryResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_ruleset_version)], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsGetOrgRulesetHistory + router.get( + `/orgs/:org/rulesets/:ruleset_id/history`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetOrgRulesetHistoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsGetOrgRulesetHistoryQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetOrgRulesetHistory(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsGetOrgRulesetHistoryResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetOrgRulesetVersionParamSchema = z.object({ + org: z.string(), + ruleset_id: z.coerce.number(), + version_id: z.coerce.number(), + }) + + const orgsGetOrgRulesetVersionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_ruleset_version_with_state], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // orgsGetOrgRulesetVersion + router.get( + `/orgs/:org/rulesets/:ruleset_id/history/:version_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetOrgRulesetVersionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetOrgRulesetVersion(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsGetOrgRulesetVersionResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const secretScanningListAlertsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const secretScanningListAlertsForOrgQuerySchema = z.object({ + state: z.enum(["open", "resolved"]).optional(), + secret_type: z.string().optional(), + resolution: z.string().optional(), + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + validity: z.string().optional(), + is_publicly_leaked: PermissiveBoolean.optional().default(false), + is_multi_repo: PermissiveBoolean.optional().default(false), + }) + + const secretScanningListAlertsForOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_organization_secret_scanning_alert)], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // secretScanningListAlertsForOrg + router.get( + `/orgs/:org/secret-scanning/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + secretScanningListAlertsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + secretScanningListAlertsForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_organization_secret_scanning_alert[] + >(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .secretScanningListAlertsForOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + secretScanningListAlertsForOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesListOrgRepositoryAdvisoriesParamSchema = z.object({ + org: z.string(), + }) + + const securityAdvisoriesListOrgRepositoryAdvisoriesQuerySchema = z.object({ + direction: z.enum(["asc", "desc"]).optional().default("desc"), + sort: z + .enum(["created", "updated", "published"]) + .optional() + .default("created"), + before: z.string().optional(), + after: z.string().optional(), + per_page: z.coerce.number().min(1).max(100).optional().default(30), + state: z.enum(["triage", "draft", "published", "closed"]).optional(), + }) + + const securityAdvisoriesListOrgRepositoryAdvisoriesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_repository_advisory)], + ["400", s_scim_error], + ["404", s_basic_error], + ], + undefined, + ) + + // securityAdvisoriesListOrgRepositoryAdvisories + router.get( + `/orgs/:org/security-advisories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesListOrgRepositoryAdvisoriesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + securityAdvisoriesListOrgRepositoryAdvisoriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesListOrgRepositoryAdvisories( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesListOrgRepositoryAdvisoriesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListSecurityManagerTeamsParamSchema = z.object({ org: z.string() }) + + const orgsListSecurityManagerTeamsResponseBodyValidator = + responseValidationFactory([["200", z.array(s_team_simple)]], undefined) + + // orgsListSecurityManagerTeams + router.get( + `/orgs/:org/security-managers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListSecurityManagerTeamsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListSecurityManagerTeams(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsListSecurityManagerTeamsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsAddSecurityManagerTeamParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const orgsAddSecurityManagerTeamResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // orgsAddSecurityManagerTeam + router.put( + `/orgs/:org/security-managers/teams/:team_slug`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsAddSecurityManagerTeamParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsAddSecurityManagerTeam(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsAddSecurityManagerTeamResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsRemoveSecurityManagerTeamParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const orgsRemoveSecurityManagerTeamResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // orgsRemoveSecurityManagerTeam + router.delete( + `/orgs/:org/security-managers/teams/:team_slug`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsRemoveSecurityManagerTeamParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsRemoveSecurityManagerTeam(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsRemoveSecurityManagerTeamResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const billingGetGithubActionsBillingOrgParamSchema = z.object({ + org: z.string(), + }) + + const billingGetGithubActionsBillingOrgResponseBodyValidator = + responseValidationFactory([["200", s_actions_billing_usage]], undefined) + + // billingGetGithubActionsBillingOrg + router.get( + `/orgs/:org/settings/billing/actions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + billingGetGithubActionsBillingOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .billingGetGithubActionsBillingOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + billingGetGithubActionsBillingOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const billingGetGithubPackagesBillingOrgParamSchema = z.object({ + org: z.string(), + }) + + const billingGetGithubPackagesBillingOrgResponseBodyValidator = + responseValidationFactory([["200", s_packages_billing_usage]], undefined) + + // billingGetGithubPackagesBillingOrg + router.get( + `/orgs/:org/settings/billing/packages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + billingGetGithubPackagesBillingOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .billingGetGithubPackagesBillingOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + billingGetGithubPackagesBillingOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const billingGetSharedStorageBillingOrgParamSchema = z.object({ + org: z.string(), + }) + + const billingGetSharedStorageBillingOrgResponseBodyValidator = + responseValidationFactory([["200", s_combined_billing_usage]], undefined) + + // billingGetSharedStorageBillingOrg + router.get( + `/orgs/:org/settings/billing/shared-storage`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + billingGetSharedStorageBillingOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .billingGetSharedStorageBillingOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + billingGetSharedStorageBillingOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const hostedComputeListNetworkConfigurationsForOrgParamSchema = z.object({ + org: z.string(), + }) + + const hostedComputeListNetworkConfigurationsForOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const hostedComputeListNetworkConfigurationsForOrgResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + network_configurations: z.array(s_network_configuration), + }), + ], + ], + undefined, + ) + + // hostedComputeListNetworkConfigurationsForOrg + router.get( + `/orgs/:org/settings/network-configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + hostedComputeListNetworkConfigurationsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + hostedComputeListNetworkConfigurationsForOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + network_configurations: t_network_configuration[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .hostedComputeListNetworkConfigurationsForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + hostedComputeListNetworkConfigurationsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const hostedComputeCreateNetworkConfigurationForOrgParamSchema = z.object({ + org: z.string(), + }) + + const hostedComputeCreateNetworkConfigurationForOrgRequestBodySchema = + z.object({ + name: z.string(), + compute_service: z.enum(["none", "actions"]).optional(), + network_settings_ids: z.array(z.string()).min(1).max(1), + }) + + const hostedComputeCreateNetworkConfigurationForOrgResponseBodyValidator = + responseValidationFactory([["201", s_network_configuration]], undefined) + + // hostedComputeCreateNetworkConfigurationForOrg + router.post( + `/orgs/:org/settings/network-configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + hostedComputeCreateNetworkConfigurationForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + hostedComputeCreateNetworkConfigurationForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .hostedComputeCreateNetworkConfigurationForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + hostedComputeCreateNetworkConfigurationForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const hostedComputeGetNetworkConfigurationForOrgParamSchema = z.object({ + org: z.string(), + network_configuration_id: z.string(), + }) + + const hostedComputeGetNetworkConfigurationForOrgResponseBodyValidator = + responseValidationFactory([["200", s_network_configuration]], undefined) + + // hostedComputeGetNetworkConfigurationForOrg + router.get( + `/orgs/:org/settings/network-configurations/:network_configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + hostedComputeGetNetworkConfigurationForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .hostedComputeGetNetworkConfigurationForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + hostedComputeGetNetworkConfigurationForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const hostedComputeUpdateNetworkConfigurationForOrgParamSchema = z.object({ + org: z.string(), + network_configuration_id: z.string(), + }) + + const hostedComputeUpdateNetworkConfigurationForOrgRequestBodySchema = + z.object({ + name: z.string().optional(), + compute_service: z.enum(["none", "actions"]).optional(), + network_settings_ids: z.array(z.string()).min(0).max(1).optional(), + }) + + const hostedComputeUpdateNetworkConfigurationForOrgResponseBodyValidator = + responseValidationFactory([["200", s_network_configuration]], undefined) + + // hostedComputeUpdateNetworkConfigurationForOrg + router.patch( + `/orgs/:org/settings/network-configurations/:network_configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + hostedComputeUpdateNetworkConfigurationForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + hostedComputeUpdateNetworkConfigurationForOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .hostedComputeUpdateNetworkConfigurationForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + hostedComputeUpdateNetworkConfigurationForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const hostedComputeDeleteNetworkConfigurationFromOrgParamSchema = z.object({ + org: z.string(), + network_configuration_id: z.string(), + }) + + const hostedComputeDeleteNetworkConfigurationFromOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // hostedComputeDeleteNetworkConfigurationFromOrg + router.delete( + `/orgs/:org/settings/network-configurations/:network_configuration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + hostedComputeDeleteNetworkConfigurationFromOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .hostedComputeDeleteNetworkConfigurationFromOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + hostedComputeDeleteNetworkConfigurationFromOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const hostedComputeGetNetworkSettingsForOrgParamSchema = z.object({ + org: z.string(), + network_settings_id: z.string(), + }) + + const hostedComputeGetNetworkSettingsForOrgResponseBodyValidator = + responseValidationFactory([["200", s_network_settings]], undefined) + + // hostedComputeGetNetworkSettingsForOrg + router.get( + `/orgs/:org/settings/network-settings/:network_settings_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + hostedComputeGetNetworkSettingsForOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .hostedComputeGetNetworkSettingsForOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + hostedComputeGetNetworkSettingsForOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const copilotCopilotMetricsForTeamParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const copilotCopilotMetricsForTeamQuerySchema = z.object({ + since: z.string().optional(), + until: z.string().optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(28), + }) + + const copilotCopilotMetricsForTeamResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_copilot_usage_metrics_day)], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // copilotCopilotMetricsForTeam + router.get( + `/orgs/:org/team/:team_slug/copilot/metrics`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + copilotCopilotMetricsForTeamParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + copilotCopilotMetricsForTeamQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .copilotCopilotMetricsForTeam(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + copilotCopilotMetricsForTeamResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListParamSchema = z.object({ org: z.string() }) + + const teamsListQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_team)], + ["403", s_basic_error], + ], + undefined, + ) + + // teamsList + router.get( + `/orgs/:org/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCreateParamSchema = z.object({ org: z.string() }) + + const teamsCreateRequestBodySchema = z.object({ + name: z.string(), + description: z.string().optional(), + maintainers: z.array(z.string()).optional(), + repo_names: z.array(z.string()).optional(), + privacy: z.enum(["secret", "closed"]).optional(), + notification_setting: z + .enum(["notifications_enabled", "notifications_disabled"]) + .optional(), + permission: z.enum(["pull", "push"]).optional().default("pull"), + parent_team_id: z.coerce.number().optional(), + }) + + const teamsCreateResponseBodyValidator = responseValidationFactory( + [ + ["201", s_team_full], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // teamsCreate + router.post( + `/orgs/:org/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCreateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsCreateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCreate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsCreateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetByNameParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsGetByNameResponseBodyValidator = responseValidationFactory( + [ + ["200", s_team_full], + ["404", s_basic_error], + ], + undefined, + ) + + // teamsGetByName + router.get( + `/orgs/:org/teams/:team_slug`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetByNameParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetByName(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsGetByNameResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsUpdateInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsUpdateInOrgRequestBodySchema = z + .object({ + name: z.string().optional(), + description: z.string().optional(), + privacy: z.enum(["secret", "closed"]).optional(), + notification_setting: z + .enum(["notifications_enabled", "notifications_disabled"]) + .optional(), + permission: z.enum(["pull", "push", "admin"]).optional().default("pull"), + parent_team_id: z.coerce.number().nullable().optional(), + }) + .optional() + + const teamsUpdateInOrgResponseBodyValidator = responseValidationFactory( + [ + ["200", s_team_full], + ["201", s_team_full], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // teamsUpdateInOrg + router.patch( + `/orgs/:org/teams/:team_slug`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsUpdateInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsUpdateInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsUpdateInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsUpdateInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsDeleteInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsDeleteInOrgResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // teamsDeleteInOrg + router.delete( + `/orgs/:org/teams/:team_slug`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsDeleteInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsDeleteInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsDeleteInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListDiscussionsInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsListDiscussionsInOrgQuerySchema = z.object({ + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + pinned: z.string().optional(), + }) + + const teamsListDiscussionsInOrgResponseBodyValidator = + responseValidationFactory([["200", z.array(s_team_discussion)]], undefined) + + // teamsListDiscussionsInOrg + router.get( + `/orgs/:org/teams/:team_slug/discussions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListDiscussionsInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListDiscussionsInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListDiscussionsInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListDiscussionsInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCreateDiscussionInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsCreateDiscussionInOrgRequestBodySchema = z.object({ + title: z.string(), + body: z.string(), + private: PermissiveBoolean.optional().default(false), + }) + + const teamsCreateDiscussionInOrgResponseBodyValidator = + responseValidationFactory([["201", s_team_discussion]], undefined) + + // teamsCreateDiscussionInOrg + router.post( + `/orgs/:org/teams/:team_slug/discussions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCreateDiscussionInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsCreateDiscussionInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCreateDiscussionInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsCreateDiscussionInOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetDiscussionInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + }) + + const teamsGetDiscussionInOrgResponseBodyValidator = + responseValidationFactory([["200", s_team_discussion]], undefined) + + // teamsGetDiscussionInOrg + router.get( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetDiscussionInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetDiscussionInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsGetDiscussionInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsUpdateDiscussionInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + }) + + const teamsUpdateDiscussionInOrgRequestBodySchema = z + .object({ title: z.string().optional(), body: z.string().optional() }) + .optional() + + const teamsUpdateDiscussionInOrgResponseBodyValidator = + responseValidationFactory([["200", s_team_discussion]], undefined) + + // teamsUpdateDiscussionInOrg + router.patch( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsUpdateDiscussionInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsUpdateDiscussionInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsUpdateDiscussionInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsUpdateDiscussionInOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsDeleteDiscussionInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + }) + + const teamsDeleteDiscussionInOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // teamsDeleteDiscussionInOrg + router.delete( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsDeleteDiscussionInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsDeleteDiscussionInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsDeleteDiscussionInOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListDiscussionCommentsInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + }) + + const teamsListDiscussionCommentsInOrgQuerySchema = z.object({ + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListDiscussionCommentsInOrgResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_team_discussion_comment)]], + undefined, + ) + + // teamsListDiscussionCommentsInOrg + router.get( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListDiscussionCommentsInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListDiscussionCommentsInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListDiscussionCommentsInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsListDiscussionCommentsInOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCreateDiscussionCommentInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + }) + + const teamsCreateDiscussionCommentInOrgRequestBodySchema = z.object({ + body: z.string(), + }) + + const teamsCreateDiscussionCommentInOrgResponseBodyValidator = + responseValidationFactory([["201", s_team_discussion_comment]], undefined) + + // teamsCreateDiscussionCommentInOrg + router.post( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCreateDiscussionCommentInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsCreateDiscussionCommentInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCreateDiscussionCommentInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsCreateDiscussionCommentInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetDiscussionCommentInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const teamsGetDiscussionCommentInOrgResponseBodyValidator = + responseValidationFactory([["200", s_team_discussion_comment]], undefined) + + // teamsGetDiscussionCommentInOrg + router.get( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/comments/:comment_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetDiscussionCommentInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetDiscussionCommentInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsGetDiscussionCommentInOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsUpdateDiscussionCommentInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const teamsUpdateDiscussionCommentInOrgRequestBodySchema = z.object({ + body: z.string(), + }) + + const teamsUpdateDiscussionCommentInOrgResponseBodyValidator = + responseValidationFactory([["200", s_team_discussion_comment]], undefined) + + // teamsUpdateDiscussionCommentInOrg + router.patch( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/comments/:comment_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsUpdateDiscussionCommentInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsUpdateDiscussionCommentInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsUpdateDiscussionCommentInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsUpdateDiscussionCommentInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsDeleteDiscussionCommentInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const teamsDeleteDiscussionCommentInOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // teamsDeleteDiscussionCommentInOrg + router.delete( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/comments/:comment_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsDeleteDiscussionCommentInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsDeleteDiscussionCommentInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsDeleteDiscussionCommentInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForTeamDiscussionCommentInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const reactionsListForTeamDiscussionCommentInOrgQuerySchema = z.object({ + content: z + .enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForTeamDiscussionCommentInOrgResponseBodyValidator = + responseValidationFactory([["200", z.array(s_reaction)]], undefined) + + // reactionsListForTeamDiscussionCommentInOrg + router.get( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/comments/:comment_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForTeamDiscussionCommentInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForTeamDiscussionCommentInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForTeamDiscussionCommentInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsListForTeamDiscussionCommentInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForTeamDiscussionCommentInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const reactionsCreateForTeamDiscussionCommentInOrgRequestBodySchema = + z.object({ + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + }) + + const reactionsCreateForTeamDiscussionCommentInOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_reaction], + ["201", s_reaction], + ], + undefined, + ) + + // reactionsCreateForTeamDiscussionCommentInOrg + router.post( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/comments/:comment_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForTeamDiscussionCommentInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForTeamDiscussionCommentInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForTeamDiscussionCommentInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsCreateForTeamDiscussionCommentInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsDeleteForTeamDiscussionCommentParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + reaction_id: z.coerce.number(), + }) + + const reactionsDeleteForTeamDiscussionCommentResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reactionsDeleteForTeamDiscussionComment + router.delete( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsDeleteForTeamDiscussionCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsDeleteForTeamDiscussionComment( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsDeleteForTeamDiscussionCommentResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForTeamDiscussionInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + }) + + const reactionsListForTeamDiscussionInOrgQuerySchema = z.object({ + content: z + .enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForTeamDiscussionInOrgResponseBodyValidator = + responseValidationFactory([["200", z.array(s_reaction)]], undefined) + + // reactionsListForTeamDiscussionInOrg + router.get( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForTeamDiscussionInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForTeamDiscussionInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForTeamDiscussionInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsListForTeamDiscussionInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForTeamDiscussionInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + }) + + const reactionsCreateForTeamDiscussionInOrgRequestBodySchema = z.object({ + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + }) + + const reactionsCreateForTeamDiscussionInOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_reaction], + ["201", s_reaction], + ], + undefined, + ) + + // reactionsCreateForTeamDiscussionInOrg + router.post( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForTeamDiscussionInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForTeamDiscussionInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForTeamDiscussionInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsCreateForTeamDiscussionInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsDeleteForTeamDiscussionParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + discussion_number: z.coerce.number(), + reaction_id: z.coerce.number(), + }) + + const reactionsDeleteForTeamDiscussionResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reactionsDeleteForTeamDiscussion + router.delete( + `/orgs/:org/teams/:team_slug/discussions/:discussion_number/reactions/:reaction_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsDeleteForTeamDiscussionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsDeleteForTeamDiscussion(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsDeleteForTeamDiscussionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListPendingInvitationsInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsListPendingInvitationsInOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListPendingInvitationsInOrgResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_organization_invitation)]], + undefined, + ) + + // teamsListPendingInvitationsInOrg + router.get( + `/orgs/:org/teams/:team_slug/invitations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListPendingInvitationsInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListPendingInvitationsInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListPendingInvitationsInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsListPendingInvitationsInOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListMembersInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsListMembersInOrgQuerySchema = z.object({ + role: z.enum(["member", "maintainer", "all"]).optional().default("all"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListMembersInOrgResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_simple_user)]], + undefined, + ) + + // teamsListMembersInOrg + router.get( + `/orgs/:org/teams/:team_slug/members`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListMembersInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListMembersInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListMembersInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListMembersInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetMembershipForUserInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + username: z.string(), + }) + + const teamsGetMembershipForUserInOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_team_membership], + ["404", z.undefined()], + ], + undefined, + ) + + // teamsGetMembershipForUserInOrg + router.get( + `/orgs/:org/teams/:team_slug/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetMembershipForUserInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetMembershipForUserInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsGetMembershipForUserInOrgResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsAddOrUpdateMembershipForUserInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + username: z.string(), + }) + + const teamsAddOrUpdateMembershipForUserInOrgRequestBodySchema = z + .object({ + role: z.enum(["member", "maintainer"]).optional().default("member"), + }) + .optional() + + const teamsAddOrUpdateMembershipForUserInOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_team_membership], + ["403", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // teamsAddOrUpdateMembershipForUserInOrg + router.put( + `/orgs/:org/teams/:team_slug/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsAddOrUpdateMembershipForUserInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsAddOrUpdateMembershipForUserInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsAddOrUpdateMembershipForUserInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsAddOrUpdateMembershipForUserInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsRemoveMembershipForUserInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + username: z.string(), + }) + + const teamsRemoveMembershipForUserInOrgResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", z.undefined()], + ], + undefined, + ) + + // teamsRemoveMembershipForUserInOrg + router.delete( + `/orgs/:org/teams/:team_slug/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsRemoveMembershipForUserInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsRemoveMembershipForUserInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsRemoveMembershipForUserInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListProjectsInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsListProjectsInOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListProjectsInOrgResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_team_project)]], + undefined, + ) + + // teamsListProjectsInOrg + router.get( + `/orgs/:org/teams/:team_slug/projects`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListProjectsInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListProjectsInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListProjectsInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListProjectsInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCheckPermissionsForProjectInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + project_id: z.coerce.number(), + }) + + const teamsCheckPermissionsForProjectInOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_team_project], + ["404", z.undefined()], + ], + undefined, + ) + + // teamsCheckPermissionsForProjectInOrg + router.get( + `/orgs/:org/teams/:team_slug/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCheckPermissionsForProjectInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCheckPermissionsForProjectInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsCheckPermissionsForProjectInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsAddOrUpdateProjectPermissionsInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + project_id: z.coerce.number(), + }) + + const teamsAddOrUpdateProjectPermissionsInOrgRequestBodySchema = z + .object({ permission: z.enum(["read", "write", "admin"]).optional() }) + .nullable() + .optional() + + const teamsAddOrUpdateProjectPermissionsInOrgResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + [ + "403", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // teamsAddOrUpdateProjectPermissionsInOrg + router.put( + `/orgs/:org/teams/:team_slug/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsAddOrUpdateProjectPermissionsInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsAddOrUpdateProjectPermissionsInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }>(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsAddOrUpdateProjectPermissionsInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsAddOrUpdateProjectPermissionsInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsRemoveProjectInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + project_id: z.coerce.number(), + }) + + const teamsRemoveProjectInOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // teamsRemoveProjectInOrg + router.delete( + `/orgs/:org/teams/:team_slug/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsRemoveProjectInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsRemoveProjectInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsRemoveProjectInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListReposInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsListReposInOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListReposInOrgResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_minimal_repository)]], + undefined, + ) + + // teamsListReposInOrg + router.get( + `/orgs/:org/teams/:team_slug/repos`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListReposInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListReposInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListReposInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListReposInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCheckPermissionsForRepoInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + owner: z.string(), + repo: z.string(), + }) + + const teamsCheckPermissionsForRepoInOrgResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_team_repository], + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // teamsCheckPermissionsForRepoInOrg + router.get( + `/orgs/:org/teams/:team_slug/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCheckPermissionsForRepoInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCheckPermissionsForRepoInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsCheckPermissionsForRepoInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsAddOrUpdateRepoPermissionsInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + owner: z.string(), + repo: z.string(), + }) + + const teamsAddOrUpdateRepoPermissionsInOrgRequestBodySchema = z + .object({ permission: z.string().optional() }) + .optional() + + const teamsAddOrUpdateRepoPermissionsInOrgResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // teamsAddOrUpdateRepoPermissionsInOrg + router.put( + `/orgs/:org/teams/:team_slug/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsAddOrUpdateRepoPermissionsInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsAddOrUpdateRepoPermissionsInOrgRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsAddOrUpdateRepoPermissionsInOrg( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsAddOrUpdateRepoPermissionsInOrgResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsRemoveRepoInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + owner: z.string(), + repo: z.string(), + }) + + const teamsRemoveRepoInOrgResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // teamsRemoveRepoInOrg + router.delete( + `/orgs/:org/teams/:team_slug/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsRemoveRepoInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsRemoveRepoInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsRemoveRepoInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListChildInOrgParamSchema = z.object({ + org: z.string(), + team_slug: z.string(), + }) + + const teamsListChildInOrgQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListChildInOrgResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_team)]], + undefined, + ) + + // teamsListChildInOrg + router.get( + `/orgs/:org/teams/:team_slug/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListChildInOrgParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListChildInOrgQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListChildInOrg(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListChildInOrgResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsEnableOrDisableSecurityProductOnAllOrgReposParamSchema = z.object({ + org: z.string(), + security_product: z.enum([ + "dependency_graph", + "dependabot_alerts", + "dependabot_security_updates", + "advanced_security", + "code_scanning_default_setup", + "secret_scanning", + "secret_scanning_push_protection", + ]), + enablement: z.enum(["enable_all", "disable_all"]), + }) + + const orgsEnableOrDisableSecurityProductOnAllOrgReposRequestBodySchema = z + .object({ query_suite: z.enum(["default", "extended"]).optional() }) + .optional() + + const orgsEnableOrDisableSecurityProductOnAllOrgReposResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // orgsEnableOrDisableSecurityProductOnAllOrgRepos + router.post( + `/orgs/:org/:security_product/:enablement`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsEnableOrDisableSecurityProductOnAllOrgReposParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsEnableOrDisableSecurityProductOnAllOrgReposRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsEnableOrDisableSecurityProductOnAllOrgRepos( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsEnableOrDisableSecurityProductOnAllOrgReposResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsGetCardParamSchema = z.object({ card_id: z.coerce.number() }) + + const projectsGetCardResponseBodyValidator = responseValidationFactory( + [ + ["200", s_project_card], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // projectsGetCard + router.get( + `/projects/columns/cards/:card_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsGetCardParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsGetCard(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsGetCardResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsUpdateCardParamSchema = z.object({ card_id: z.coerce.number() }) + + const projectsUpdateCardRequestBodySchema = z + .object({ + note: z.string().nullable().optional(), + archived: PermissiveBoolean.optional(), + }) + .optional() + + const projectsUpdateCardResponseBodyValidator = responseValidationFactory( + [ + ["200", s_project_card], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsUpdateCard + router.patch( + `/projects/columns/cards/:card_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsUpdateCardParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsUpdateCardRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsUpdateCard(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsUpdateCardResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsDeleteCardParamSchema = z.object({ card_id: z.coerce.number() }) + + const projectsDeleteCardResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + [ + "403", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + errors: z.array(z.string()).optional(), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // projectsDeleteCard + router.delete( + `/projects/columns/cards/:card_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsDeleteCardParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + errors?: string[] | undefined + message?: string | undefined + }>(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsDeleteCard(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsDeleteCardResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsMoveCardParamSchema = z.object({ card_id: z.coerce.number() }) + + const projectsMoveCardRequestBodySchema = z.object({ + position: z.string().regex(new RegExp("^(?:top|bottom|after:\\d+)$")), + column_id: z.coerce.number().optional(), + }) + + const projectsMoveCardResponseBodyValidator = responseValidationFactory( + [ + ["201", z.object({})], + ["304", z.undefined()], + ["401", s_basic_error], + [ + "403", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + errors: z + .array( + z.object({ + code: z.string().optional(), + message: z.string().optional(), + resource: z.string().optional(), + field: z.string().optional(), + }), + ) + .optional(), + }), + ], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + errors: z + .array( + z.object({ + code: z.string().optional(), + message: z.string().optional(), + }), + ) + .optional(), + }), + ], + ], + undefined, + ) + + // projectsMoveCard + router.post( + `/projects/columns/cards/:card_id/moves`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsMoveCardParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsMoveCardRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + errors?: + | { + code?: string | undefined + field?: string | undefined + message?: string | undefined + resource?: string | undefined + }[] + | undefined + message?: string | undefined + }>(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + errors?: + | { + code?: string | undefined + message?: string | undefined + }[] + | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsMoveCard(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsMoveCardResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsGetColumnParamSchema = z.object({ + column_id: z.coerce.number(), + }) + + const projectsGetColumnResponseBodyValidator = responseValidationFactory( + [ + ["200", s_project_column], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // projectsGetColumn + router.get( + `/projects/columns/:column_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsGetColumnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsGetColumn(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsGetColumnResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsUpdateColumnParamSchema = z.object({ + column_id: z.coerce.number(), + }) + + const projectsUpdateColumnRequestBodySchema = z.object({ name: z.string() }) + + const projectsUpdateColumnResponseBodyValidator = responseValidationFactory( + [ + ["200", s_project_column], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // projectsUpdateColumn + router.patch( + `/projects/columns/:column_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsUpdateColumnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsUpdateColumnRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsUpdateColumn(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsUpdateColumnResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsDeleteColumnParamSchema = z.object({ + column_id: z.coerce.number(), + }) + + const projectsDeleteColumnResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // projectsDeleteColumn + router.delete( + `/projects/columns/:column_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsDeleteColumnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsDeleteColumn(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsDeleteColumnResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsListCardsParamSchema = z.object({ + column_id: z.coerce.number(), + }) + + const projectsListCardsQuerySchema = z.object({ + archived_state: z + .enum(["all", "archived", "not_archived"]) + .optional() + .default("not_archived"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const projectsListCardsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_project_card)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // projectsListCards + router.get( + `/projects/columns/:column_id/cards`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsListCardsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + projectsListCardsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsListCards(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsListCardsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsCreateCardParamSchema = z.object({ + column_id: z.coerce.number(), + }) + + const projectsCreateCardRequestBodySchema = z.union([ + z.object({ note: z.string().nullable() }), + z.object({ content_id: z.coerce.number(), content_type: z.string() }), + ]) + + const projectsCreateCardResponseBodyValidator = responseValidationFactory( + [ + ["201", s_project_card], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["422", z.union([s_validation_error, s_validation_error_simple])], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + errors: z + .array( + z.object({ + code: z.string().optional(), + message: z.string().optional(), + }), + ) + .optional(), + }), + ], + ], + undefined, + ) + + // projectsCreateCard + router.post( + `/projects/columns/:column_id/cards`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsCreateCardParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsCreateCardRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse< + t_validation_error | t_validation_error_simple + >(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + errors?: + | { + code?: string | undefined + message?: string | undefined + }[] + | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsCreateCard(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsCreateCardResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsMoveColumnParamSchema = z.object({ + column_id: z.coerce.number(), + }) + + const projectsMoveColumnRequestBodySchema = z.object({ + position: z.string().regex(new RegExp("^(?:first|last|after:\\d+)$")), + }) + + const projectsMoveColumnResponseBodyValidator = responseValidationFactory( + [ + ["201", z.object({})], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsMoveColumn + router.post( + `/projects/columns/:column_id/moves`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsMoveColumnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsMoveColumnRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsMoveColumn(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsMoveColumnResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsGetParamSchema = z.object({ project_id: z.coerce.number() }) + + const projectsGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_project], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // projectsGet + router.get( + `/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsUpdateParamSchema = z.object({ project_id: z.coerce.number() }) + + const projectsUpdateRequestBodySchema = z + .object({ + name: z.string().optional(), + body: z.string().nullable().optional(), + state: z.string().optional(), + organization_permission: z + .enum(["read", "write", "admin", "none"]) + .optional(), + private: PermissiveBoolean.optional(), + }) + .optional() + + const projectsUpdateResponseBodyValidator = responseValidationFactory( + [ + ["200", s_project], + ["304", z.undefined()], + ["401", s_basic_error], + [ + "403", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + errors: z.array(z.string()).optional(), + }), + ], + ["404", z.undefined()], + ["410", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsUpdate + router.patch( + `/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + errors?: string[] | undefined + message?: string | undefined + }>(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsDeleteParamSchema = z.object({ project_id: z.coerce.number() }) + + const projectsDeleteResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + [ + "403", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + errors: z.array(z.string()).optional(), + }), + ], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // projectsDelete + router.delete( + `/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsDeleteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + errors?: string[] | undefined + message?: string | undefined + }>(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsDelete(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsDeleteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsListCollaboratorsParamSchema = z.object({ + project_id: z.coerce.number(), + }) + + const projectsListCollaboratorsQuerySchema = z.object({ + affiliation: z.enum(["outside", "direct", "all"]).optional().default("all"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const projectsListCollaboratorsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // projectsListCollaborators + router.get( + `/projects/:project_id/collaborators`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsListCollaboratorsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + projectsListCollaboratorsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsListCollaborators(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsListCollaboratorsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsAddCollaboratorParamSchema = z.object({ + project_id: z.coerce.number(), + username: z.string(), + }) + + const projectsAddCollaboratorRequestBodySchema = z + .object({ + permission: z + .enum(["read", "write", "admin"]) + .optional() + .default("write"), + }) + .nullable() + .optional() + + const projectsAddCollaboratorResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // projectsAddCollaborator + router.put( + `/projects/:project_id/collaborators/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsAddCollaboratorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsAddCollaboratorRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsAddCollaborator(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsAddCollaboratorResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsRemoveCollaboratorParamSchema = z.object({ + project_id: z.coerce.number(), + username: z.string(), + }) + + const projectsRemoveCollaboratorResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // projectsRemoveCollaborator + router.delete( + `/projects/:project_id/collaborators/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsRemoveCollaboratorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsRemoveCollaborator(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + projectsRemoveCollaboratorResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsGetPermissionForUserParamSchema = z.object({ + project_id: z.coerce.number(), + username: z.string(), + }) + + const projectsGetPermissionForUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_project_collaborator_permission], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // projectsGetPermissionForUser + router.get( + `/projects/:project_id/collaborators/:username/permission`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsGetPermissionForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsGetPermissionForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + projectsGetPermissionForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsListColumnsParamSchema = z.object({ + project_id: z.coerce.number(), + }) + + const projectsListColumnsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const projectsListColumnsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_project_column)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // projectsListColumns + router.get( + `/projects/:project_id/columns`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsListColumnsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + projectsListColumnsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsListColumns(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsListColumnsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsCreateColumnParamSchema = z.object({ + project_id: z.coerce.number(), + }) + + const projectsCreateColumnRequestBodySchema = z.object({ name: z.string() }) + + const projectsCreateColumnResponseBodyValidator = responseValidationFactory( + [ + ["201", s_project_column], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsCreateColumn + router.post( + `/projects/:project_id/columns`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsCreateColumnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsCreateColumnRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsCreateColumn(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsCreateColumnResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const rateLimitGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_rate_limit_overview], + ["304", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // rateLimitGet + router.get( + `/rate_limit`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .rateLimitGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(rateLimitGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetParamSchema = z.object({ owner: z.string(), repo: z.string() }) + + const reposGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_full_repository], + ["301", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGet + router.get( + `/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposUpdateRequestBodySchema = z + .object({ + name: z.string().optional(), + description: z.string().optional(), + homepage: z.string().optional(), + private: PermissiveBoolean.optional().default(false), + visibility: z.enum(["public", "private"]).optional(), + security_and_analysis: z + .object({ + advanced_security: z + .object({ status: z.string().optional() }) + .optional(), + code_security: z.object({ status: z.string().optional() }).optional(), + secret_scanning: z + .object({ status: z.string().optional() }) + .optional(), + secret_scanning_push_protection: z + .object({ status: z.string().optional() }) + .optional(), + secret_scanning_ai_detection: z + .object({ status: z.string().optional() }) + .optional(), + secret_scanning_non_provider_patterns: z + .object({ status: z.string().optional() }) + .optional(), + }) + .nullable() + .optional(), + has_issues: PermissiveBoolean.optional().default(true), + has_projects: PermissiveBoolean.optional().default(true), + has_wiki: PermissiveBoolean.optional().default(true), + is_template: PermissiveBoolean.optional().default(false), + default_branch: z.string().optional(), + allow_squash_merge: PermissiveBoolean.optional().default(true), + allow_merge_commit: PermissiveBoolean.optional().default(true), + allow_rebase_merge: PermissiveBoolean.optional().default(true), + allow_auto_merge: PermissiveBoolean.optional().default(false), + delete_branch_on_merge: PermissiveBoolean.optional().default(false), + allow_update_branch: PermissiveBoolean.optional().default(false), + use_squash_pr_title_as_default: + PermissiveBoolean.optional().default(false), + squash_merge_commit_title: z + .enum(["PR_TITLE", "COMMIT_OR_PR_TITLE"]) + .optional(), + squash_merge_commit_message: z + .enum(["PR_BODY", "COMMIT_MESSAGES", "BLANK"]) + .optional(), + merge_commit_title: z.enum(["PR_TITLE", "MERGE_MESSAGE"]).optional(), + merge_commit_message: z.enum(["PR_BODY", "PR_TITLE", "BLANK"]).optional(), + archived: PermissiveBoolean.optional().default(false), + allow_forking: PermissiveBoolean.optional().default(false), + web_commit_signoff_required: PermissiveBoolean.optional().default(false), + }) + .optional() + + const reposUpdateResponseBodyValidator = responseValidationFactory( + [ + ["200", s_full_repository], + ["307", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposUpdate + router.patch( + `/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with307() { + return new ExpressRuntimeResponse(307) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposDeleteResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["307", s_basic_error], + [ + "403", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // reposDelete + router.delete( + `/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with307() { + return new ExpressRuntimeResponse(307) + }, + with403() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }>(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDelete(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListArtifactsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListArtifactsForRepoQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + name: z.string().optional(), + }) + + const actionsListArtifactsForRepoResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + artifacts: z.array(s_artifact), + }), + ], + ], + undefined, + ) + + // actionsListArtifactsForRepo + router.get( + `/repos/:owner/:repo/actions/artifacts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListArtifactsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListArtifactsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + artifacts: t_artifact[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListArtifactsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListArtifactsForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetArtifactParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + artifact_id: z.coerce.number(), + }) + + const actionsGetArtifactResponseBodyValidator = responseValidationFactory( + [["200", s_artifact]], + undefined, + ) + + // actionsGetArtifact + router.get( + `/repos/:owner/:repo/actions/artifacts/:artifact_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetArtifactParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetArtifact(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetArtifactResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteArtifactParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + artifact_id: z.coerce.number(), + }) + + const actionsDeleteArtifactResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // actionsDeleteArtifact + router.delete( + `/repos/:owner/:repo/actions/artifacts/:artifact_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteArtifactParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteArtifact(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsDeleteArtifactResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDownloadArtifactParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + artifact_id: z.coerce.number(), + archive_format: z.string(), + }) + + const actionsDownloadArtifactResponseBodyValidator = + responseValidationFactory( + [ + ["302", z.undefined()], + ["410", s_basic_error], + ], + undefined, + ) + + // actionsDownloadArtifact + router.get( + `/repos/:owner/:repo/actions/artifacts/:artifact_id/:archive_format`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDownloadArtifactParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with302() { + return new ExpressRuntimeResponse(302) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDownloadArtifact(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsDownloadArtifactResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetActionsCacheUsageParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsGetActionsCacheUsageResponseBodyValidator = + responseValidationFactory( + [["200", s_actions_cache_usage_by_repository]], + undefined, + ) + + // actionsGetActionsCacheUsage + router.get( + `/repos/:owner/:repo/actions/cache/usage`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetActionsCacheUsageParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetActionsCacheUsage(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetActionsCacheUsageResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetActionsCacheListParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsGetActionsCacheListQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + ref: z.string().optional(), + key: z.string().optional(), + sort: z + .enum(["created_at", "last_accessed_at", "size_in_bytes"]) + .optional() + .default("last_accessed_at"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + }) + + const actionsGetActionsCacheListResponseBodyValidator = + responseValidationFactory([["200", s_actions_cache_list]], undefined) + + // actionsGetActionsCacheList + router.get( + `/repos/:owner/:repo/actions/caches`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetActionsCacheListParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsGetActionsCacheListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetActionsCacheList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetActionsCacheListResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteActionsCacheByKeyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsDeleteActionsCacheByKeyQuerySchema = z.object({ + key: z.string(), + ref: z.string().optional(), + }) + + const actionsDeleteActionsCacheByKeyResponseBodyValidator = + responseValidationFactory([["200", s_actions_cache_list]], undefined) + + // actionsDeleteActionsCacheByKey + router.delete( + `/repos/:owner/:repo/actions/caches`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteActionsCacheByKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsDeleteActionsCacheByKeyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteActionsCacheByKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteActionsCacheByKeyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteActionsCacheByIdParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + cache_id: z.coerce.number(), + }) + + const actionsDeleteActionsCacheByIdResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteActionsCacheById + router.delete( + `/repos/:owner/:repo/actions/caches/:cache_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteActionsCacheByIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteActionsCacheById(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteActionsCacheByIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetJobForWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + job_id: z.coerce.number(), + }) + + const actionsGetJobForWorkflowRunResponseBodyValidator = + responseValidationFactory([["200", s_job]], undefined) + + // actionsGetJobForWorkflowRun + router.get( + `/repos/:owner/:repo/actions/jobs/:job_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetJobForWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetJobForWorkflowRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetJobForWorkflowRunResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDownloadJobLogsForWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + job_id: z.coerce.number(), + }) + + const actionsDownloadJobLogsForWorkflowRunResponseBodyValidator = + responseValidationFactory([["302", z.undefined()]], undefined) + + // actionsDownloadJobLogsForWorkflowRun + router.get( + `/repos/:owner/:repo/actions/jobs/:job_id/logs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDownloadJobLogsForWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with302() { + return new ExpressRuntimeResponse(302) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDownloadJobLogsForWorkflowRun( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDownloadJobLogsForWorkflowRunResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsReRunJobForWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + job_id: z.coerce.number(), + }) + + const actionsReRunJobForWorkflowRunRequestBodySchema = z + .object({ + enable_debug_logging: PermissiveBoolean.optional().default(false), + }) + .nullable() + .optional() + + const actionsReRunJobForWorkflowRunResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["403", s_basic_error], + ], + undefined, + ) + + // actionsReRunJobForWorkflowRun + router.post( + `/repos/:owner/:repo/actions/jobs/:job_id/rerun`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsReRunJobForWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsReRunJobForWorkflowRunRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsReRunJobForWorkflowRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsReRunJobForWorkflowRunResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetCustomOidcSubClaimForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsGetCustomOidcSubClaimForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_oidc_custom_sub_repo], + ["400", s_scim_error], + ["404", s_basic_error], + ], + undefined, + ) + + // actionsGetCustomOidcSubClaimForRepo + router.get( + `/repos/:owner/:repo/actions/oidc/customization/sub`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetCustomOidcSubClaimForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetCustomOidcSubClaimForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetCustomOidcSubClaimForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetCustomOidcSubClaimForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsSetCustomOidcSubClaimForRepoRequestBodySchema = z.object({ + use_default: PermissiveBoolean, + include_claim_keys: z.array(z.string()).optional(), + }) + + const actionsSetCustomOidcSubClaimForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["400", s_scim_error], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsSetCustomOidcSubClaimForRepo + router.put( + `/repos/:owner/:repo/actions/oidc/customization/sub`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetCustomOidcSubClaimForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetCustomOidcSubClaimForRepoRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetCustomOidcSubClaimForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetCustomOidcSubClaimForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListRepoOrganizationSecretsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListRepoOrganizationSecretsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListRepoOrganizationSecretsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_actions_secret), + }), + ], + ], + undefined, + ) + + // actionsListRepoOrganizationSecrets + router.get( + `/repos/:owner/:repo/actions/organization-secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListRepoOrganizationSecretsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListRepoOrganizationSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_actions_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListRepoOrganizationSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListRepoOrganizationSecretsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListRepoOrganizationVariablesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListRepoOrganizationVariablesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(10), + page: z.coerce.number().optional().default(1), + }) + + const actionsListRepoOrganizationVariablesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + variables: z.array(s_actions_variable), + }), + ], + ], + undefined, + ) + + // actionsListRepoOrganizationVariables + router.get( + `/repos/:owner/:repo/actions/organization-variables`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListRepoOrganizationVariablesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListRepoOrganizationVariablesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + total_count: number + variables: t_actions_variable[] + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListRepoOrganizationVariables( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListRepoOrganizationVariablesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetGithubActionsPermissionsRepositoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsGetGithubActionsPermissionsRepositoryResponseBodyValidator = + responseValidationFactory( + [["200", s_actions_repository_permissions]], + undefined, + ) + + // actionsGetGithubActionsPermissionsRepository + router.get( + `/repos/:owner/:repo/actions/permissions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetGithubActionsPermissionsRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetGithubActionsPermissionsRepository( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetGithubActionsPermissionsRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetGithubActionsPermissionsRepositoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsSetGithubActionsPermissionsRepositoryRequestBodySchema = + z.object({ + enabled: s_actions_enabled, + allowed_actions: s_allowed_actions.optional(), + }) + + const actionsSetGithubActionsPermissionsRepositoryResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetGithubActionsPermissionsRepository + router.put( + `/repos/:owner/:repo/actions/permissions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetGithubActionsPermissionsRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetGithubActionsPermissionsRepositoryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetGithubActionsPermissionsRepository( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetGithubActionsPermissionsRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetWorkflowAccessToRepositoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsGetWorkflowAccessToRepositoryResponseBodyValidator = + responseValidationFactory( + [["200", s_actions_workflow_access_to_repository]], + undefined, + ) + + // actionsGetWorkflowAccessToRepository + router.get( + `/repos/:owner/:repo/actions/permissions/access`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetWorkflowAccessToRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetWorkflowAccessToRepository( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetWorkflowAccessToRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetWorkflowAccessToRepositoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsSetWorkflowAccessToRepositoryRequestBodySchema = + s_actions_workflow_access_to_repository + + const actionsSetWorkflowAccessToRepositoryResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetWorkflowAccessToRepository + router.put( + `/repos/:owner/:repo/actions/permissions/access`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetWorkflowAccessToRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetWorkflowAccessToRepositoryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetWorkflowAccessToRepository( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetWorkflowAccessToRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetAllowedActionsRepositoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsGetAllowedActionsRepositoryResponseBodyValidator = + responseValidationFactory([["200", s_selected_actions]], undefined) + + // actionsGetAllowedActionsRepository + router.get( + `/repos/:owner/:repo/actions/permissions/selected-actions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetAllowedActionsRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetAllowedActionsRepository(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetAllowedActionsRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetAllowedActionsRepositoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsSetAllowedActionsRepositoryRequestBodySchema = + s_selected_actions.optional() + + const actionsSetAllowedActionsRepositoryResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsSetAllowedActionsRepository + router.put( + `/repos/:owner/:repo/actions/permissions/selected-actions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetAllowedActionsRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetAllowedActionsRepositoryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetAllowedActionsRepository(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetAllowedActionsRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema = + z.object({ owner: z.string(), repo: z.string() }) + + const actionsGetGithubActionsDefaultWorkflowPermissionsRepositoryResponseBodyValidator = + responseValidationFactory( + [["200", s_actions_get_default_workflow_permissions]], + undefined, + ) + + // actionsGetGithubActionsDefaultWorkflowPermissionsRepository + router.get( + `/repos/:owner/:repo/actions/permissions/workflow`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetGithubActionsDefaultWorkflowPermissionsRepository( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetGithubActionsDefaultWorkflowPermissionsRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema = + z.object({ owner: z.string(), repo: z.string() }) + + const actionsSetGithubActionsDefaultWorkflowPermissionsRepositoryRequestBodySchema = + s_actions_set_default_workflow_permissions + + const actionsSetGithubActionsDefaultWorkflowPermissionsRepositoryResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // actionsSetGithubActionsDefaultWorkflowPermissionsRepository + router.put( + `/repos/:owner/:repo/actions/permissions/workflow`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetGithubActionsDefaultWorkflowPermissionsRepositoryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetGithubActionsDefaultWorkflowPermissionsRepository( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetGithubActionsDefaultWorkflowPermissionsRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListSelfHostedRunnersForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListSelfHostedRunnersForRepoQuerySchema = z.object({ + name: z.string().optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListSelfHostedRunnersForRepoResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + runners: z.array(s_runner), + }), + ], + ], + undefined, + ) + + // actionsListSelfHostedRunnersForRepo + router.get( + `/repos/:owner/:repo/actions/runners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListSelfHostedRunnersForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListSelfHostedRunnersForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + runners: t_runner[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListSelfHostedRunnersForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListSelfHostedRunnersForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListRunnerApplicationsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListRunnerApplicationsForRepoResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_runner_application)]], + undefined, + ) + + // actionsListRunnerApplicationsForRepo + router.get( + `/repos/:owner/:repo/actions/runners/downloads`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListRunnerApplicationsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListRunnerApplicationsForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListRunnerApplicationsForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGenerateRunnerJitconfigForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsGenerateRunnerJitconfigForRepoRequestBodySchema = z.object({ + name: z.string(), + runner_group_id: z.coerce.number(), + labels: z.array(z.string()).min(1).max(100), + work_folder: z.string().optional().default("_work"), + }) + + const actionsGenerateRunnerJitconfigForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["201", z.object({ runner: s_runner, encoded_jit_config: z.string() })], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsGenerateRunnerJitconfigForRepo + router.post( + `/repos/:owner/:repo/actions/runners/generate-jitconfig`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGenerateRunnerJitconfigForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsGenerateRunnerJitconfigForRepoRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse<{ + encoded_jit_config: string + runner: t_runner + }>(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGenerateRunnerJitconfigForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGenerateRunnerJitconfigForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateRegistrationTokenForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsCreateRegistrationTokenForRepoResponseBodyValidator = + responseValidationFactory([["201", s_authentication_token]], undefined) + + // actionsCreateRegistrationTokenForRepo + router.post( + `/repos/:owner/:repo/actions/runners/registration-token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateRegistrationTokenForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateRegistrationTokenForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateRegistrationTokenForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateRemoveTokenForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsCreateRemoveTokenForRepoResponseBodyValidator = + responseValidationFactory([["201", s_authentication_token]], undefined) + + // actionsCreateRemoveTokenForRepo + router.post( + `/repos/:owner/:repo/actions/runners/remove-token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateRemoveTokenForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateRemoveTokenForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateRemoveTokenForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetSelfHostedRunnerForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsGetSelfHostedRunnerForRepoResponseBodyValidator = + responseValidationFactory([["200", s_runner]], undefined) + + // actionsGetSelfHostedRunnerForRepo + router.get( + `/repos/:owner/:repo/actions/runners/:runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetSelfHostedRunnerForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetSelfHostedRunnerForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetSelfHostedRunnerForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteSelfHostedRunnerFromRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsDeleteSelfHostedRunnerFromRepoResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteSelfHostedRunnerFromRepo + router.delete( + `/repos/:owner/:repo/actions/runners/:runner_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteSelfHostedRunnerFromRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteSelfHostedRunnerFromRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteSelfHostedRunnerFromRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListLabelsForSelfHostedRunnerForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsListLabelsForSelfHostedRunnerForRepoResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // actionsListLabelsForSelfHostedRunnerForRepo + router.get( + `/repos/:owner/:repo/actions/runners/:runner_id/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListLabelsForSelfHostedRunnerForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListLabelsForSelfHostedRunnerForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListLabelsForSelfHostedRunnerForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsAddCustomLabelsToSelfHostedRunnerForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsAddCustomLabelsToSelfHostedRunnerForRepoRequestBodySchema = + z.object({ labels: z.array(z.string()).min(1).max(100) }) + + const actionsAddCustomLabelsToSelfHostedRunnerForRepoResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsAddCustomLabelsToSelfHostedRunnerForRepo + router.post( + `/repos/:owner/:repo/actions/runners/:runner_id/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsAddCustomLabelsToSelfHostedRunnerForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsAddCustomLabelsToSelfHostedRunnerForRepoRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsAddCustomLabelsToSelfHostedRunnerForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsAddCustomLabelsToSelfHostedRunnerForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsSetCustomLabelsForSelfHostedRunnerForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsSetCustomLabelsForSelfHostedRunnerForRepoRequestBodySchema = + z.object({ labels: z.array(z.string()).min(0).max(100) }) + + const actionsSetCustomLabelsForSelfHostedRunnerForRepoResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsSetCustomLabelsForSelfHostedRunnerForRepo + router.put( + `/repos/:owner/:repo/actions/runners/:runner_id/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsSetCustomLabelsForSelfHostedRunnerForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsSetCustomLabelsForSelfHostedRunnerForRepoRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsSetCustomLabelsForSelfHostedRunnerForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsSetCustomLabelsForSelfHostedRunnerForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoParamSchema = + z.object({ + owner: z.string(), + repo: z.string(), + runner_id: z.coerce.number(), + }) + + const actionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // actionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepo + router.delete( + `/repos/:owner/:repo/actions/runners/:runner_id/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsRemoveCustomLabelFromSelfHostedRunnerForRepoParamSchema = + z.object({ + owner: z.string(), + repo: z.string(), + runner_id: z.coerce.number(), + name: z.string(), + }) + + const actionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + labels: z.array(s_runner_label), + }), + ], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // actionsRemoveCustomLabelFromSelfHostedRunnerForRepo + router.delete( + `/repos/:owner/:repo/actions/runners/:runner_id/labels/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsRemoveCustomLabelFromSelfHostedRunnerForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + labels: t_runner_label[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsRemoveCustomLabelFromSelfHostedRunnerForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListWorkflowRunsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListWorkflowRunsForRepoQuerySchema = z.object({ + actor: z.string().optional(), + branch: z.string().optional(), + event: z.string().optional(), + status: z + .enum([ + "completed", + "action_required", + "cancelled", + "failure", + "neutral", + "skipped", + "stale", + "success", + "timed_out", + "in_progress", + "queued", + "requested", + "waiting", + "pending", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + created: z.string().datetime({ offset: true }).optional(), + exclude_pull_requests: PermissiveBoolean.optional().default(false), + check_suite_id: z.coerce.number().optional(), + head_sha: z.string().optional(), + }) + + const actionsListWorkflowRunsForRepoResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + workflow_runs: z.array(s_workflow_run), + }), + ], + ], + undefined, + ) + + // actionsListWorkflowRunsForRepo + router.get( + `/repos/:owner/:repo/actions/runs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListWorkflowRunsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListWorkflowRunsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + total_count: number + workflow_runs: t_workflow_run[] + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListWorkflowRunsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListWorkflowRunsForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsGetWorkflowRunQuerySchema = z.object({ + exclude_pull_requests: PermissiveBoolean.optional().default(false), + }) + + const actionsGetWorkflowRunResponseBodyValidator = responseValidationFactory( + [["200", s_workflow_run]], + undefined, + ) + + // actionsGetWorkflowRun + router.get( + `/repos/:owner/:repo/actions/runs/:run_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsGetWorkflowRunQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetWorkflowRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetWorkflowRunResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsDeleteWorkflowRunResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteWorkflowRun + router.delete( + `/repos/:owner/:repo/actions/runs/:run_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteWorkflowRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsDeleteWorkflowRunResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetReviewsForRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsGetReviewsForRunResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_environment_approvals)]], + undefined, + ) + + // actionsGetReviewsForRun + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/approvals`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetReviewsForRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetReviewsForRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetReviewsForRunResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsApproveWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsApproveWorkflowRunResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // actionsApproveWorkflowRun + router.post( + `/repos/:owner/:repo/actions/runs/:run_id/approve`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsApproveWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsApproveWorkflowRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsApproveWorkflowRunResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListWorkflowRunArtifactsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsListWorkflowRunArtifactsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + name: z.string().optional(), + }) + + const actionsListWorkflowRunArtifactsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + artifacts: z.array(s_artifact), + }), + ], + ], + undefined, + ) + + // actionsListWorkflowRunArtifacts + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/artifacts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListWorkflowRunArtifactsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListWorkflowRunArtifactsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + artifacts: t_artifact[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListWorkflowRunArtifacts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListWorkflowRunArtifactsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetWorkflowRunAttemptParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + attempt_number: z.coerce.number(), + }) + + const actionsGetWorkflowRunAttemptQuerySchema = z.object({ + exclude_pull_requests: PermissiveBoolean.optional().default(false), + }) + + const actionsGetWorkflowRunAttemptResponseBodyValidator = + responseValidationFactory([["200", s_workflow_run]], undefined) + + // actionsGetWorkflowRunAttempt + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/attempts/:attempt_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetWorkflowRunAttemptParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsGetWorkflowRunAttemptQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetWorkflowRunAttempt(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetWorkflowRunAttemptResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListJobsForWorkflowRunAttemptParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + attempt_number: z.coerce.number(), + }) + + const actionsListJobsForWorkflowRunAttemptQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListJobsForWorkflowRunAttemptResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ total_count: z.coerce.number(), jobs: z.array(s_job) }), + ], + ["404", s_basic_error], + ], + undefined, + ) + + // actionsListJobsForWorkflowRunAttempt + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/attempts/:attempt_number/jobs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListJobsForWorkflowRunAttemptParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListJobsForWorkflowRunAttemptQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + jobs: t_job[] + total_count: number + }>(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListJobsForWorkflowRunAttempt( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListJobsForWorkflowRunAttemptResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDownloadWorkflowRunAttemptLogsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + attempt_number: z.coerce.number(), + }) + + const actionsDownloadWorkflowRunAttemptLogsResponseBodyValidator = + responseValidationFactory([["302", z.undefined()]], undefined) + + // actionsDownloadWorkflowRunAttemptLogs + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/attempts/:attempt_number/logs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDownloadWorkflowRunAttemptLogsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with302() { + return new ExpressRuntimeResponse(302) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDownloadWorkflowRunAttemptLogs( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDownloadWorkflowRunAttemptLogsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCancelWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsCancelWorkflowRunResponseBodyValidator = + responseValidationFactory( + [ + ["202", s_empty_object], + ["409", s_basic_error], + ], + undefined, + ) + + // actionsCancelWorkflowRun + router.post( + `/repos/:owner/:repo/actions/runs/:run_id/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCancelWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCancelWorkflowRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsCancelWorkflowRunResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsReviewCustomGatesForRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsReviewCustomGatesForRunRequestBodySchema = z.union([ + s_review_custom_gates_comment_required, + s_review_custom_gates_state_required, + ]) + + const actionsReviewCustomGatesForRunResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsReviewCustomGatesForRun + router.post( + `/repos/:owner/:repo/actions/runs/:run_id/deployment_protection_rule`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsReviewCustomGatesForRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsReviewCustomGatesForRunRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsReviewCustomGatesForRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsReviewCustomGatesForRunResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsForceCancelWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsForceCancelWorkflowRunResponseBodyValidator = + responseValidationFactory( + [ + ["202", s_empty_object], + ["409", s_basic_error], + ], + undefined, + ) + + // actionsForceCancelWorkflowRun + router.post( + `/repos/:owner/:repo/actions/runs/:run_id/force-cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsForceCancelWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsForceCancelWorkflowRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsForceCancelWorkflowRunResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListJobsForWorkflowRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsListJobsForWorkflowRunQuerySchema = z.object({ + filter: z.enum(["latest", "all"]).optional().default("latest"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListJobsForWorkflowRunResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ total_count: z.coerce.number(), jobs: z.array(s_job) }), + ], + ], + undefined, + ) + + // actionsListJobsForWorkflowRun + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/jobs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListJobsForWorkflowRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListJobsForWorkflowRunQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + jobs: t_job[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListJobsForWorkflowRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListJobsForWorkflowRunResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDownloadWorkflowRunLogsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsDownloadWorkflowRunLogsResponseBodyValidator = + responseValidationFactory([["302", z.undefined()]], undefined) + + // actionsDownloadWorkflowRunLogs + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/logs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDownloadWorkflowRunLogsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with302() { + return new ExpressRuntimeResponse(302) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDownloadWorkflowRunLogs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDownloadWorkflowRunLogsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteWorkflowRunLogsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsDeleteWorkflowRunLogsResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // actionsDeleteWorkflowRunLogs + router.delete( + `/repos/:owner/:repo/actions/runs/:run_id/logs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteWorkflowRunLogsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteWorkflowRunLogs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteWorkflowRunLogsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetPendingDeploymentsForRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsGetPendingDeploymentsForRunResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_pending_deployment)]], + undefined, + ) + + // actionsGetPendingDeploymentsForRun + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/pending_deployments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetPendingDeploymentsForRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetPendingDeploymentsForRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetPendingDeploymentsForRunResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsReviewPendingDeploymentsForRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsReviewPendingDeploymentsForRunRequestBodySchema = z.object({ + environment_ids: z.array(z.coerce.number()), + state: z.enum(["approved", "rejected"]), + comment: z.string(), + }) + + const actionsReviewPendingDeploymentsForRunResponseBodyValidator = + responseValidationFactory([["200", z.array(s_deployment)]], undefined) + + // actionsReviewPendingDeploymentsForRun + router.post( + `/repos/:owner/:repo/actions/runs/:run_id/pending_deployments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsReviewPendingDeploymentsForRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsReviewPendingDeploymentsForRunRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsReviewPendingDeploymentsForRun( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsReviewPendingDeploymentsForRunResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsReRunWorkflowParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsReRunWorkflowRequestBodySchema = z + .object({ + enable_debug_logging: PermissiveBoolean.optional().default(false), + }) + .nullable() + .optional() + + const actionsReRunWorkflowResponseBodyValidator = responseValidationFactory( + [["201", s_empty_object]], + undefined, + ) + + // actionsReRunWorkflow + router.post( + `/repos/:owner/:repo/actions/runs/:run_id/rerun`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsReRunWorkflowParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsReRunWorkflowRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsReRunWorkflow(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsReRunWorkflowResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsReRunWorkflowFailedJobsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsReRunWorkflowFailedJobsRequestBodySchema = z + .object({ + enable_debug_logging: PermissiveBoolean.optional().default(false), + }) + .nullable() + .optional() + + const actionsReRunWorkflowFailedJobsResponseBodyValidator = + responseValidationFactory([["201", s_empty_object]], undefined) + + // actionsReRunWorkflowFailedJobs + router.post( + `/repos/:owner/:repo/actions/runs/:run_id/rerun-failed-jobs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsReRunWorkflowFailedJobsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsReRunWorkflowFailedJobsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsReRunWorkflowFailedJobs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsReRunWorkflowFailedJobsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetWorkflowRunUsageParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + run_id: z.coerce.number(), + }) + + const actionsGetWorkflowRunUsageResponseBodyValidator = + responseValidationFactory([["200", s_workflow_run_usage]], undefined) + + // actionsGetWorkflowRunUsage + router.get( + `/repos/:owner/:repo/actions/runs/:run_id/timing`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetWorkflowRunUsageParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetWorkflowRunUsage(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetWorkflowRunUsageResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListRepoSecretsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListRepoSecretsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListRepoSecretsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_actions_secret), + }), + ], + ], + undefined, + ) + + // actionsListRepoSecrets + router.get( + `/repos/:owner/:repo/actions/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListRepoSecretsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListRepoSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_actions_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListRepoSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsListRepoSecretsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetRepoPublicKeyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsGetRepoPublicKeyResponseBodyValidator = + responseValidationFactory([["200", s_actions_public_key]], undefined) + + // actionsGetRepoPublicKey + router.get( + `/repos/:owner/:repo/actions/secrets/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetRepoPublicKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetRepoPublicKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetRepoPublicKeyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const actionsGetRepoSecretResponseBodyValidator = responseValidationFactory( + [["200", s_actions_secret]], + undefined, + ) + + // actionsGetRepoSecret + router.get( + `/repos/:owner/:repo/actions/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetRepoSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateOrUpdateRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const actionsCreateOrUpdateRepoSecretRequestBodySchema = z.object({ + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ), + key_id: z.string(), + }) + + const actionsCreateOrUpdateRepoSecretResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["204", z.undefined()], + ], + undefined, + ) + + // actionsCreateOrUpdateRepoSecret + router.put( + `/repos/:owner/:repo/actions/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateOrUpdateRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateOrUpdateRepoSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateOrUpdateRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateOrUpdateRepoSecretResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const actionsDeleteRepoSecretResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteRepoSecret + router.delete( + `/repos/:owner/:repo/actions/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsDeleteRepoSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListRepoVariablesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListRepoVariablesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(10), + page: z.coerce.number().optional().default(1), + }) + + const actionsListRepoVariablesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + variables: z.array(s_actions_variable), + }), + ], + ], + undefined, + ) + + // actionsListRepoVariables + router.get( + `/repos/:owner/:repo/actions/variables`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListRepoVariablesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListRepoVariablesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + total_count: number + variables: t_actions_variable[] + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListRepoVariables(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsListRepoVariablesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateRepoVariableParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsCreateRepoVariableRequestBodySchema = z.object({ + name: z.string(), + value: z.string(), + }) + + const actionsCreateRepoVariableResponseBodyValidator = + responseValidationFactory([["201", s_empty_object]], undefined) + + // actionsCreateRepoVariable + router.post( + `/repos/:owner/:repo/actions/variables`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateRepoVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateRepoVariableRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateRepoVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsCreateRepoVariableResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetRepoVariableParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + name: z.string(), + }) + + const actionsGetRepoVariableResponseBodyValidator = responseValidationFactory( + [["200", s_actions_variable]], + undefined, + ) + + // actionsGetRepoVariable + router.get( + `/repos/:owner/:repo/actions/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetRepoVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetRepoVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetRepoVariableResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsUpdateRepoVariableParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + name: z.string(), + }) + + const actionsUpdateRepoVariableRequestBodySchema = z.object({ + name: z.string().optional(), + value: z.string().optional(), + }) + + const actionsUpdateRepoVariableResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsUpdateRepoVariable + router.patch( + `/repos/:owner/:repo/actions/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsUpdateRepoVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsUpdateRepoVariableRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsUpdateRepoVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsUpdateRepoVariableResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteRepoVariableParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + name: z.string(), + }) + + const actionsDeleteRepoVariableResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteRepoVariable + router.delete( + `/repos/:owner/:repo/actions/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteRepoVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteRepoVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsDeleteRepoVariableResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListRepoWorkflowsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const actionsListRepoWorkflowsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListRepoWorkflowsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + workflows: z.array(s_workflow), + }), + ], + ], + undefined, + ) + + // actionsListRepoWorkflows + router.get( + `/repos/:owner/:repo/actions/workflows`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListRepoWorkflowsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListRepoWorkflowsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + total_count: number + workflows: t_workflow[] + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListRepoWorkflows(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsListRepoWorkflowsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetWorkflowParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + workflow_id: z.union([z.coerce.number(), z.string()]), + }) + + const actionsGetWorkflowResponseBodyValidator = responseValidationFactory( + [["200", s_workflow]], + undefined, + ) + + // actionsGetWorkflow + router.get( + `/repos/:owner/:repo/actions/workflows/:workflow_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetWorkflowParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetWorkflow(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetWorkflowResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDisableWorkflowParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + workflow_id: z.union([z.coerce.number(), z.string()]), + }) + + const actionsDisableWorkflowResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // actionsDisableWorkflow + router.put( + `/repos/:owner/:repo/actions/workflows/:workflow_id/disable`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDisableWorkflowParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDisableWorkflow(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsDisableWorkflowResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateWorkflowDispatchParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + workflow_id: z.union([z.coerce.number(), z.string()]), + }) + + const actionsCreateWorkflowDispatchRequestBodySchema = z.object({ + ref: z.string(), + inputs: z.record(z.unknown()).optional(), + }) + + const actionsCreateWorkflowDispatchResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsCreateWorkflowDispatch + router.post( + `/repos/:owner/:repo/actions/workflows/:workflow_id/dispatches`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateWorkflowDispatchParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateWorkflowDispatchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateWorkflowDispatch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateWorkflowDispatchResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsEnableWorkflowParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + workflow_id: z.union([z.coerce.number(), z.string()]), + }) + + const actionsEnableWorkflowResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // actionsEnableWorkflow + router.put( + `/repos/:owner/:repo/actions/workflows/:workflow_id/enable`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsEnableWorkflowParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsEnableWorkflow(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsEnableWorkflowResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListWorkflowRunsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + workflow_id: z.union([z.coerce.number(), z.string()]), + }) + + const actionsListWorkflowRunsQuerySchema = z.object({ + actor: z.string().optional(), + branch: z.string().optional(), + event: z.string().optional(), + status: z + .enum([ + "completed", + "action_required", + "cancelled", + "failure", + "neutral", + "skipped", + "stale", + "success", + "timed_out", + "in_progress", + "queued", + "requested", + "waiting", + "pending", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + created: z.string().datetime({ offset: true }).optional(), + exclude_pull_requests: PermissiveBoolean.optional().default(false), + check_suite_id: z.coerce.number().optional(), + head_sha: z.string().optional(), + }) + + const actionsListWorkflowRunsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + workflow_runs: z.array(s_workflow_run), + }), + ], + ], + undefined, + ) + + // actionsListWorkflowRuns + router.get( + `/repos/:owner/:repo/actions/workflows/:workflow_id/runs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListWorkflowRunsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListWorkflowRunsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + total_count: number + workflow_runs: t_workflow_run[] + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListWorkflowRuns(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsListWorkflowRunsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetWorkflowUsageParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + workflow_id: z.union([z.coerce.number(), z.string()]), + }) + + const actionsGetWorkflowUsageResponseBodyValidator = + responseValidationFactory([["200", s_workflow_usage]], undefined) + + // actionsGetWorkflowUsage + router.get( + `/repos/:owner/:repo/actions/workflows/:workflow_id/timing`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetWorkflowUsageParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetWorkflowUsage(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(actionsGetWorkflowUsageResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListActivitiesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListActivitiesQuerySchema = z.object({ + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + ref: z.string().optional(), + actor: z.string().optional(), + time_period: z.enum(["day", "week", "month", "quarter", "year"]).optional(), + activity_type: z + .enum([ + "push", + "force_push", + "branch_creation", + "branch_deletion", + "pr_merge", + "merge_queue_merge", + ]) + .optional(), + }) + + const reposListActivitiesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_activity)], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // reposListActivities + router.get( + `/repos/:owner/:repo/activity`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListActivitiesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListActivitiesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListActivities(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListActivitiesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListAssigneesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesListAssigneesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListAssigneesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesListAssignees + router.get( + `/repos/:owner/:repo/assignees`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListAssigneesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListAssigneesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListAssignees(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListAssigneesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesCheckUserCanBeAssignedParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + assignee: z.string(), + }) + + const issuesCheckUserCanBeAssignedResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesCheckUserCanBeAssigned + router.get( + `/repos/:owner/:repo/assignees/:assignee`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesCheckUserCanBeAssignedParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesCheckUserCanBeAssigned(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + issuesCheckUserCanBeAssignedResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateAttestationParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateAttestationRequestBodySchema = z.object({ + bundle: z.object({ + mediaType: z.string().optional(), + verificationMaterial: z.record(z.unknown()).optional(), + dsseEnvelope: z.record(z.unknown()).optional(), + }), + }) + + const reposCreateAttestationResponseBodyValidator = responseValidationFactory( + [ + ["201", z.object({ id: z.coerce.number().optional() })], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateAttestation + router.post( + `/repos/:owner/:repo/attestations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateAttestationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateAttestationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse<{ + id?: number | undefined + }>(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateAttestation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateAttestationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListAttestationsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + subject_digest: z.string(), + }) + + const reposListAttestationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + predicate_type: z.string().optional(), + }) + + const reposListAttestationsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + attestations: z + .array( + z.object({ + bundle: z + .object({ + mediaType: z.string().optional(), + verificationMaterial: z.record(z.unknown()).optional(), + dsseEnvelope: z.record(z.unknown()).optional(), + }) + .optional(), + repository_id: z.coerce.number().optional(), + bundle_url: z.string().optional(), + }), + ) + .optional(), + }), + ], + ], + undefined, + ) + + // reposListAttestations + router.get( + `/repos/:owner/:repo/attestations/:subject_digest`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListAttestationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListAttestationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + attestations?: + | { + bundle?: + | { + dsseEnvelope?: + | { + [key: string]: unknown | undefined + } + | undefined + mediaType?: string | undefined + verificationMaterial?: + | { + [key: string]: unknown | undefined + } + | undefined + } + | undefined + bundle_url?: string | undefined + repository_id?: number | undefined + }[] + | undefined + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListAttestations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListAttestationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListAutolinksParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListAutolinksResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_autolink)]], + undefined, + ) + + // reposListAutolinks + router.get( + `/repos/:owner/:repo/autolinks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListAutolinksParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListAutolinks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListAutolinksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateAutolinkParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateAutolinkRequestBodySchema = z.object({ + key_prefix: z.string(), + url_template: z.string(), + is_alphanumeric: PermissiveBoolean.optional().default(true), + }) + + const reposCreateAutolinkResponseBodyValidator = responseValidationFactory( + [ + ["201", s_autolink], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateAutolink + router.post( + `/repos/:owner/:repo/autolinks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateAutolinkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateAutolinkRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateAutolink(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateAutolinkResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetAutolinkParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + autolink_id: z.coerce.number(), + }) + + const reposGetAutolinkResponseBodyValidator = responseValidationFactory( + [ + ["200", s_autolink], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetAutolink + router.get( + `/repos/:owner/:repo/autolinks/:autolink_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetAutolinkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetAutolink(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetAutolinkResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteAutolinkParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + autolink_id: z.coerce.number(), + }) + + const reposDeleteAutolinkResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposDeleteAutolink + router.delete( + `/repos/:owner/:repo/autolinks/:autolink_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteAutolinkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteAutolink(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteAutolinkResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCheckAutomatedSecurityFixesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCheckAutomatedSecurityFixesResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_check_automated_security_fixes], + ["404", z.undefined()], + ], + undefined, + ) + + // reposCheckAutomatedSecurityFixes + router.get( + `/repos/:owner/:repo/automated-security-fixes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCheckAutomatedSecurityFixesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCheckAutomatedSecurityFixes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCheckAutomatedSecurityFixesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposEnableAutomatedSecurityFixesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposEnableAutomatedSecurityFixesResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposEnableAutomatedSecurityFixes + router.put( + `/repos/:owner/:repo/automated-security-fixes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposEnableAutomatedSecurityFixesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposEnableAutomatedSecurityFixes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposEnableAutomatedSecurityFixesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDisableAutomatedSecurityFixesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposDisableAutomatedSecurityFixesResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposDisableAutomatedSecurityFixes + router.delete( + `/repos/:owner/:repo/automated-security-fixes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDisableAutomatedSecurityFixesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDisableAutomatedSecurityFixes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDisableAutomatedSecurityFixesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListBranchesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListBranchesQuerySchema = z.object({ + protected: PermissiveBoolean.optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListBranchesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_short_branch)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListBranches + router.get( + `/repos/:owner/:repo/branches`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListBranchesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListBranchesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListBranches(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListBranchesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetBranchParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetBranchResponseBodyValidator = responseValidationFactory( + [ + ["200", s_branch_with_protection], + ["301", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetBranch + router.get( + `/repos/:owner/:repo/branches/:branch`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetBranchParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetBranch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetBranchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetBranchProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetBranchProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_branch_protection], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetBranchProtection + router.get( + `/repos/:owner/:repo/branches/:branch/protection`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetBranchProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetBranchProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetBranchProtectionResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateBranchProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposUpdateBranchProtectionRequestBodySchema = z.object({ + required_status_checks: z + .object({ + strict: PermissiveBoolean, + contexts: z.array(z.string()), + checks: z + .array( + z.object({ + context: z.string(), + app_id: z.coerce.number().optional(), + }), + ) + .optional(), + }) + .nullable(), + enforce_admins: PermissiveBoolean.nullable(), + required_pull_request_reviews: z + .object({ + dismissal_restrictions: z + .object({ + users: z.array(z.string()).optional(), + teams: z.array(z.string()).optional(), + apps: z.array(z.string()).optional(), + }) + .optional(), + dismiss_stale_reviews: PermissiveBoolean.optional(), + require_code_owner_reviews: PermissiveBoolean.optional(), + required_approving_review_count: z.coerce.number().optional(), + require_last_push_approval: PermissiveBoolean.optional().default(false), + bypass_pull_request_allowances: z + .object({ + users: z.array(z.string()).optional(), + teams: z.array(z.string()).optional(), + apps: z.array(z.string()).optional(), + }) + .optional(), + }) + .nullable(), + restrictions: z + .object({ + users: z.array(z.string()), + teams: z.array(z.string()), + apps: z.array(z.string()).optional(), + }) + .nullable(), + required_linear_history: PermissiveBoolean.optional(), + allow_force_pushes: PermissiveBoolean.nullable().optional(), + allow_deletions: PermissiveBoolean.optional(), + block_creations: PermissiveBoolean.optional(), + required_conversation_resolution: PermissiveBoolean.optional(), + lock_branch: PermissiveBoolean.optional().default(false), + allow_fork_syncing: PermissiveBoolean.optional().default(false), + }) + + const reposUpdateBranchProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_protected_branch], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // reposUpdateBranchProtection + router.put( + `/repos/:owner/:repo/branches/:branch/protection`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateBranchProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateBranchProtectionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateBranchProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposUpdateBranchProtectionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteBranchProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposDeleteBranchProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ], + undefined, + ) + + // reposDeleteBranchProtection + router.delete( + `/repos/:owner/:repo/branches/:branch/protection`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteBranchProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteBranchProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDeleteBranchProtectionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetAdminBranchProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetAdminBranchProtectionResponseBodyValidator = + responseValidationFactory( + [["200", s_protected_branch_admin_enforced]], + undefined, + ) + + // reposGetAdminBranchProtection + router.get( + `/repos/:owner/:repo/branches/:branch/protection/enforce_admins`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetAdminBranchProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetAdminBranchProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetAdminBranchProtectionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposSetAdminBranchProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposSetAdminBranchProtectionResponseBodyValidator = + responseValidationFactory( + [["200", s_protected_branch_admin_enforced]], + undefined, + ) + + // reposSetAdminBranchProtection + router.post( + `/repos/:owner/:repo/branches/:branch/protection/enforce_admins`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposSetAdminBranchProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposSetAdminBranchProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposSetAdminBranchProtectionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteAdminBranchProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposDeleteAdminBranchProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposDeleteAdminBranchProtection + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/enforce_admins`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteAdminBranchProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteAdminBranchProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDeleteAdminBranchProtectionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetPullRequestReviewProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetPullRequestReviewProtectionResponseBodyValidator = + responseValidationFactory( + [["200", s_protected_branch_pull_request_review]], + undefined, + ) + + // reposGetPullRequestReviewProtection + router.get( + `/repos/:owner/:repo/branches/:branch/protection/required_pull_request_reviews`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetPullRequestReviewProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetPullRequestReviewProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetPullRequestReviewProtectionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdatePullRequestReviewProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposUpdatePullRequestReviewProtectionRequestBodySchema = z + .object({ + dismissal_restrictions: z + .object({ + users: z.array(z.string()).optional(), + teams: z.array(z.string()).optional(), + apps: z.array(z.string()).optional(), + }) + .optional(), + dismiss_stale_reviews: PermissiveBoolean.optional(), + require_code_owner_reviews: PermissiveBoolean.optional(), + required_approving_review_count: z.coerce.number().optional(), + require_last_push_approval: PermissiveBoolean.optional().default(false), + bypass_pull_request_allowances: z + .object({ + users: z.array(z.string()).optional(), + teams: z.array(z.string()).optional(), + apps: z.array(z.string()).optional(), + }) + .optional(), + }) + .optional() + + const reposUpdatePullRequestReviewProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_protected_branch_pull_request_review], + ["422", s_validation_error], + ], + undefined, + ) + + // reposUpdatePullRequestReviewProtection + router.patch( + `/repos/:owner/:repo/branches/:branch/protection/required_pull_request_reviews`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdatePullRequestReviewProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdatePullRequestReviewProtectionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdatePullRequestReviewProtection( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposUpdatePullRequestReviewProtectionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeletePullRequestReviewProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposDeletePullRequestReviewProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposDeletePullRequestReviewProtection + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/required_pull_request_reviews`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeletePullRequestReviewProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeletePullRequestReviewProtection( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDeletePullRequestReviewProtectionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCommitSignatureProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetCommitSignatureProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_protected_branch_admin_enforced], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetCommitSignatureProtection + router.get( + `/repos/:owner/:repo/branches/:branch/protection/required_signatures`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCommitSignatureProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCommitSignatureProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetCommitSignatureProtectionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateCommitSignatureProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposCreateCommitSignatureProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_protected_branch_admin_enforced], + ["404", s_basic_error], + ], + undefined, + ) + + // reposCreateCommitSignatureProtection + router.post( + `/repos/:owner/:repo/branches/:branch/protection/required_signatures`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateCommitSignatureProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateCommitSignatureProtection( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreateCommitSignatureProtectionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteCommitSignatureProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposDeleteCommitSignatureProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposDeleteCommitSignatureProtection + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/required_signatures`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteCommitSignatureProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteCommitSignatureProtection( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDeleteCommitSignatureProtectionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetStatusChecksProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetStatusChecksProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_status_check_policy], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetStatusChecksProtection + router.get( + `/repos/:owner/:repo/branches/:branch/protection/required_status_checks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetStatusChecksProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetStatusChecksProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetStatusChecksProtectionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateStatusCheckProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposUpdateStatusCheckProtectionRequestBodySchema = z + .object({ + strict: PermissiveBoolean.optional(), + contexts: z.array(z.string()).optional(), + checks: z + .array( + z.object({ + context: z.string(), + app_id: z.coerce.number().optional(), + }), + ) + .optional(), + }) + .optional() + + const reposUpdateStatusCheckProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_status_check_policy], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposUpdateStatusCheckProtection + router.patch( + `/repos/:owner/:repo/branches/:branch/protection/required_status_checks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateStatusCheckProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateStatusCheckProtectionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateStatusCheckProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposUpdateStatusCheckProtectionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRemoveStatusCheckProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposRemoveStatusCheckProtectionResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposRemoveStatusCheckProtection + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/required_status_checks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRemoveStatusCheckProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRemoveStatusCheckProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposRemoveStatusCheckProtectionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetAllStatusCheckContextsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetAllStatusCheckContextsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(z.string())], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetAllStatusCheckContexts + router.get( + `/repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetAllStatusCheckContextsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetAllStatusCheckContexts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetAllStatusCheckContextsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposAddStatusCheckContextsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposAddStatusCheckContextsRequestBodySchema = z + .union([z.object({ contexts: z.array(z.string()) }), z.array(z.string())]) + .optional() + + const reposAddStatusCheckContextsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(z.string())], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposAddStatusCheckContexts + router.post( + `/repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposAddStatusCheckContextsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposAddStatusCheckContextsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposAddStatusCheckContexts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposAddStatusCheckContextsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposSetStatusCheckContextsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposSetStatusCheckContextsRequestBodySchema = z + .union([z.object({ contexts: z.array(z.string()) }), z.array(z.string())]) + .optional() + + const reposSetStatusCheckContextsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(z.string())], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposSetStatusCheckContexts + router.put( + `/repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposSetStatusCheckContextsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposSetStatusCheckContextsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposSetStatusCheckContexts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposSetStatusCheckContextsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRemoveStatusCheckContextsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposRemoveStatusCheckContextsRequestBodySchema = z.union([ + z.object({ contexts: z.array(z.string()) }), + z.array(z.string()), + ]) + + const reposRemoveStatusCheckContextsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(z.string())], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposRemoveStatusCheckContexts + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRemoveStatusCheckContextsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposRemoveStatusCheckContextsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRemoveStatusCheckContexts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposRemoveStatusCheckContextsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_branch_restriction_policy], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetAccessRestrictions + router.get( + `/repos/:owner/:repo/branches/:branch/protection/restrictions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposDeleteAccessRestrictionsResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposDeleteAccessRestrictions + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/restrictions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDeleteAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetAppsWithAccessToProtectedBranchParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetAppsWithAccessToProtectedBranchResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_integration)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetAppsWithAccessToProtectedBranch + router.get( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/apps`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetAppsWithAccessToProtectedBranchParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetAppsWithAccessToProtectedBranch( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetAppsWithAccessToProtectedBranchResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposAddAppAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposAddAppAccessRestrictionsRequestBodySchema = z.object({ + apps: z.array(z.string()), + }) + + const reposAddAppAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_integration)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposAddAppAccessRestrictions + router.post( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/apps`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposAddAppAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposAddAppAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposAddAppAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposAddAppAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposSetAppAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposSetAppAccessRestrictionsRequestBodySchema = z.object({ + apps: z.array(z.string()), + }) + + const reposSetAppAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_integration)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposSetAppAccessRestrictions + router.put( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/apps`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposSetAppAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposSetAppAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposSetAppAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposSetAppAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRemoveAppAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposRemoveAppAccessRestrictionsRequestBodySchema = z.object({ + apps: z.array(z.string()), + }) + + const reposRemoveAppAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_integration)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposRemoveAppAccessRestrictions + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/apps`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRemoveAppAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposRemoveAppAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRemoveAppAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposRemoveAppAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetTeamsWithAccessToProtectedBranchParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetTeamsWithAccessToProtectedBranchResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_team)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetTeamsWithAccessToProtectedBranch + router.get( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetTeamsWithAccessToProtectedBranchParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetTeamsWithAccessToProtectedBranch( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetTeamsWithAccessToProtectedBranchResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposAddTeamAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposAddTeamAccessRestrictionsRequestBodySchema = z + .union([z.object({ teams: z.array(z.string()) }), z.array(z.string())]) + .optional() + + const reposAddTeamAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_team)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposAddTeamAccessRestrictions + router.post( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposAddTeamAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposAddTeamAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposAddTeamAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposAddTeamAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposSetTeamAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposSetTeamAccessRestrictionsRequestBodySchema = z + .union([z.object({ teams: z.array(z.string()) }), z.array(z.string())]) + .optional() + + const reposSetTeamAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_team)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposSetTeamAccessRestrictions + router.put( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposSetTeamAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposSetTeamAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposSetTeamAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposSetTeamAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRemoveTeamAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposRemoveTeamAccessRestrictionsRequestBodySchema = z.union([ + z.object({ teams: z.array(z.string()) }), + z.array(z.string()), + ]) + + const reposRemoveTeamAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_team)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposRemoveTeamAccessRestrictions + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRemoveTeamAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposRemoveTeamAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRemoveTeamAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposRemoveTeamAccessRestrictionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetUsersWithAccessToProtectedBranchParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetUsersWithAccessToProtectedBranchResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetUsersWithAccessToProtectedBranch + router.get( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetUsersWithAccessToProtectedBranchParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetUsersWithAccessToProtectedBranch( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetUsersWithAccessToProtectedBranchResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposAddUserAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposAddUserAccessRestrictionsRequestBodySchema = z.object({ + users: z.array(z.string()), + }) + + const reposAddUserAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposAddUserAccessRestrictions + router.post( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposAddUserAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposAddUserAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposAddUserAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposAddUserAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposSetUserAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposSetUserAccessRestrictionsRequestBodySchema = z.object({ + users: z.array(z.string()), + }) + + const reposSetUserAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposSetUserAccessRestrictions + router.put( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposSetUserAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposSetUserAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposSetUserAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposSetUserAccessRestrictionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRemoveUserAccessRestrictionsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposRemoveUserAccessRestrictionsRequestBodySchema = z.object({ + users: z.array(z.string()), + }) + + const reposRemoveUserAccessRestrictionsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["422", s_validation_error], + ], + undefined, + ) + + // reposRemoveUserAccessRestrictions + router.delete( + `/repos/:owner/:repo/branches/:branch/protection/restrictions/users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRemoveUserAccessRestrictionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposRemoveUserAccessRestrictionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRemoveUserAccessRestrictions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposRemoveUserAccessRestrictionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRenameBranchParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposRenameBranchRequestBodySchema = z.object({ new_name: z.string() }) + + const reposRenameBranchResponseBodyValidator = responseValidationFactory( + [ + ["201", s_branch_with_protection], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposRenameBranch + router.post( + `/repos/:owner/:repo/branches/:branch/rename`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRenameBranchParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposRenameBranchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRenameBranch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposRenameBranchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksCreateParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const checksCreateRequestBodySchema = z.union([ + z.intersection(z.object({ status: z.object({}) }), z.record(z.unknown())), + z.intersection( + z.object({ status: z.object({}).optional() }), + z.record(z.unknown()), + ), + ]) + + const checksCreateResponseBodyValidator = responseValidationFactory( + [["201", s_check_run]], + undefined, + ) + + // checksCreate + router.post( + `/repos/:owner/:repo/check-runs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksCreateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + checksCreateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksCreate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksCreateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksGetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + check_run_id: z.coerce.number(), + }) + + const checksGetResponseBodyValidator = responseValidationFactory( + [["200", s_check_run]], + undefined, + ) + + // checksGet + router.get( + `/repos/:owner/:repo/check-runs/:check_run_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksUpdateParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + check_run_id: z.coerce.number(), + }) + + const checksUpdateRequestBodySchema = z.object({ + name: z.string().optional(), + details_url: z.string().optional(), + external_id: z.string().optional(), + started_at: z.string().datetime({ offset: true }).optional(), + status: z + .enum([ + "queued", + "in_progress", + "completed", + "waiting", + "requested", + "pending", + ]) + .optional(), + conclusion: z + .enum([ + "action_required", + "cancelled", + "failure", + "neutral", + "success", + "skipped", + "stale", + "timed_out", + ]) + .optional(), + completed_at: z.string().datetime({ offset: true }).optional(), + output: z + .object({ + title: z.string().optional(), + summary: z.string().max(65535), + text: z.string().max(65535).optional(), + annotations: z + .array( + z.object({ + path: z.string(), + start_line: z.coerce.number(), + end_line: z.coerce.number(), + start_column: z.coerce.number().optional(), + end_column: z.coerce.number().optional(), + annotation_level: z.enum(["notice", "warning", "failure"]), + message: z.string(), + title: z.string().optional(), + raw_details: z.string().optional(), + }), + ) + .max(50) + .optional(), + images: z + .array( + z.object({ + alt: z.string(), + image_url: z.string(), + caption: z.string().optional(), + }), + ) + .optional(), + }) + .optional(), + actions: z + .array( + z.object({ + label: z.string().max(20), + description: z.string().max(40), + identifier: z.string().max(20), + }), + ) + .max(3) + .optional(), + }) + + const checksUpdateResponseBodyValidator = responseValidationFactory( + [["200", s_check_run]], + undefined, + ) + + // checksUpdate + router.patch( + `/repos/:owner/:repo/check-runs/:check_run_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + checksUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksListAnnotationsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + check_run_id: z.coerce.number(), + }) + + const checksListAnnotationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const checksListAnnotationsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_check_annotation)]], + undefined, + ) + + // checksListAnnotations + router.get( + `/repos/:owner/:repo/check-runs/:check_run_id/annotations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksListAnnotationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + checksListAnnotationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksListAnnotations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksListAnnotationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksRerequestRunParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + check_run_id: z.coerce.number(), + }) + + const checksRerequestRunResponseBodyValidator = responseValidationFactory( + [ + ["201", s_empty_object], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_basic_error], + ], + undefined, + ) + + // checksRerequestRun + router.post( + `/repos/:owner/:repo/check-runs/:check_run_id/rerequest`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksRerequestRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksRerequestRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksRerequestRunResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksCreateSuiteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const checksCreateSuiteRequestBodySchema = z.object({ head_sha: z.string() }) + + const checksCreateSuiteResponseBodyValidator = responseValidationFactory( + [ + ["200", s_check_suite], + ["201", s_check_suite], + ], + undefined, + ) + + // checksCreateSuite + router.post( + `/repos/:owner/:repo/check-suites`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksCreateSuiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + checksCreateSuiteRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksCreateSuite(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksCreateSuiteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksSetSuitesPreferencesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const checksSetSuitesPreferencesRequestBodySchema = z.object({ + auto_trigger_checks: z + .array( + z.object({ + app_id: z.coerce.number(), + setting: PermissiveBoolean.default(true), + }), + ) + .optional(), + }) + + const checksSetSuitesPreferencesResponseBodyValidator = + responseValidationFactory([["200", s_check_suite_preference]], undefined) + + // checksSetSuitesPreferences + router.patch( + `/repos/:owner/:repo/check-suites/preferences`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksSetSuitesPreferencesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + checksSetSuitesPreferencesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksSetSuitesPreferences(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + checksSetSuitesPreferencesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksGetSuiteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + check_suite_id: z.coerce.number(), + }) + + const checksGetSuiteResponseBodyValidator = responseValidationFactory( + [["200", s_check_suite]], + undefined, + ) + + // checksGetSuite + router.get( + `/repos/:owner/:repo/check-suites/:check_suite_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksGetSuiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksGetSuite(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksGetSuiteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksListForSuiteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + check_suite_id: z.coerce.number(), + }) + + const checksListForSuiteQuerySchema = z.object({ + check_name: z.string().optional(), + status: z.enum(["queued", "in_progress", "completed"]).optional(), + filter: z.enum(["latest", "all"]).optional().default("latest"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const checksListForSuiteResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + check_runs: z.array(s_check_run), + }), + ], + ], + undefined, + ) + + // checksListForSuite + router.get( + `/repos/:owner/:repo/check-suites/:check_suite_id/check-runs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksListForSuiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + checksListForSuiteQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + check_runs: t_check_run[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksListForSuite(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksListForSuiteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksRerequestSuiteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + check_suite_id: z.coerce.number(), + }) + + const checksRerequestSuiteResponseBodyValidator = responseValidationFactory( + [["201", s_empty_object]], + undefined, + ) + + // checksRerequestSuite + router.post( + `/repos/:owner/:repo/check-suites/:check_suite_id/rerequest`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksRerequestSuiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksRerequestSuite(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksRerequestSuiteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningListAlertsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codeScanningListAlertsForRepoQuerySchema = z.object({ + tool_name: s_code_scanning_analysis_tool_name.optional(), + tool_guid: s_code_scanning_analysis_tool_guid.optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + ref: s_code_scanning_ref.optional(), + pr: z.coerce.number().optional(), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + before: z.string().optional(), + after: z.string().optional(), + sort: z.enum(["created", "updated"]).optional().default("created"), + state: s_code_scanning_alert_state_query.optional(), + severity: s_code_scanning_alert_severity.optional(), + }) + + const codeScanningListAlertsForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_scanning_alert_items)], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningListAlertsForRepo + router.get( + `/repos/:owner/:repo/code-scanning/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningListAlertsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeScanningListAlertsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningListAlertsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningListAlertsForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningGetAlertParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const codeScanningGetAlertResponseBodyValidator = responseValidationFactory( + [ + ["200", s_code_scanning_alert], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningGetAlert + router.get( + `/repos/:owner/:repo/code-scanning/alerts/:alert_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningGetAlertParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningGetAlert(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codeScanningGetAlertResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningUpdateAlertParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const codeScanningUpdateAlertRequestBodySchema = z.object({ + state: s_code_scanning_alert_set_state, + dismissed_reason: s_code_scanning_alert_dismissed_reason.optional(), + dismissed_comment: s_code_scanning_alert_dismissed_comment.optional(), + create_request: s_code_scanning_alert_create_request.optional(), + }) + + const codeScanningUpdateAlertResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_scanning_alert], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningUpdateAlert + router.patch( + `/repos/:owner/:repo/code-scanning/alerts/:alert_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningUpdateAlertParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeScanningUpdateAlertRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningUpdateAlert(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codeScanningUpdateAlertResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningGetAutofixParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const codeScanningGetAutofixResponseBodyValidator = responseValidationFactory( + [ + ["200", s_code_scanning_autofix], + ["400", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningGetAutofix + router.get( + `/repos/:owner/:repo/code-scanning/alerts/:alert_number/autofix`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningGetAutofixParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningGetAutofix(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codeScanningGetAutofixResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningCreateAutofixParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const codeScanningCreateAutofixResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_scanning_autofix], + ["202", s_code_scanning_autofix], + ["400", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningCreateAutofix + router.post( + `/repos/:owner/:repo/code-scanning/alerts/:alert_number/autofix`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningCreateAutofixParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with202() { + return new ExpressRuntimeResponse(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningCreateAutofix(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codeScanningCreateAutofixResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningCommitAutofixParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const codeScanningCommitAutofixRequestBodySchema = + s_code_scanning_autofix_commits.optional() + + const codeScanningCommitAutofixResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_code_scanning_autofix_commits_response], + ["400", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningCommitAutofix + router.post( + `/repos/:owner/:repo/code-scanning/alerts/:alert_number/autofix/commits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningCommitAutofixParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeScanningCommitAutofixRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse( + 201, + ) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningCommitAutofix(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codeScanningCommitAutofixResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningListAlertInstancesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const codeScanningListAlertInstancesQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + ref: s_code_scanning_ref.optional(), + pr: z.coerce.number().optional(), + }) + + const codeScanningListAlertInstancesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_scanning_alert_instance)], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningListAlertInstances + router.get( + `/repos/:owner/:repo/code-scanning/alerts/:alert_number/instances`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningListAlertInstancesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeScanningListAlertInstancesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningListAlertInstances(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningListAlertInstancesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningListRecentAnalysesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codeScanningListRecentAnalysesQuerySchema = z.object({ + tool_name: s_code_scanning_analysis_tool_name.optional(), + tool_guid: s_code_scanning_analysis_tool_guid.optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + pr: z.coerce.number().optional(), + ref: s_code_scanning_ref.optional(), + sarif_id: s_code_scanning_analysis_sarif_id.optional(), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + sort: z.enum(["created"]).optional().default("created"), + }) + + const codeScanningListRecentAnalysesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_scanning_analysis)], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningListRecentAnalyses + router.get( + `/repos/:owner/:repo/code-scanning/analyses`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningListRecentAnalysesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeScanningListRecentAnalysesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningListRecentAnalyses(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningListRecentAnalysesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningGetAnalysisParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + analysis_id: z.coerce.number(), + }) + + const codeScanningGetAnalysisResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.record(z.unknown())], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningGetAnalysis + router.get( + `/repos/:owner/:repo/code-scanning/analyses/:analysis_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningGetAnalysisParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningGetAnalysis(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codeScanningGetAnalysisResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningDeleteAnalysisParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + analysis_id: z.coerce.number(), + }) + + const codeScanningDeleteAnalysisQuerySchema = z.object({ + confirm_delete: z.string().nullable().optional(), + }) + + const codeScanningDeleteAnalysisResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_scanning_analysis_deletion], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningDeleteAnalysis + router.delete( + `/repos/:owner/:repo/code-scanning/analyses/:analysis_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningDeleteAnalysisParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codeScanningDeleteAnalysisQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningDeleteAnalysis(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningDeleteAnalysisResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningListCodeqlDatabasesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codeScanningListCodeqlDatabasesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_scanning_codeql_database)], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningListCodeqlDatabases + router.get( + `/repos/:owner/:repo/code-scanning/codeql/databases`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningListCodeqlDatabasesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_code_scanning_codeql_database[] + >(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningListCodeqlDatabases(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningListCodeqlDatabasesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningGetCodeqlDatabaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + language: z.string(), + }) + + const codeScanningGetCodeqlDatabaseResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_scanning_codeql_database], + ["302", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningGetCodeqlDatabase + router.get( + `/repos/:owner/:repo/code-scanning/codeql/databases/:language`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningGetCodeqlDatabaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with302() { + return new ExpressRuntimeResponse(302) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningGetCodeqlDatabase(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningGetCodeqlDatabaseResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningDeleteCodeqlDatabaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + language: z.string(), + }) + + const codeScanningDeleteCodeqlDatabaseResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningDeleteCodeqlDatabase + router.delete( + `/repos/:owner/:repo/code-scanning/codeql/databases/:language`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningDeleteCodeqlDatabaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningDeleteCodeqlDatabase(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningDeleteCodeqlDatabaseResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningCreateVariantAnalysisParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codeScanningCreateVariantAnalysisRequestBodySchema = z.union([ + z.object({}), + z.object({}), + z.object({}), + ]) + + const codeScanningCreateVariantAnalysisResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_code_scanning_variant_analysis], + ["404", s_basic_error], + ["422", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningCreateVariantAnalysis + router.post( + `/repos/:owner/:repo/code-scanning/codeql/variant-analyses`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningCreateVariantAnalysisParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeScanningCreateVariantAnalysisRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse( + 201, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningCreateVariantAnalysis(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningCreateVariantAnalysisResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningGetVariantAnalysisParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + codeql_variant_analysis_id: z.coerce.number(), + }) + + const codeScanningGetVariantAnalysisResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_scanning_variant_analysis], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningGetVariantAnalysis + router.get( + `/repos/:owner/:repo/code-scanning/codeql/variant-analyses/:codeql_variant_analysis_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningGetVariantAnalysisParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningGetVariantAnalysis(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningGetVariantAnalysisResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningGetVariantAnalysisRepoTaskParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + codeql_variant_analysis_id: z.coerce.number(), + repo_owner: z.string(), + repo_name: z.string(), + }) + + const codeScanningGetVariantAnalysisRepoTaskResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_scanning_variant_analysis_repo_task], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningGetVariantAnalysisRepoTask + router.get( + `/repos/:owner/:repo/code-scanning/codeql/variant-analyses/:codeql_variant_analysis_id/repos/:repo_owner/:repo_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningGetVariantAnalysisRepoTaskParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningGetVariantAnalysisRepoTask( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningGetVariantAnalysisRepoTaskResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningGetDefaultSetupParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codeScanningGetDefaultSetupResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_scanning_default_setup], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningGetDefaultSetup + router.get( + `/repos/:owner/:repo/code-scanning/default-setup`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningGetDefaultSetupParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningGetDefaultSetup(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningGetDefaultSetupResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningUpdateDefaultSetupParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codeScanningUpdateDefaultSetupRequestBodySchema = + s_code_scanning_default_setup_update + + const codeScanningUpdateDefaultSetupResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_empty_object], + ["202", s_code_scanning_default_setup_update_response], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningUpdateDefaultSetup + router.patch( + `/repos/:owner/:repo/code-scanning/default-setup`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningUpdateDefaultSetupParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeScanningUpdateDefaultSetupRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with202() { + return new ExpressRuntimeResponse( + 202, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningUpdateDefaultSetup(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeScanningUpdateDefaultSetupResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningUploadSarifParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codeScanningUploadSarifRequestBodySchema = z.object({ + commit_sha: s_code_scanning_analysis_commit_sha, + ref: s_code_scanning_ref_full, + sarif: s_code_scanning_analysis_sarif_file, + checkout_uri: z.string().optional(), + started_at: z.string().datetime({ offset: true }).optional(), + tool_name: z.string().optional(), + validate: PermissiveBoolean.optional(), + }) + + const codeScanningUploadSarifResponseBodyValidator = + responseValidationFactory( + [ + ["202", s_code_scanning_sarifs_receipt], + ["400", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["413", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningUploadSarif + router.post( + `/repos/:owner/:repo/code-scanning/sarifs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningUploadSarifParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codeScanningUploadSarifRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse( + 202, + ) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with413() { + return new ExpressRuntimeResponse(413) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningUploadSarif(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codeScanningUploadSarifResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeScanningGetSarifParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + sarif_id: z.string(), + }) + + const codeScanningGetSarifResponseBodyValidator = responseValidationFactory( + [ + ["200", s_code_scanning_sarifs_status], + ["403", s_basic_error], + ["404", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codeScanningGetSarif + router.get( + `/repos/:owner/:repo/code-scanning/sarifs/:sarif_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeScanningGetSarifParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeScanningGetSarif(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codeScanningGetSarifResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codeSecurityGetConfigurationForRepositoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codeSecurityGetConfigurationForRepositoryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_code_security_configuration_for_repository], + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codeSecurityGetConfigurationForRepository + router.get( + `/repos/:owner/:repo/code-security-configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codeSecurityGetConfigurationForRepositoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codeSecurityGetConfigurationForRepository( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codeSecurityGetConfigurationForRepositoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCodeownersErrorsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCodeownersErrorsQuerySchema = z.object({ + ref: z.string().optional(), + }) + + const reposCodeownersErrorsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_codeowners_errors], + ["404", z.undefined()], + ], + undefined, + ) + + // reposCodeownersErrors + router.get( + `/repos/:owner/:repo/codeowners/errors`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCodeownersErrorsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposCodeownersErrorsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCodeownersErrors(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCodeownersErrorsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListInRepositoryForAuthenticatedUserParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codespacesListInRepositoryForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const codespacesListInRepositoryForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + codespaces: z.array(s_codespace), + }), + ], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesListInRepositoryForAuthenticatedUser + router.get( + `/repos/:owner/:repo/codespaces`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesListInRepositoryForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesListInRepositoryForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + codespaces: t_codespace[] + total_count: number + }>(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListInRepositoryForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesListInRepositoryForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesCreateWithRepoForAuthenticatedUserParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codespacesCreateWithRepoForAuthenticatedUserRequestBodySchema = z + .object({ + ref: z.string().optional(), + location: z.string().optional(), + geo: z + .enum(["EuropeWest", "SoutheastAsia", "UsEast", "UsWest"]) + .optional(), + client_ip: z.string().optional(), + machine: z.string().optional(), + devcontainer_path: z.string().optional(), + multi_repo_permissions_opt_out: PermissiveBoolean.optional(), + working_directory: z.string().optional(), + idle_timeout_minutes: z.coerce.number().optional(), + display_name: z.string().optional(), + retention_period_minutes: z.coerce.number().optional(), + }) + .nullable() + + const codespacesCreateWithRepoForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_codespace], + ["202", s_codespace], + ["400", s_scim_error], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codespacesCreateWithRepoForAuthenticatedUser + router.post( + `/repos/:owner/:repo/codespaces`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesCreateWithRepoForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesCreateWithRepoForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with202() { + return new ExpressRuntimeResponse(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesCreateWithRepoForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesCreateWithRepoForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListDevcontainersInRepositoryForAuthenticatedUserParamSchema = + z.object({ owner: z.string(), repo: z.string() }) + + const codespacesListDevcontainersInRepositoryForAuthenticatedUserQuerySchema = + z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const codespacesListDevcontainersInRepositoryForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + devcontainers: z.array( + z.object({ + path: z.string(), + name: z.string().optional(), + display_name: z.string().optional(), + }), + ), + }), + ], + ["400", s_scim_error], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesListDevcontainersInRepositoryForAuthenticatedUser + router.get( + `/repos/:owner/:repo/codespaces/devcontainers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesListDevcontainersInRepositoryForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesListDevcontainersInRepositoryForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + devcontainers: { + display_name?: string | undefined + name?: string | undefined + path: string + }[] + total_count: number + }>(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListDevcontainersInRepositoryForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesListDevcontainersInRepositoryForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesRepoMachinesForAuthenticatedUserParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codespacesRepoMachinesForAuthenticatedUserQuerySchema = z.object({ + location: z.string().optional(), + client_ip: z.string().optional(), + ref: z.string().optional(), + }) + + const codespacesRepoMachinesForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + machines: z.array(s_codespace_machine), + }), + ], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesRepoMachinesForAuthenticatedUser + router.get( + `/repos/:owner/:repo/codespaces/machines`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesRepoMachinesForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesRepoMachinesForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + machines: t_codespace_machine[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesRepoMachinesForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesRepoMachinesForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesPreFlightWithRepoForAuthenticatedUserParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codespacesPreFlightWithRepoForAuthenticatedUserQuerySchema = z.object({ + ref: z.string().optional(), + client_ip: z.string().optional(), + }) + + const codespacesPreFlightWithRepoForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + billable_owner: s_simple_user.optional(), + defaults: z + .object({ + location: z.string(), + devcontainer_path: z.string().nullable(), + }) + .optional(), + }), + ], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codespacesPreFlightWithRepoForAuthenticatedUser + router.get( + `/repos/:owner/:repo/codespaces/new`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesPreFlightWithRepoForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesPreFlightWithRepoForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + billable_owner?: t_simple_user | undefined + defaults?: + | { + devcontainer_path: string | null + location: string + } + | undefined + }>(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesPreFlightWithRepoForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesPreFlightWithRepoForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesCheckPermissionsForDevcontainerParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codespacesCheckPermissionsForDevcontainerQuerySchema = z.object({ + ref: z.string(), + devcontainer_path: z.string(), + }) + + const codespacesCheckPermissionsForDevcontainerResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_codespaces_permissions_check_for_devcontainer], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codespacesCheckPermissionsForDevcontainer + router.get( + `/repos/:owner/:repo/codespaces/permissions_check`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesCheckPermissionsForDevcontainerParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesCheckPermissionsForDevcontainerQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesCheckPermissionsForDevcontainer( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesCheckPermissionsForDevcontainerResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListRepoSecretsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codespacesListRepoSecretsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const codespacesListRepoSecretsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_repo_codespaces_secret), + }), + ], + ], + undefined, + ) + + // codespacesListRepoSecrets + router.get( + `/repos/:owner/:repo/codespaces/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesListRepoSecretsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + codespacesListRepoSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_repo_codespaces_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListRepoSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codespacesListRepoSecretsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetRepoPublicKeyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const codespacesGetRepoPublicKeyResponseBodyValidator = + responseValidationFactory([["200", s_codespaces_public_key]], undefined) + + // codespacesGetRepoPublicKey + router.get( + `/repos/:owner/:repo/codespaces/secrets/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesGetRepoPublicKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetRepoPublicKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesGetRepoPublicKeyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const codespacesGetRepoSecretResponseBodyValidator = + responseValidationFactory([["200", s_repo_codespaces_secret]], undefined) + + // codespacesGetRepoSecret + router.get( + `/repos/:owner/:repo/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesGetRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(codespacesGetRepoSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesCreateOrUpdateRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const codespacesCreateOrUpdateRepoSecretRequestBodySchema = z.object({ + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ) + .optional(), + key_id: z.string().optional(), + }) + + const codespacesCreateOrUpdateRepoSecretResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["204", z.undefined()], + ], + undefined, + ) + + // codespacesCreateOrUpdateRepoSecret + router.put( + `/repos/:owner/:repo/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesCreateOrUpdateRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesCreateOrUpdateRepoSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesCreateOrUpdateRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesCreateOrUpdateRepoSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesDeleteRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const codespacesDeleteRepoSecretResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // codespacesDeleteRepoSecret + router.delete( + `/repos/:owner/:repo/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesDeleteRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesDeleteRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesDeleteRepoSecretResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListCollaboratorsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListCollaboratorsQuerySchema = z.object({ + affiliation: z.enum(["outside", "direct", "all"]).optional().default("all"), + permission: z + .enum(["pull", "triage", "push", "maintain", "admin"]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListCollaboratorsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_collaborator)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListCollaborators + router.get( + `/repos/:owner/:repo/collaborators`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListCollaboratorsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListCollaboratorsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListCollaborators(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListCollaboratorsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCheckCollaboratorParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + username: z.string(), + }) + + const reposCheckCollaboratorResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // reposCheckCollaborator + router.get( + `/repos/:owner/:repo/collaborators/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCheckCollaboratorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCheckCollaborator(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCheckCollaboratorResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposAddCollaboratorParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + username: z.string(), + }) + + const reposAddCollaboratorRequestBodySchema = z + .object({ permission: z.string().optional().default("push") }) + .optional() + + const reposAddCollaboratorResponseBodyValidator = responseValidationFactory( + [ + ["201", s_repository_invitation], + ["204", z.undefined()], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposAddCollaborator + router.put( + `/repos/:owner/:repo/collaborators/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposAddCollaboratorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposAddCollaboratorRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposAddCollaborator(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposAddCollaboratorResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRemoveCollaboratorParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + username: z.string(), + }) + + const reposRemoveCollaboratorResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposRemoveCollaborator + router.delete( + `/repos/:owner/:repo/collaborators/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRemoveCollaboratorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRemoveCollaborator(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposRemoveCollaboratorResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCollaboratorPermissionLevelParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + username: z.string(), + }) + + const reposGetCollaboratorPermissionLevelResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_repository_collaborator_permission], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetCollaboratorPermissionLevel + router.get( + `/repos/:owner/:repo/collaborators/:username/permission`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCollaboratorPermissionLevelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCollaboratorPermissionLevel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetCollaboratorPermissionLevelResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListCommitCommentsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListCommitCommentsForRepoQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListCommitCommentsForRepoResponseBodyValidator = + responseValidationFactory([["200", z.array(s_commit_comment)]], undefined) + + // reposListCommitCommentsForRepo + router.get( + `/repos/:owner/:repo/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListCommitCommentsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListCommitCommentsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListCommitCommentsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListCommitCommentsForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCommitCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reposGetCommitCommentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_commit_comment], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetCommitComment + router.get( + `/repos/:owner/:repo/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCommitCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCommitComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetCommitCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateCommitCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reposUpdateCommitCommentRequestBodySchema = z.object({ + body: z.string(), + }) + + const reposUpdateCommitCommentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_commit_comment], + ["404", s_basic_error], + ], + undefined, + ) + + // reposUpdateCommitComment + router.patch( + `/repos/:owner/:repo/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateCommitCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateCommitCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateCommitComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUpdateCommitCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteCommitCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reposDeleteCommitCommentResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposDeleteCommitComment + router.delete( + `/repos/:owner/:repo/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteCommitCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteCommitComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteCommitCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForCommitCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reactionsListForCommitCommentQuerySchema = z.object({ + content: z + .enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForCommitCommentResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_reaction)], + ["404", s_basic_error], + ], + undefined, + ) + + // reactionsListForCommitComment + router.get( + `/repos/:owner/:repo/comments/:comment_id/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForCommitCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForCommitCommentQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForCommitComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsListForCommitCommentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForCommitCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reactionsCreateForCommitCommentRequestBodySchema = z.object({ + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + }) + + const reactionsCreateForCommitCommentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_reaction], + ["201", s_reaction], + ["422", s_validation_error], + ], + undefined, + ) + + // reactionsCreateForCommitComment + router.post( + `/repos/:owner/:repo/comments/:comment_id/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForCommitCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForCommitCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForCommitComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsCreateForCommitCommentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsDeleteForCommitCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + reaction_id: z.coerce.number(), + }) + + const reactionsDeleteForCommitCommentResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reactionsDeleteForCommitComment + router.delete( + `/repos/:owner/:repo/comments/:comment_id/reactions/:reaction_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsDeleteForCommitCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsDeleteForCommitComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsDeleteForCommitCommentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListCommitsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListCommitsQuerySchema = z.object({ + sha: z.string().optional(), + path: z.string().optional(), + author: z.string().optional(), + committer: z.string().optional(), + since: z.string().datetime({ offset: true }).optional(), + until: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListCommitsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_commit)], + ["400", s_scim_error], + ["404", s_basic_error], + ["409", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposListCommits + router.get( + `/repos/:owner/:repo/commits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListCommitsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListCommitsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListCommits(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListCommitsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListBranchesForHeadCommitParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + commit_sha: z.string(), + }) + + const reposListBranchesForHeadCommitResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_branch_short)], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposListBranchesForHeadCommit + router.get( + `/repos/:owner/:repo/commits/:commit_sha/branches-where-head`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListBranchesForHeadCommitParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListBranchesForHeadCommit(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListBranchesForHeadCommitResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListCommentsForCommitParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + commit_sha: z.string(), + }) + + const reposListCommentsForCommitQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListCommentsForCommitResponseBodyValidator = + responseValidationFactory([["200", z.array(s_commit_comment)]], undefined) + + // reposListCommentsForCommit + router.get( + `/repos/:owner/:repo/commits/:commit_sha/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListCommentsForCommitParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListCommentsForCommitQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListCommentsForCommit(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListCommentsForCommitResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateCommitCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + commit_sha: z.string(), + }) + + const reposCreateCommitCommentRequestBodySchema = z.object({ + body: z.string(), + path: z.string().optional(), + position: z.coerce.number().optional(), + line: z.coerce.number().optional(), + }) + + const reposCreateCommitCommentResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_commit_comment], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateCommitComment + router.post( + `/repos/:owner/:repo/commits/:commit_sha/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateCommitCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateCommitCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateCommitComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateCommitCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListPullRequestsAssociatedWithCommitParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + commit_sha: z.string(), + }) + + const reposListPullRequestsAssociatedWithCommitQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListPullRequestsAssociatedWithCommitResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_pull_request_simple)], + ["409", s_basic_error], + ], + undefined, + ) + + // reposListPullRequestsAssociatedWithCommit + router.get( + `/repos/:owner/:repo/commits/:commit_sha/pulls`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListPullRequestsAssociatedWithCommitParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListPullRequestsAssociatedWithCommitQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListPullRequestsAssociatedWithCommit( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListPullRequestsAssociatedWithCommitResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCommitParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const reposGetCommitQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const reposGetCommitResponseBodyValidator = responseValidationFactory( + [ + ["200", s_commit], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // reposGetCommit + router.get( + `/repos/:owner/:repo/commits/:ref`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCommitParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetCommitQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCommit(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetCommitResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksListForRefParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const checksListForRefQuerySchema = z.object({ + check_name: z.string().optional(), + status: z.enum(["queued", "in_progress", "completed"]).optional(), + filter: z.enum(["latest", "all"]).optional().default("latest"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + app_id: z.coerce.number().optional(), + }) + + const checksListForRefResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + check_runs: z.array(s_check_run), + }), + ], + ], + undefined, + ) + + // checksListForRef + router.get( + `/repos/:owner/:repo/commits/:ref/check-runs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksListForRefParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + checksListForRefQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + check_runs: t_check_run[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksListForRef(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksListForRefResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const checksListSuitesForRefParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const checksListSuitesForRefQuerySchema = z.object({ + app_id: z.coerce.number().optional(), + check_name: z.string().optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const checksListSuitesForRefResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + check_suites: z.array(s_check_suite), + }), + ], + ], + undefined, + ) + + // checksListSuitesForRef + router.get( + `/repos/:owner/:repo/commits/:ref/check-suites`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + checksListSuitesForRefParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + checksListSuitesForRefQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + check_suites: t_check_suite[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .checksListSuitesForRef(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(checksListSuitesForRefResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCombinedStatusForRefParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const reposGetCombinedStatusForRefQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposGetCombinedStatusForRefResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_combined_commit_status], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetCombinedStatusForRef + router.get( + `/repos/:owner/:repo/commits/:ref/status`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCombinedStatusForRefParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetCombinedStatusForRefQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCombinedStatusForRef(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetCombinedStatusForRefResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListCommitStatusesForRefParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const reposListCommitStatusesForRefQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListCommitStatusesForRefResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_status)], + ["301", s_basic_error], + ], + undefined, + ) + + // reposListCommitStatusesForRef + router.get( + `/repos/:owner/:repo/commits/:ref/statuses`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListCommitStatusesForRefParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListCommitStatusesForRefQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListCommitStatusesForRef(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListCommitStatusesForRefResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCommunityProfileMetricsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetCommunityProfileMetricsResponseBodyValidator = + responseValidationFactory([["200", s_community_profile]], undefined) + + // reposGetCommunityProfileMetrics + router.get( + `/repos/:owner/:repo/community/profile`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCommunityProfileMetricsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCommunityProfileMetrics(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetCommunityProfileMetricsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCompareCommitsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + basehead: z.string(), + }) + + const reposCompareCommitsQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const reposCompareCommitsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_commit_comparison], + ["404", s_basic_error], + ["500", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // reposCompareCommits + router.get( + `/repos/:owner/:repo/compare/:basehead`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCompareCommitsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposCompareCommitsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCompareCommits(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCompareCommitsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetContentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + path: z.string(), + }) + + const reposGetContentQuerySchema = z.object({ ref: z.string().optional() }) + + const reposGetContentResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.union([ + s_content_directory, + s_content_file, + s_content_symlink, + s_content_submodule, + ]), + ], + ["302", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetContent + router.get( + `/repos/:owner/:repo/contents/:path`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetContentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetContentQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + | t_content_directory + | t_content_file + | t_content_symlink + | t_content_submodule + >(200) + }, + with302() { + return new ExpressRuntimeResponse(302) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetContent(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetContentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateOrUpdateFileContentsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + path: z.string(), + }) + + const reposCreateOrUpdateFileContentsRequestBodySchema = z.object({ + message: z.string(), + content: z.string(), + sha: z.string().optional(), + branch: z.string().optional(), + committer: z + .object({ + name: z.string(), + email: z.string(), + date: z.string().optional(), + }) + .optional(), + author: z + .object({ + name: z.string(), + email: z.string(), + date: z.string().optional(), + }) + .optional(), + }) + + const reposCreateOrUpdateFileContentsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_file_commit], + ["201", s_file_commit], + ["404", s_basic_error], + ["409", z.union([s_basic_error, s_repository_rule_violation_error])], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateOrUpdateFileContents + router.put( + `/repos/:owner/:repo/contents/:path`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateOrUpdateFileContentsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateOrUpdateFileContentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse< + t_basic_error | t_repository_rule_violation_error + >(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateOrUpdateFileContents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreateOrUpdateFileContentsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteFileParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + path: z.string(), + }) + + const reposDeleteFileRequestBodySchema = z.object({ + message: z.string(), + sha: z.string(), + branch: z.string().optional(), + committer: z + .object({ name: z.string().optional(), email: z.string().optional() }) + .optional(), + author: z + .object({ name: z.string().optional(), email: z.string().optional() }) + .optional(), + }) + + const reposDeleteFileResponseBodyValidator = responseValidationFactory( + [ + ["200", s_file_commit], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // reposDeleteFile + router.delete( + `/repos/:owner/:repo/contents/:path`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteFileParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposDeleteFileRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteFile(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteFileResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListContributorsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListContributorsQuerySchema = z.object({ + anon: z.string().optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListContributorsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_contributor)], + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListContributors + router.get( + `/repos/:owner/:repo/contributors`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListContributorsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListContributorsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListContributors(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListContributorsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotListAlertsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const dependabotListAlertsForRepoQuerySchema = z.object({ + state: z.string().optional(), + severity: z.string().optional(), + ecosystem: z.string().optional(), + package: z.string().optional(), + manifest: z.string().optional(), + epss_percentage: z.string().optional(), + scope: z.enum(["development", "runtime"]).optional(), + sort: z + .enum(["created", "updated", "epss_percentage"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + first: z.coerce.number().min(1).max(100).optional().default(30), + last: z.coerce.number().min(1).max(100).optional(), + }) + + const dependabotListAlertsForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_dependabot_alert)], + ["304", z.undefined()], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // dependabotListAlertsForRepo + router.get( + `/repos/:owner/:repo/dependabot/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotListAlertsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + dependabotListAlertsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotListAlertsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotListAlertsForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotGetAlertParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const dependabotGetAlertResponseBodyValidator = responseValidationFactory( + [ + ["200", s_dependabot_alert], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // dependabotGetAlert + router.get( + `/repos/:owner/:repo/dependabot/alerts/:alert_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotGetAlertParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotGetAlert(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependabotGetAlertResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotUpdateAlertParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const dependabotUpdateAlertRequestBodySchema = z.object({ + state: z.enum(["dismissed", "open"]), + dismissed_reason: z + .enum([ + "fix_started", + "inaccurate", + "no_bandwidth", + "not_used", + "tolerable_risk", + ]) + .optional(), + dismissed_comment: z.string().max(280).optional(), + }) + + const dependabotUpdateAlertResponseBodyValidator = responseValidationFactory( + [ + ["200", s_dependabot_alert], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // dependabotUpdateAlert + router.patch( + `/repos/:owner/:repo/dependabot/alerts/:alert_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotUpdateAlertParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + dependabotUpdateAlertRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotUpdateAlert(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependabotUpdateAlertResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotListRepoSecretsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const dependabotListRepoSecretsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const dependabotListRepoSecretsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_dependabot_secret), + }), + ], + ], + undefined, + ) + + // dependabotListRepoSecrets + router.get( + `/repos/:owner/:repo/dependabot/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotListRepoSecretsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + dependabotListRepoSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_dependabot_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotListRepoSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependabotListRepoSecretsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotGetRepoPublicKeyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const dependabotGetRepoPublicKeyResponseBodyValidator = + responseValidationFactory([["200", s_dependabot_public_key]], undefined) + + // dependabotGetRepoPublicKey + router.get( + `/repos/:owner/:repo/dependabot/secrets/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotGetRepoPublicKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotGetRepoPublicKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotGetRepoPublicKeyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotGetRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const dependabotGetRepoSecretResponseBodyValidator = + responseValidationFactory([["200", s_dependabot_secret]], undefined) + + // dependabotGetRepoSecret + router.get( + `/repos/:owner/:repo/dependabot/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotGetRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotGetRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependabotGetRepoSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotCreateOrUpdateRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const dependabotCreateOrUpdateRepoSecretRequestBodySchema = z.object({ + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ) + .optional(), + key_id: z.string().optional(), + }) + + const dependabotCreateOrUpdateRepoSecretResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["204", z.undefined()], + ], + undefined, + ) + + // dependabotCreateOrUpdateRepoSecret + router.put( + `/repos/:owner/:repo/dependabot/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotCreateOrUpdateRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + dependabotCreateOrUpdateRepoSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotCreateOrUpdateRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotCreateOrUpdateRepoSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependabotDeleteRepoSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + secret_name: z.string(), + }) + + const dependabotDeleteRepoSecretResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // dependabotDeleteRepoSecret + router.delete( + `/repos/:owner/:repo/dependabot/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependabotDeleteRepoSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependabotDeleteRepoSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependabotDeleteRepoSecretResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependencyGraphDiffRangeParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + basehead: z.string(), + }) + + const dependencyGraphDiffRangeQuerySchema = z.object({ + name: z.string().optional(), + }) + + const dependencyGraphDiffRangeResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_dependency_graph_diff], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // dependencyGraphDiffRange + router.get( + `/repos/:owner/:repo/dependency-graph/compare/:basehead`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependencyGraphDiffRangeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + dependencyGraphDiffRangeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependencyGraphDiffRange(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependencyGraphDiffRangeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependencyGraphExportSbomParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const dependencyGraphExportSbomResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_dependency_graph_spdx_sbom], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // dependencyGraphExportSbom + router.get( + `/repos/:owner/:repo/dependency-graph/sbom`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependencyGraphExportSbomParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependencyGraphExportSbom(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(dependencyGraphExportSbomResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const dependencyGraphCreateRepositorySnapshotParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const dependencyGraphCreateRepositorySnapshotRequestBodySchema = s_snapshot + + const dependencyGraphCreateRepositorySnapshotResponseBodyValidator = + responseValidationFactory( + [ + [ + "201", + z.object({ + id: z.coerce.number(), + created_at: z.string(), + result: z.string(), + message: z.string(), + }), + ], + ], + undefined, + ) + + // dependencyGraphCreateRepositorySnapshot + router.post( + `/repos/:owner/:repo/dependency-graph/snapshots`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + dependencyGraphCreateRepositorySnapshotParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + dependencyGraphCreateRepositorySnapshotRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse<{ + created_at: string + id: number + message: string + result: string + }>(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .dependencyGraphCreateRepositorySnapshot( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + dependencyGraphCreateRepositorySnapshotResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListDeploymentsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListDeploymentsQuerySchema = z.object({ + sha: z.string().optional().default("none"), + ref: z.string().optional().default("none"), + task: z.string().optional().default("none"), + environment: z.string().nullable().optional().default("none"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListDeploymentsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_deployment)]], + undefined, + ) + + // reposListDeployments + router.get( + `/repos/:owner/:repo/deployments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListDeploymentsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListDeploymentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListDeployments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListDeploymentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateDeploymentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateDeploymentRequestBodySchema = z.object({ + ref: z.string(), + task: z.string().optional().default("deploy"), + auto_merge: PermissiveBoolean.optional().default(true), + required_contexts: z.array(z.string()).optional(), + payload: z + .union([z.record(z.unknown()), z.string().default("")]) + .optional(), + environment: z.string().optional().default("production"), + description: z.string().nullable().optional().default(""), + transient_environment: PermissiveBoolean.optional().default(false), + production_environment: PermissiveBoolean.optional(), + }) + + const reposCreateDeploymentResponseBodyValidator = responseValidationFactory( + [ + ["201", s_deployment], + ["202", z.object({ message: z.string().optional() })], + ["409", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateDeployment + router.post( + `/repos/:owner/:repo/deployments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateDeploymentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateDeploymentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with202() { + return new ExpressRuntimeResponse<{ + message?: string | undefined + }>(202) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateDeployment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateDeploymentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetDeploymentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + deployment_id: z.coerce.number(), + }) + + const reposGetDeploymentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_deployment], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetDeployment + router.get( + `/repos/:owner/:repo/deployments/:deployment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetDeploymentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetDeployment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetDeploymentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteDeploymentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + deployment_id: z.coerce.number(), + }) + + const reposDeleteDeploymentResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // reposDeleteDeployment + router.delete( + `/repos/:owner/:repo/deployments/:deployment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteDeploymentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteDeployment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteDeploymentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListDeploymentStatusesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + deployment_id: z.coerce.number(), + }) + + const reposListDeploymentStatusesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListDeploymentStatusesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_deployment_status)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListDeploymentStatuses + router.get( + `/repos/:owner/:repo/deployments/:deployment_id/statuses`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListDeploymentStatusesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListDeploymentStatusesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListDeploymentStatuses(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListDeploymentStatusesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateDeploymentStatusParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + deployment_id: z.coerce.number(), + }) + + const reposCreateDeploymentStatusRequestBodySchema = z.object({ + state: z.enum([ + "error", + "failure", + "inactive", + "in_progress", + "queued", + "pending", + "success", + ]), + target_url: z.string().optional().default(""), + log_url: z.string().optional().default(""), + description: z.string().optional().default(""), + environment: z.string().optional(), + environment_url: z.string().optional().default(""), + auto_inactive: PermissiveBoolean.optional(), + }) + + const reposCreateDeploymentStatusResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_deployment_status], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateDeploymentStatus + router.post( + `/repos/:owner/:repo/deployments/:deployment_id/statuses`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateDeploymentStatusParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateDeploymentStatusRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateDeploymentStatus(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreateDeploymentStatusResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetDeploymentStatusParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + deployment_id: z.coerce.number(), + status_id: z.coerce.number(), + }) + + const reposGetDeploymentStatusResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_deployment_status], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetDeploymentStatus + router.get( + `/repos/:owner/:repo/deployments/:deployment_id/statuses/:status_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetDeploymentStatusParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetDeploymentStatus(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetDeploymentStatusResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateDispatchEventParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateDispatchEventRequestBodySchema = z.object({ + event_type: z.string().min(1).max(100), + client_payload: z.record(z.unknown()).optional(), + }) + + const reposCreateDispatchEventResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateDispatchEvent + router.post( + `/repos/:owner/:repo/dispatches`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateDispatchEventParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateDispatchEventRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateDispatchEvent(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateDispatchEventResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetAllEnvironmentsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetAllEnvironmentsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposGetAllEnvironmentsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number().optional(), + environments: z.array(s_environment).optional(), + }), + ], + ], + undefined, + ) + + // reposGetAllEnvironments + router.get( + `/repos/:owner/:repo/environments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetAllEnvironmentsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetAllEnvironmentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + environments?: t_environment[] | undefined + total_count?: number | undefined + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetAllEnvironments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetAllEnvironmentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetEnvironmentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const reposGetEnvironmentResponseBodyValidator = responseValidationFactory( + [["200", s_environment]], + undefined, + ) + + // reposGetEnvironment + router.get( + `/repos/:owner/:repo/environments/:environment_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetEnvironmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetEnvironment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetEnvironmentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateOrUpdateEnvironmentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const reposCreateOrUpdateEnvironmentRequestBodySchema = z + .object({ + wait_timer: s_wait_timer.optional(), + prevent_self_review: s_prevent_self_review.optional(), + reviewers: z + .array( + z.object({ + type: s_deployment_reviewer_type.optional(), + id: z.coerce.number().optional(), + }), + ) + .nullable() + .optional(), + deployment_branch_policy: s_deployment_branch_policy_settings.optional(), + }) + .nullable() + .optional() + + const reposCreateOrUpdateEnvironmentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_environment], + ["422", s_basic_error], + ], + undefined, + ) + + // reposCreateOrUpdateEnvironment + router.put( + `/repos/:owner/:repo/environments/:environment_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateOrUpdateEnvironmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateOrUpdateEnvironmentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateOrUpdateEnvironment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreateOrUpdateEnvironmentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteAnEnvironmentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const reposDeleteAnEnvironmentResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposDeleteAnEnvironment + router.delete( + `/repos/:owner/:repo/environments/:environment_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteAnEnvironmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteAnEnvironment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteAnEnvironmentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListDeploymentBranchPoliciesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const reposListDeploymentBranchPoliciesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListDeploymentBranchPoliciesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + branch_policies: z.array(s_deployment_branch_policy), + }), + ], + ], + undefined, + ) + + // reposListDeploymentBranchPolicies + router.get( + `/repos/:owner/:repo/environments/:environment_name/deployment-branch-policies`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListDeploymentBranchPoliciesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListDeploymentBranchPoliciesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + branch_policies: t_deployment_branch_policy[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListDeploymentBranchPolicies(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListDeploymentBranchPoliciesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateDeploymentBranchPolicyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const reposCreateDeploymentBranchPolicyRequestBodySchema = + s_deployment_branch_policy_name_pattern_with_type + + const reposCreateDeploymentBranchPolicyResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_deployment_branch_policy], + ["303", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // reposCreateDeploymentBranchPolicy + router.post( + `/repos/:owner/:repo/environments/:environment_name/deployment-branch-policies`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateDeploymentBranchPolicyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateDeploymentBranchPolicyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with303() { + return new ExpressRuntimeResponse(303) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateDeploymentBranchPolicy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreateDeploymentBranchPolicyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetDeploymentBranchPolicyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + branch_policy_id: z.coerce.number(), + }) + + const reposGetDeploymentBranchPolicyResponseBodyValidator = + responseValidationFactory([["200", s_deployment_branch_policy]], undefined) + + // reposGetDeploymentBranchPolicy + router.get( + `/repos/:owner/:repo/environments/:environment_name/deployment-branch-policies/:branch_policy_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetDeploymentBranchPolicyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetDeploymentBranchPolicy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetDeploymentBranchPolicyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateDeploymentBranchPolicyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + branch_policy_id: z.coerce.number(), + }) + + const reposUpdateDeploymentBranchPolicyRequestBodySchema = + s_deployment_branch_policy_name_pattern + + const reposUpdateDeploymentBranchPolicyResponseBodyValidator = + responseValidationFactory([["200", s_deployment_branch_policy]], undefined) + + // reposUpdateDeploymentBranchPolicy + router.put( + `/repos/:owner/:repo/environments/:environment_name/deployment-branch-policies/:branch_policy_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateDeploymentBranchPolicyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateDeploymentBranchPolicyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateDeploymentBranchPolicy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposUpdateDeploymentBranchPolicyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteDeploymentBranchPolicyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + branch_policy_id: z.coerce.number(), + }) + + const reposDeleteDeploymentBranchPolicyResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposDeleteDeploymentBranchPolicy + router.delete( + `/repos/:owner/:repo/environments/:environment_name/deployment-branch-policies/:branch_policy_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteDeploymentBranchPolicyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteDeploymentBranchPolicy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDeleteDeploymentBranchPolicyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetAllDeploymentProtectionRulesParamSchema = z.object({ + environment_name: z.string(), + repo: z.string(), + owner: z.string(), + }) + + const reposGetAllDeploymentProtectionRulesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number().optional(), + custom_deployment_protection_rules: z + .array(s_deployment_protection_rule) + .optional(), + }), + ], + ], + undefined, + ) + + // reposGetAllDeploymentProtectionRules + router.get( + `/repos/:owner/:repo/environments/:environment_name/deployment_protection_rules`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetAllDeploymentProtectionRulesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + custom_deployment_protection_rules?: + | t_deployment_protection_rule[] + | undefined + total_count?: number | undefined + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetAllDeploymentProtectionRules( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetAllDeploymentProtectionRulesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateDeploymentProtectionRuleParamSchema = z.object({ + environment_name: z.string(), + repo: z.string(), + owner: z.string(), + }) + + const reposCreateDeploymentProtectionRuleRequestBodySchema = z.object({ + integration_id: z.coerce.number().optional(), + }) + + const reposCreateDeploymentProtectionRuleResponseBodyValidator = + responseValidationFactory( + [["201", s_deployment_protection_rule]], + undefined, + ) + + // reposCreateDeploymentProtectionRule + router.post( + `/repos/:owner/:repo/environments/:environment_name/deployment_protection_rules`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateDeploymentProtectionRuleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateDeploymentProtectionRuleRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateDeploymentProtectionRule(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreateDeploymentProtectionRuleResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListCustomDeploymentRuleIntegrationsParamSchema = z.object({ + environment_name: z.string(), + repo: z.string(), + owner: z.string(), + }) + + const reposListCustomDeploymentRuleIntegrationsQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const reposListCustomDeploymentRuleIntegrationsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number().optional(), + available_custom_deployment_protection_rule_integrations: z + .array(s_custom_deployment_rule_app) + .optional(), + }), + ], + ], + undefined, + ) + + // reposListCustomDeploymentRuleIntegrations + router.get( + `/repos/:owner/:repo/environments/:environment_name/deployment_protection_rules/apps`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListCustomDeploymentRuleIntegrationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListCustomDeploymentRuleIntegrationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + available_custom_deployment_protection_rule_integrations?: + | t_custom_deployment_rule_app[] + | undefined + total_count?: number | undefined + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListCustomDeploymentRuleIntegrations( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListCustomDeploymentRuleIntegrationsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCustomDeploymentProtectionRuleParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + protection_rule_id: z.coerce.number(), + }) + + const reposGetCustomDeploymentProtectionRuleResponseBodyValidator = + responseValidationFactory( + [["200", s_deployment_protection_rule]], + undefined, + ) + + // reposGetCustomDeploymentProtectionRule + router.get( + `/repos/:owner/:repo/environments/:environment_name/deployment_protection_rules/:protection_rule_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCustomDeploymentProtectionRuleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCustomDeploymentProtectionRule( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetCustomDeploymentProtectionRuleResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDisableDeploymentProtectionRuleParamSchema = z.object({ + environment_name: z.string(), + repo: z.string(), + owner: z.string(), + protection_rule_id: z.coerce.number(), + }) + + const reposDisableDeploymentProtectionRuleResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposDisableDeploymentProtectionRule + router.delete( + `/repos/:owner/:repo/environments/:environment_name/deployment_protection_rules/:protection_rule_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDisableDeploymentProtectionRuleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDisableDeploymentProtectionRule( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDisableDeploymentProtectionRuleResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListEnvironmentSecretsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const actionsListEnvironmentSecretsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const actionsListEnvironmentSecretsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_actions_secret), + }), + ], + ], + undefined, + ) + + // actionsListEnvironmentSecrets + router.get( + `/repos/:owner/:repo/environments/:environment_name/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListEnvironmentSecretsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListEnvironmentSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_actions_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListEnvironmentSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListEnvironmentSecretsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetEnvironmentPublicKeyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const actionsGetEnvironmentPublicKeyResponseBodyValidator = + responseValidationFactory([["200", s_actions_public_key]], undefined) + + // actionsGetEnvironmentPublicKey + router.get( + `/repos/:owner/:repo/environments/:environment_name/secrets/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetEnvironmentPublicKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetEnvironmentPublicKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetEnvironmentPublicKeyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetEnvironmentSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + secret_name: z.string(), + }) + + const actionsGetEnvironmentSecretResponseBodyValidator = + responseValidationFactory([["200", s_actions_secret]], undefined) + + // actionsGetEnvironmentSecret + router.get( + `/repos/:owner/:repo/environments/:environment_name/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetEnvironmentSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetEnvironmentSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetEnvironmentSecretResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateOrUpdateEnvironmentSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + secret_name: z.string(), + }) + + const actionsCreateOrUpdateEnvironmentSecretRequestBodySchema = z.object({ + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ), + key_id: z.string(), + }) + + const actionsCreateOrUpdateEnvironmentSecretResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["204", z.undefined()], + ], + undefined, + ) + + // actionsCreateOrUpdateEnvironmentSecret + router.put( + `/repos/:owner/:repo/environments/:environment_name/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateOrUpdateEnvironmentSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateOrUpdateEnvironmentSecretRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateOrUpdateEnvironmentSecret( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateOrUpdateEnvironmentSecretResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteEnvironmentSecretParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + secret_name: z.string(), + }) + + const actionsDeleteEnvironmentSecretResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteEnvironmentSecret + router.delete( + `/repos/:owner/:repo/environments/:environment_name/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteEnvironmentSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteEnvironmentSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteEnvironmentSecretResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsListEnvironmentVariablesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const actionsListEnvironmentVariablesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(10), + page: z.coerce.number().optional().default(1), + }) + + const actionsListEnvironmentVariablesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + variables: z.array(s_actions_variable), + }), + ], + ], + undefined, + ) + + // actionsListEnvironmentVariables + router.get( + `/repos/:owner/:repo/environments/:environment_name/variables`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsListEnvironmentVariablesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + actionsListEnvironmentVariablesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + total_count: number + variables: t_actions_variable[] + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsListEnvironmentVariables(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsListEnvironmentVariablesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsCreateEnvironmentVariableParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + }) + + const actionsCreateEnvironmentVariableRequestBodySchema = z.object({ + name: z.string(), + value: z.string(), + }) + + const actionsCreateEnvironmentVariableResponseBodyValidator = + responseValidationFactory([["201", s_empty_object]], undefined) + + // actionsCreateEnvironmentVariable + router.post( + `/repos/:owner/:repo/environments/:environment_name/variables`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsCreateEnvironmentVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsCreateEnvironmentVariableRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsCreateEnvironmentVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsCreateEnvironmentVariableResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsGetEnvironmentVariableParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + environment_name: z.string(), + name: z.string(), + }) + + const actionsGetEnvironmentVariableResponseBodyValidator = + responseValidationFactory([["200", s_actions_variable]], undefined) + + // actionsGetEnvironmentVariable + router.get( + `/repos/:owner/:repo/environments/:environment_name/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsGetEnvironmentVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsGetEnvironmentVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsGetEnvironmentVariableResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsUpdateEnvironmentVariableParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + name: z.string(), + environment_name: z.string(), + }) + + const actionsUpdateEnvironmentVariableRequestBodySchema = z.object({ + name: z.string().optional(), + value: z.string().optional(), + }) + + const actionsUpdateEnvironmentVariableResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsUpdateEnvironmentVariable + router.patch( + `/repos/:owner/:repo/environments/:environment_name/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsUpdateEnvironmentVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + actionsUpdateEnvironmentVariableRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsUpdateEnvironmentVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsUpdateEnvironmentVariableResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const actionsDeleteEnvironmentVariableParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + name: z.string(), + environment_name: z.string(), + }) + + const actionsDeleteEnvironmentVariableResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // actionsDeleteEnvironmentVariable + router.delete( + `/repos/:owner/:repo/environments/:environment_name/variables/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + actionsDeleteEnvironmentVariableParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .actionsDeleteEnvironmentVariable(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + actionsDeleteEnvironmentVariableResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListRepoEventsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityListRepoEventsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListRepoEventsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_event)]], + undefined, + ) + + // activityListRepoEvents + router.get( + `/repos/:owner/:repo/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListRepoEventsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListRepoEventsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListRepoEvents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(activityListRepoEventsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListForksParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListForksQuerySchema = z.object({ + sort: z + .enum(["newest", "oldest", "stargazers", "watchers"]) + .optional() + .default("newest"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListForksResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_minimal_repository)], + ["400", s_scim_error], + ], + undefined, + ) + + // reposListForks + router.get( + `/repos/:owner/:repo/forks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListForksParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListForksQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListForks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListForksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateForkParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateForkRequestBodySchema = z + .object({ + organization: z.string().optional(), + name: z.string().optional(), + default_branch_only: PermissiveBoolean.optional(), + }) + .nullable() + .optional() + + const reposCreateForkResponseBodyValidator = responseValidationFactory( + [ + ["202", s_full_repository], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateFork + router.post( + `/repos/:owner/:repo/forks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateForkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateForkRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateFork(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateForkResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitCreateBlobParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const gitCreateBlobRequestBodySchema = z.object({ + content: z.string(), + encoding: z.string().optional().default("utf-8"), + }) + + const gitCreateBlobResponseBodyValidator = responseValidationFactory( + [ + ["201", s_short_blob], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", z.union([s_validation_error, s_repository_rule_violation_error])], + ], + undefined, + ) + + // gitCreateBlob + router.post( + `/repos/:owner/:repo/git/blobs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitCreateBlobParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gitCreateBlobRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse< + t_validation_error | t_repository_rule_violation_error + >(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitCreateBlob(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitCreateBlobResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitGetBlobParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + file_sha: z.string(), + }) + + const gitGetBlobResponseBodyValidator = responseValidationFactory( + [ + ["200", s_blob], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gitGetBlob + router.get( + `/repos/:owner/:repo/git/blobs/:file_sha`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitGetBlobParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitGetBlob(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitGetBlobResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitCreateCommitParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const gitCreateCommitRequestBodySchema = z.object({ + message: z.string(), + tree: z.string(), + parents: z.array(z.string()).optional(), + author: z + .object({ + name: z.string(), + email: z.string(), + date: z.string().datetime({ offset: true }).optional(), + }) + .optional(), + committer: z + .object({ + name: z.string().optional(), + email: z.string().optional(), + date: z.string().datetime({ offset: true }).optional(), + }) + .optional(), + signature: z.string().optional(), + }) + + const gitCreateCommitResponseBodyValidator = responseValidationFactory( + [ + ["201", s_git_commit], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gitCreateCommit + router.post( + `/repos/:owner/:repo/git/commits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitCreateCommitParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gitCreateCommitRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitCreateCommit(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitCreateCommitResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitGetCommitParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + commit_sha: z.string(), + }) + + const gitGetCommitResponseBodyValidator = responseValidationFactory( + [ + ["200", s_git_commit], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // gitGetCommit + router.get( + `/repos/:owner/:repo/git/commits/:commit_sha`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitGetCommitParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitGetCommit(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitGetCommitResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitListMatchingRefsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const gitListMatchingRefsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_git_ref)], + ["409", s_basic_error], + ], + undefined, + ) + + // gitListMatchingRefs + router.get( + `/repos/:owner/:repo/git/matching-refs/:ref`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitListMatchingRefsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitListMatchingRefs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitListMatchingRefsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitGetRefParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const gitGetRefResponseBodyValidator = responseValidationFactory( + [ + ["200", s_git_ref], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // gitGetRef + router.get( + `/repos/:owner/:repo/git/ref/:ref`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitGetRefParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitGetRef(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitGetRefResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitCreateRefParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const gitCreateRefRequestBodySchema = z.object({ + ref: z.string(), + sha: z.string(), + }) + + const gitCreateRefResponseBodyValidator = responseValidationFactory( + [ + ["201", s_git_ref], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gitCreateRef + router.post( + `/repos/:owner/:repo/git/refs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitCreateRefParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gitCreateRefRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitCreateRef(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitCreateRefResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitUpdateRefParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const gitUpdateRefRequestBodySchema = z.object({ + sha: z.string(), + force: PermissiveBoolean.optional().default(false), + }) + + const gitUpdateRefResponseBodyValidator = responseValidationFactory( + [ + ["200", s_git_ref], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gitUpdateRef + router.patch( + `/repos/:owner/:repo/git/refs/:ref`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitUpdateRefParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gitUpdateRefRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitUpdateRef(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitUpdateRefResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitDeleteRefParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const gitDeleteRefResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["409", s_basic_error], + ["422", z.undefined()], + ], + undefined, + ) + + // gitDeleteRef + router.delete( + `/repos/:owner/:repo/git/refs/:ref`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitDeleteRefParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitDeleteRef(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitDeleteRefResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitCreateTagParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const gitCreateTagRequestBodySchema = z.object({ + tag: z.string(), + message: z.string(), + object: z.string(), + type: z.enum(["commit", "tree", "blob"]), + tagger: z + .object({ + name: z.string(), + email: z.string(), + date: z.string().datetime({ offset: true }).optional(), + }) + .optional(), + }) + + const gitCreateTagResponseBodyValidator = responseValidationFactory( + [ + ["201", s_git_tag], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gitCreateTag + router.post( + `/repos/:owner/:repo/git/tags`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitCreateTagParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gitCreateTagRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitCreateTag(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitCreateTagResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitGetTagParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + tag_sha: z.string(), + }) + + const gitGetTagResponseBodyValidator = responseValidationFactory( + [ + ["200", s_git_tag], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // gitGetTag + router.get( + `/repos/:owner/:repo/git/tags/:tag_sha`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitGetTagParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitGetTag(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitGetTagResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitCreateTreeParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const gitCreateTreeRequestBodySchema = z.object({ + tree: z.array( + z.object({ + path: z.string().optional(), + mode: z + .enum(["100644", "100755", "040000", "160000", "120000"]) + .optional(), + type: z.enum(["blob", "tree", "commit"]).optional(), + sha: z.string().nullable().optional(), + content: z.string().optional(), + }), + ), + base_tree: z.string().optional(), + }) + + const gitCreateTreeResponseBodyValidator = responseValidationFactory( + [ + ["201", s_git_tree], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gitCreateTree + router.post( + `/repos/:owner/:repo/git/trees`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitCreateTreeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + gitCreateTreeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitCreateTree(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitCreateTreeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gitGetTreeParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + tree_sha: z.string(), + }) + + const gitGetTreeQuerySchema = z.object({ recursive: z.string().optional() }) + + const gitGetTreeResponseBodyValidator = responseValidationFactory( + [ + ["200", s_git_tree], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // gitGetTree + router.get( + `/repos/:owner/:repo/git/trees/:tree_sha`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gitGetTreeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + gitGetTreeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gitGetTree(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gitGetTreeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListWebhooksParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListWebhooksQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListWebhooksResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_hook)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListWebhooks + router.get( + `/repos/:owner/:repo/hooks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListWebhooksParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListWebhooksQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListWebhooks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListWebhooksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateWebhookParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateWebhookRequestBodySchema = z + .object({ + name: z.string().optional(), + config: z + .object({ + url: s_webhook_config_url.optional(), + content_type: s_webhook_config_content_type.optional(), + secret: s_webhook_config_secret.optional(), + insecure_ssl: s_webhook_config_insecure_ssl.optional(), + }) + .optional(), + events: z.array(z.string()).optional().default(["push"]), + active: PermissiveBoolean.optional().default(true), + }) + .nullable() + .optional() + + const reposCreateWebhookResponseBodyValidator = responseValidationFactory( + [ + ["201", s_hook], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateWebhook + router.post( + `/repos/:owner/:repo/hooks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateWebhookRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetWebhookParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + }) + + const reposGetWebhookResponseBodyValidator = responseValidationFactory( + [ + ["200", s_hook], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetWebhook + router.get( + `/repos/:owner/:repo/hooks/:hook_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateWebhookParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + }) + + const reposUpdateWebhookRequestBodySchema = z.object({ + config: s_webhook_config.optional(), + events: z.array(z.string()).optional().default(["push"]), + add_events: z.array(z.string()).optional(), + remove_events: z.array(z.string()).optional(), + active: PermissiveBoolean.optional().default(true), + }) + + const reposUpdateWebhookResponseBodyValidator = responseValidationFactory( + [ + ["200", s_hook], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposUpdateWebhook + router.patch( + `/repos/:owner/:repo/hooks/:hook_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateWebhookRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUpdateWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteWebhookParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + }) + + const reposDeleteWebhookResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposDeleteWebhook + router.delete( + `/repos/:owner/:repo/hooks/:hook_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetWebhookConfigForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + }) + + const reposGetWebhookConfigForRepoResponseBodyValidator = + responseValidationFactory([["200", s_webhook_config]], undefined) + + // reposGetWebhookConfigForRepo + router.get( + `/repos/:owner/:repo/hooks/:hook_id/config`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetWebhookConfigForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetWebhookConfigForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetWebhookConfigForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateWebhookConfigForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + }) + + const reposUpdateWebhookConfigForRepoRequestBodySchema = z + .object({ + url: s_webhook_config_url.optional(), + content_type: s_webhook_config_content_type.optional(), + secret: s_webhook_config_secret.optional(), + insecure_ssl: s_webhook_config_insecure_ssl.optional(), + }) + .optional() + + const reposUpdateWebhookConfigForRepoResponseBodyValidator = + responseValidationFactory([["200", s_webhook_config]], undefined) + + // reposUpdateWebhookConfigForRepo + router.patch( + `/repos/:owner/:repo/hooks/:hook_id/config`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateWebhookConfigForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateWebhookConfigForRepoRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateWebhookConfigForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposUpdateWebhookConfigForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListWebhookDeliveriesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + }) + + const reposListWebhookDeliveriesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + cursor: z.string().optional(), + }) + + const reposListWebhookDeliveriesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_hook_delivery_item)], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposListWebhookDeliveries + router.get( + `/repos/:owner/:repo/hooks/:hook_id/deliveries`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListWebhookDeliveriesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListWebhookDeliveriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListWebhookDeliveries(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListWebhookDeliveriesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetWebhookDeliveryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + delivery_id: z.coerce.number(), + }) + + const reposGetWebhookDeliveryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_hook_delivery], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposGetWebhookDelivery + router.get( + `/repos/:owner/:repo/hooks/:hook_id/deliveries/:delivery_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetWebhookDeliveryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetWebhookDelivery(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetWebhookDeliveryResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRedeliverWebhookDeliveryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + delivery_id: z.coerce.number(), + }) + + const reposRedeliverWebhookDeliveryResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["400", s_scim_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposRedeliverWebhookDelivery + router.post( + `/repos/:owner/:repo/hooks/:hook_id/deliveries/:delivery_id/attempts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRedeliverWebhookDeliveryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRedeliverWebhookDelivery(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposRedeliverWebhookDeliveryResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposPingWebhookParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + }) + + const reposPingWebhookResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposPingWebhook + router.post( + `/repos/:owner/:repo/hooks/:hook_id/pings`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposPingWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposPingWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposPingWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposTestPushWebhookParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + hook_id: z.coerce.number(), + }) + + const reposTestPushWebhookResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposTestPushWebhook + router.post( + `/repos/:owner/:repo/hooks/:hook_id/tests`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposTestPushWebhookParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposTestPushWebhook(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposTestPushWebhookResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsGetImportStatusParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const migrationsGetImportStatusResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_import], + ["404", s_basic_error], + ["503", s_basic_error], + ], + undefined, + ) + + // migrationsGetImportStatus + router.get( + `/repos/:owner/:repo/import`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsGetImportStatusParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsGetImportStatus(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsGetImportStatusResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsStartImportParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const migrationsStartImportRequestBodySchema = z.object({ + vcs_url: z.string(), + vcs: z.enum(["subversion", "git", "mercurial", "tfvc"]).optional(), + vcs_username: z.string().optional(), + vcs_password: z.string().optional(), + tfvc_project: z.string().optional(), + }) + + const migrationsStartImportResponseBodyValidator = responseValidationFactory( + [ + ["201", s_import], + ["404", s_basic_error], + ["422", s_validation_error], + ["503", s_basic_error], + ], + undefined, + ) + + // migrationsStartImport + router.put( + `/repos/:owner/:repo/import`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsStartImportParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + migrationsStartImportRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsStartImport(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsStartImportResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsUpdateImportParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const migrationsUpdateImportRequestBodySchema = z + .object({ + vcs_username: z.string().optional(), + vcs_password: z.string().optional(), + vcs: z.enum(["subversion", "tfvc", "git", "mercurial"]).optional(), + tfvc_project: z.string().optional(), + }) + .nullable() + .optional() + + const migrationsUpdateImportResponseBodyValidator = responseValidationFactory( + [ + ["200", s_import], + ["503", s_basic_error], + ], + undefined, + ) + + // migrationsUpdateImport + router.patch( + `/repos/:owner/:repo/import`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsUpdateImportParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + migrationsUpdateImportRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with503() { + return new ExpressRuntimeResponse(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsUpdateImport(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsUpdateImportResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsCancelImportParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const migrationsCancelImportResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["503", s_basic_error], + ], + undefined, + ) + + // migrationsCancelImport + router.delete( + `/repos/:owner/:repo/import`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsCancelImportParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with503() { + return new ExpressRuntimeResponse(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsCancelImport(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsCancelImportResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsGetCommitAuthorsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const migrationsGetCommitAuthorsQuerySchema = z.object({ + since: z.coerce.number().optional(), + }) + + const migrationsGetCommitAuthorsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_porter_author)], + ["404", s_basic_error], + ["503", s_basic_error], + ], + undefined, + ) + + // migrationsGetCommitAuthors + router.get( + `/repos/:owner/:repo/import/authors`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsGetCommitAuthorsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + migrationsGetCommitAuthorsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsGetCommitAuthors(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsGetCommitAuthorsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsMapCommitAuthorParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + author_id: z.coerce.number(), + }) + + const migrationsMapCommitAuthorRequestBodySchema = z + .object({ email: z.string().optional(), name: z.string().optional() }) + .optional() + + const migrationsMapCommitAuthorResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_porter_author], + ["404", s_basic_error], + ["422", s_validation_error], + ["503", s_basic_error], + ], + undefined, + ) + + // migrationsMapCommitAuthor + router.patch( + `/repos/:owner/:repo/import/authors/:author_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsMapCommitAuthorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + migrationsMapCommitAuthorRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsMapCommitAuthor(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsMapCommitAuthorResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsGetLargeFilesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const migrationsGetLargeFilesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_porter_large_file)], + ["503", s_basic_error], + ], + undefined, + ) + + // migrationsGetLargeFiles + router.get( + `/repos/:owner/:repo/import/large_files`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsGetLargeFilesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with503() { + return new ExpressRuntimeResponse(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsGetLargeFiles(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(migrationsGetLargeFilesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsSetLfsPreferenceParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const migrationsSetLfsPreferenceRequestBodySchema = z.object({ + use_lfs: z.enum(["opt_in", "opt_out"]), + }) + + const migrationsSetLfsPreferenceResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_import], + ["422", s_validation_error], + ["503", s_basic_error], + ], + undefined, + ) + + // migrationsSetLfsPreference + router.patch( + `/repos/:owner/:repo/import/lfs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsSetLfsPreferenceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + migrationsSetLfsPreferenceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsSetLfsPreference(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsSetLfsPreferenceResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetRepoInstallationParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const appsGetRepoInstallationResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_installation], + ["301", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // appsGetRepoInstallation + router.get( + `/repos/:owner/:repo/installation`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsGetRepoInstallationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetRepoInstallation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsGetRepoInstallationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsGetRestrictionsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const interactionsGetRestrictionsForRepoResponseBodyValidator = + responseValidationFactory( + [["200", z.union([s_interaction_limit_response, z.object({})])]], + undefined, + ) + + // interactionsGetRestrictionsForRepo + router.get( + `/repos/:owner/:repo/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + interactionsGetRestrictionsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_interaction_limit_response | EmptyObject + >(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsGetRestrictionsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsGetRestrictionsForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsSetRestrictionsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const interactionsSetRestrictionsForRepoRequestBodySchema = + s_interaction_limit + + const interactionsSetRestrictionsForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_interaction_limit_response], + ["409", z.undefined()], + ], + undefined, + ) + + // interactionsSetRestrictionsForRepo + router.put( + `/repos/:owner/:repo/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + interactionsSetRestrictionsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + interactionsSetRestrictionsForRepoRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsSetRestrictionsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsSetRestrictionsForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsRemoveRestrictionsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const interactionsRemoveRestrictionsForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["409", z.undefined()], + ], + undefined, + ) + + // interactionsRemoveRestrictionsForRepo + router.delete( + `/repos/:owner/:repo/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + interactionsRemoveRestrictionsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsRemoveRestrictionsForRepo( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsRemoveRestrictionsForRepoResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListInvitationsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListInvitationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListInvitationsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_repository_invitation)]], + undefined, + ) + + // reposListInvitations + router.get( + `/repos/:owner/:repo/invitations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListInvitationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListInvitationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListInvitations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListInvitationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateInvitationParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + invitation_id: z.coerce.number(), + }) + + const reposUpdateInvitationRequestBodySchema = z + .object({ + permissions: z + .enum(["read", "write", "maintain", "triage", "admin"]) + .optional(), + }) + .optional() + + const reposUpdateInvitationResponseBodyValidator = responseValidationFactory( + [["200", s_repository_invitation]], + undefined, + ) + + // reposUpdateInvitation + router.patch( + `/repos/:owner/:repo/invitations/:invitation_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateInvitationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateInvitationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateInvitation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUpdateInvitationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteInvitationParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + invitation_id: z.coerce.number(), + }) + + const reposDeleteInvitationResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // reposDeleteInvitation + router.delete( + `/repos/:owner/:repo/invitations/:invitation_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteInvitationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteInvitation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteInvitationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesListForRepoQuerySchema = z.object({ + milestone: z.string().optional(), + state: z.enum(["open", "closed", "all"]).optional().default("open"), + assignee: z.string().optional(), + type: z.string().optional(), + creator: z.string().optional(), + mentioned: z.string().optional(), + labels: z.string().optional(), + sort: z + .enum(["created", "updated", "comments"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListForRepoResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_issue)], + ["301", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesListForRepo + router.get( + `/repos/:owner/:repo/issues`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListForRepoResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesCreateParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesCreateRequestBodySchema = z.object({ + title: z.union([z.string(), z.coerce.number()]), + body: z.string().optional(), + assignee: z.string().nullable().optional(), + milestone: z.union([z.string(), z.coerce.number()]).nullable().optional(), + labels: z + .array( + z.union([ + z.string(), + z.object({ + id: z.coerce.number().optional(), + name: z.string().optional(), + description: z.string().nullable().optional(), + color: z.string().nullable().optional(), + }), + ]), + ) + .optional(), + assignees: z.array(z.string()).optional(), + type: z.string().nullable().optional(), + }) + + const issuesCreateResponseBodyValidator = responseValidationFactory( + [ + ["201", s_issue], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // issuesCreate + router.post( + `/repos/:owner/:repo/issues`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesCreateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesCreateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesCreate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesCreateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListCommentsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesListCommentsForRepoQuerySchema = z.object({ + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional(), + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListCommentsForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_issue_comment)], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesListCommentsForRepo + router.get( + `/repos/:owner/:repo/issues/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListCommentsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListCommentsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListCommentsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListCommentsForRepoResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesGetCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const issuesGetCommentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_issue_comment], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesGetComment + router.get( + `/repos/:owner/:repo/issues/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesGetCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesGetComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesGetCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesUpdateCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const issuesUpdateCommentRequestBodySchema = z.object({ body: z.string() }) + + const issuesUpdateCommentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_issue_comment], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesUpdateComment + router.patch( + `/repos/:owner/:repo/issues/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesUpdateCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesUpdateCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesUpdateComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesUpdateCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesDeleteCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const issuesDeleteCommentResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // issuesDeleteComment + router.delete( + `/repos/:owner/:repo/issues/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesDeleteCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesDeleteComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesDeleteCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForIssueCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reactionsListForIssueCommentQuerySchema = z.object({ + content: z + .enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForIssueCommentResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_reaction)], + ["404", s_basic_error], + ], + undefined, + ) + + // reactionsListForIssueComment + router.get( + `/repos/:owner/:repo/issues/comments/:comment_id/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForIssueCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForIssueCommentQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForIssueComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsListForIssueCommentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForIssueCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reactionsCreateForIssueCommentRequestBodySchema = z.object({ + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + }) + + const reactionsCreateForIssueCommentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_reaction], + ["201", s_reaction], + ["422", s_validation_error], + ], + undefined, + ) + + // reactionsCreateForIssueComment + router.post( + `/repos/:owner/:repo/issues/comments/:comment_id/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForIssueCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForIssueCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForIssueComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsCreateForIssueCommentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsDeleteForIssueCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + reaction_id: z.coerce.number(), + }) + + const reactionsDeleteForIssueCommentResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reactionsDeleteForIssueComment + router.delete( + `/repos/:owner/:repo/issues/comments/:comment_id/reactions/:reaction_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsDeleteForIssueCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsDeleteForIssueComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsDeleteForIssueCommentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListEventsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesListEventsForRepoQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListEventsForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_issue_event)], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesListEventsForRepo + router.get( + `/repos/:owner/:repo/issues/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListEventsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListEventsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListEventsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListEventsForRepoResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesGetEventParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + event_id: z.coerce.number(), + }) + + const issuesGetEventResponseBodyValidator = responseValidationFactory( + [ + ["200", s_issue_event], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesGetEvent + router.get( + `/repos/:owner/:repo/issues/events/:event_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesGetEventParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesGetEvent(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesGetEventResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesGetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_issue], + ["301", s_basic_error], + ["304", z.undefined()], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesGet + router.get( + `/repos/:owner/:repo/issues/:issue_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesUpdateParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesUpdateRequestBodySchema = z + .object({ + title: z.union([z.string(), z.coerce.number()]).nullable().optional(), + body: z.string().nullable().optional(), + assignee: z.string().nullable().optional(), + state: z.enum(["open", "closed"]).optional(), + state_reason: z + .enum(["completed", "not_planned", "reopened"]) + .nullable() + .optional(), + milestone: z.union([z.string(), z.coerce.number()]).nullable().optional(), + labels: z + .array( + z.union([ + z.string(), + z.object({ + id: z.coerce.number().optional(), + name: z.string().optional(), + description: z.string().nullable().optional(), + color: z.string().nullable().optional(), + }), + ]), + ) + .optional(), + assignees: z.array(z.string()).optional(), + type: z.string().nullable().optional(), + }) + .optional() + + const issuesUpdateResponseBodyValidator = responseValidationFactory( + [ + ["200", s_issue], + ["301", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // issuesUpdate + router.patch( + `/repos/:owner/:repo/issues/:issue_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesAddAssigneesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesAddAssigneesRequestBodySchema = z + .object({ assignees: z.array(z.string()).optional() }) + .optional() + + const issuesAddAssigneesResponseBodyValidator = responseValidationFactory( + [["201", s_issue]], + undefined, + ) + + // issuesAddAssignees + router.post( + `/repos/:owner/:repo/issues/:issue_number/assignees`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesAddAssigneesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesAddAssigneesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesAddAssignees(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesAddAssigneesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesRemoveAssigneesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesRemoveAssigneesRequestBodySchema = z.object({ + assignees: z.array(z.string()).optional(), + }) + + const issuesRemoveAssigneesResponseBodyValidator = responseValidationFactory( + [["200", s_issue]], + undefined, + ) + + // issuesRemoveAssignees + router.delete( + `/repos/:owner/:repo/issues/:issue_number/assignees`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesRemoveAssigneesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesRemoveAssigneesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesRemoveAssignees(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesRemoveAssigneesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesCheckUserCanBeAssignedToIssueParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + assignee: z.string(), + }) + + const issuesCheckUserCanBeAssignedToIssueResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesCheckUserCanBeAssignedToIssue + router.get( + `/repos/:owner/:repo/issues/:issue_number/assignees/:assignee`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesCheckUserCanBeAssignedToIssueParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesCheckUserCanBeAssignedToIssue(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + issuesCheckUserCanBeAssignedToIssueResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListCommentsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesListCommentsQuerySchema = z.object({ + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListCommentsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_issue_comment)], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesListComments + router.get( + `/repos/:owner/:repo/issues/:issue_number/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListCommentsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListCommentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListComments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListCommentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesCreateCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesCreateCommentRequestBodySchema = z.object({ body: z.string() }) + + const issuesCreateCommentResponseBodyValidator = responseValidationFactory( + [ + ["201", s_issue_comment], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesCreateComment + router.post( + `/repos/:owner/:repo/issues/:issue_number/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesCreateCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesCreateCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesCreateComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesCreateCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListEventsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesListEventsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListEventsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_issue_event_for_issue)], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesListEvents + router.get( + `/repos/:owner/:repo/issues/:issue_number/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListEventsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListEventsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListEvents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListEventsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListLabelsOnIssueParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesListLabelsOnIssueQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListLabelsOnIssueResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_label)], + ["301", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesListLabelsOnIssue + router.get( + `/repos/:owner/:repo/issues/:issue_number/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListLabelsOnIssueParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListLabelsOnIssueQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListLabelsOnIssue(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListLabelsOnIssueResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesAddLabelsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesAddLabelsRequestBodySchema = z + .union([ + z.object({ labels: z.array(z.string()).min(1).optional() }), + z.array(z.string()).min(1), + z.object({ + labels: z + .array(z.object({ name: z.string() })) + .min(1) + .optional(), + }), + z.array(z.object({ name: z.string() })).min(1), + z.string(), + ]) + .optional() + + const issuesAddLabelsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_label)], + ["301", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesAddLabels + router.post( + `/repos/:owner/:repo/issues/:issue_number/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesAddLabelsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesAddLabelsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesAddLabels(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesAddLabelsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesSetLabelsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesSetLabelsRequestBodySchema = z + .union([ + z.object({ labels: z.array(z.string()).min(1).optional() }), + z.array(z.string()).min(1), + z.object({ + labels: z + .array(z.object({ name: z.string() })) + .min(1) + .optional(), + }), + z.array(z.object({ name: z.string() })).min(1), + z.string(), + ]) + .optional() + + const issuesSetLabelsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_label)], + ["301", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesSetLabels + router.put( + `/repos/:owner/:repo/issues/:issue_number/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesSetLabelsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesSetLabelsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesSetLabels(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesSetLabelsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesRemoveAllLabelsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesRemoveAllLabelsResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["301", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesRemoveAllLabels + router.delete( + `/repos/:owner/:repo/issues/:issue_number/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesRemoveAllLabelsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesRemoveAllLabels(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesRemoveAllLabelsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesRemoveLabelParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + name: z.string(), + }) + + const issuesRemoveLabelResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_label)], + ["301", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesRemoveLabel + router.delete( + `/repos/:owner/:repo/issues/:issue_number/labels/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesRemoveLabelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with301() { + return new ExpressRuntimeResponse(301) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesRemoveLabel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesRemoveLabelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesLockParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesLockRequestBodySchema = z + .object({ + lock_reason: z + .enum(["off-topic", "too heated", "resolved", "spam"]) + .optional(), + }) + .nullable() + .optional() + + const issuesLockResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesLock + router.put( + `/repos/:owner/:repo/issues/:issue_number/lock`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesLockParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesLockRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesLock(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesLockResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesUnlockParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesUnlockResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesUnlock + router.delete( + `/repos/:owner/:repo/issues/:issue_number/lock`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesUnlockParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesUnlock(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesUnlockResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForIssueParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const reactionsListForIssueQuerySchema = z.object({ + content: z + .enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForIssueResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_reaction)], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // reactionsListForIssue + router.get( + `/repos/:owner/:repo/issues/:issue_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForIssueParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForIssueQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForIssue(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reactionsListForIssueResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForIssueParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const reactionsCreateForIssueRequestBodySchema = z.object({ + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + }) + + const reactionsCreateForIssueResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_reaction], + ["201", s_reaction], + ["422", s_validation_error], + ], + undefined, + ) + + // reactionsCreateForIssue + router.post( + `/repos/:owner/:repo/issues/:issue_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForIssueParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForIssueRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForIssue(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reactionsCreateForIssueResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsDeleteForIssueParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + reaction_id: z.coerce.number(), + }) + + const reactionsDeleteForIssueResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reactionsDeleteForIssue + router.delete( + `/repos/:owner/:repo/issues/:issue_number/reactions/:reaction_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsDeleteForIssueParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsDeleteForIssue(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reactionsDeleteForIssueResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesRemoveSubIssueParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesRemoveSubIssueRequestBodySchema = z.object({ + sub_issue_id: z.coerce.number(), + }) + + const issuesRemoveSubIssueResponseBodyValidator = responseValidationFactory( + [ + ["200", s_issue], + ["400", s_scim_error], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesRemoveSubIssue + router.delete( + `/repos/:owner/:repo/issues/:issue_number/sub_issue`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesRemoveSubIssueParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesRemoveSubIssueRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesRemoveSubIssue(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesRemoveSubIssueResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListSubIssuesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesListSubIssuesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListSubIssuesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_issue)], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesListSubIssues + router.get( + `/repos/:owner/:repo/issues/:issue_number/sub_issues`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListSubIssuesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListSubIssuesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListSubIssues(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListSubIssuesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesAddSubIssueParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesAddSubIssueRequestBodySchema = z.object({ + sub_issue_id: z.coerce.number(), + replace_parent: PermissiveBoolean.optional(), + }) + + const issuesAddSubIssueResponseBodyValidator = responseValidationFactory( + [ + ["201", s_issue], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesAddSubIssue + router.post( + `/repos/:owner/:repo/issues/:issue_number/sub_issues`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesAddSubIssueParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesAddSubIssueRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesAddSubIssue(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesAddSubIssueResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesReprioritizeSubIssueParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesReprioritizeSubIssueRequestBodySchema = z.object({ + sub_issue_id: z.coerce.number(), + after_id: z.coerce.number().optional(), + before_id: z.coerce.number().optional(), + }) + + const issuesReprioritizeSubIssueResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_issue], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error_simple], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // issuesReprioritizeSubIssue + router.patch( + `/repos/:owner/:repo/issues/:issue_number/sub_issues/priority`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesReprioritizeSubIssueParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesReprioritizeSubIssueRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesReprioritizeSubIssue(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + issuesReprioritizeSubIssueResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListEventsForTimelineParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + issue_number: z.coerce.number(), + }) + + const issuesListEventsForTimelineQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListEventsForTimelineResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_timeline_issue_events)], + ["404", s_basic_error], + ["410", s_basic_error], + ], + undefined, + ) + + // issuesListEventsForTimeline + router.get( + `/repos/:owner/:repo/issues/:issue_number/timeline`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListEventsForTimelineParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListEventsForTimelineQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListEventsForTimeline(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + issuesListEventsForTimelineResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListDeployKeysParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListDeployKeysQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListDeployKeysResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_deploy_key)]], + undefined, + ) + + // reposListDeployKeys + router.get( + `/repos/:owner/:repo/keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListDeployKeysParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListDeployKeysQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListDeployKeys(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListDeployKeysResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateDeployKeyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateDeployKeyRequestBodySchema = z.object({ + title: z.string().optional(), + key: z.string(), + read_only: PermissiveBoolean.optional(), + }) + + const reposCreateDeployKeyResponseBodyValidator = responseValidationFactory( + [ + ["201", s_deploy_key], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateDeployKey + router.post( + `/repos/:owner/:repo/keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateDeployKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateDeployKeyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateDeployKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateDeployKeyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetDeployKeyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + key_id: z.coerce.number(), + }) + + const reposGetDeployKeyResponseBodyValidator = responseValidationFactory( + [ + ["200", s_deploy_key], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetDeployKey + router.get( + `/repos/:owner/:repo/keys/:key_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetDeployKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetDeployKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetDeployKeyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteDeployKeyParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + key_id: z.coerce.number(), + }) + + const reposDeleteDeployKeyResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // reposDeleteDeployKey + router.delete( + `/repos/:owner/:repo/keys/:key_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteDeployKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteDeployKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteDeployKeyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListLabelsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesListLabelsForRepoQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListLabelsForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_label)], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesListLabelsForRepo + router.get( + `/repos/:owner/:repo/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListLabelsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListLabelsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListLabelsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListLabelsForRepoResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesCreateLabelParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesCreateLabelRequestBodySchema = z.object({ + name: z.string(), + color: z.string().optional(), + description: z.string().optional(), + }) + + const issuesCreateLabelResponseBodyValidator = responseValidationFactory( + [ + ["201", s_label], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesCreateLabel + router.post( + `/repos/:owner/:repo/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesCreateLabelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesCreateLabelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesCreateLabel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesCreateLabelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesGetLabelParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + name: z.string(), + }) + + const issuesGetLabelResponseBodyValidator = responseValidationFactory( + [ + ["200", s_label], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesGetLabel + router.get( + `/repos/:owner/:repo/labels/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesGetLabelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesGetLabel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesGetLabelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesUpdateLabelParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + name: z.string(), + }) + + const issuesUpdateLabelRequestBodySchema = z + .object({ + new_name: z.string().optional(), + color: z.string().optional(), + description: z.string().optional(), + }) + .optional() + + const issuesUpdateLabelResponseBodyValidator = responseValidationFactory( + [["200", s_label]], + undefined, + ) + + // issuesUpdateLabel + router.patch( + `/repos/:owner/:repo/labels/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesUpdateLabelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesUpdateLabelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesUpdateLabel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesUpdateLabelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesDeleteLabelParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + name: z.string(), + }) + + const issuesDeleteLabelResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // issuesDeleteLabel + router.delete( + `/repos/:owner/:repo/labels/:name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesDeleteLabelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesDeleteLabel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesDeleteLabelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListLanguagesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListLanguagesResponseBodyValidator = responseValidationFactory( + [["200", s_language]], + undefined, + ) + + // reposListLanguages + router.get( + `/repos/:owner/:repo/languages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListLanguagesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListLanguages(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListLanguagesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const licensesGetForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const licensesGetForRepoQuerySchema = z.object({ + ref: s_code_scanning_ref.optional(), + }) + + const licensesGetForRepoResponseBodyValidator = responseValidationFactory( + [ + ["200", s_license_content], + ["404", s_basic_error], + ], + undefined, + ) + + // licensesGetForRepo + router.get( + `/repos/:owner/:repo/license`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + licensesGetForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + licensesGetForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .licensesGetForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(licensesGetForRepoResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposMergeUpstreamParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposMergeUpstreamRequestBodySchema = z.object({ branch: z.string() }) + + const reposMergeUpstreamResponseBodyValidator = responseValidationFactory( + [ + ["200", s_merged_upstream], + ["409", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // reposMergeUpstream + router.post( + `/repos/:owner/:repo/merge-upstream`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposMergeUpstreamParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposMergeUpstreamRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposMergeUpstream(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposMergeUpstreamResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposMergeParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposMergeRequestBodySchema = z.object({ + base: z.string(), + head: z.string(), + commit_message: z.string().optional(), + }) + + const reposMergeResponseBodyValidator = responseValidationFactory( + [ + ["201", s_commit], + ["204", z.undefined()], + ["403", s_basic_error], + ["404", z.undefined()], + ["409", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // reposMerge + router.post( + `/repos/:owner/:repo/merges`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposMergeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposMergeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposMerge(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposMergeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListMilestonesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesListMilestonesQuerySchema = z.object({ + state: z.enum(["open", "closed", "all"]).optional().default("open"), + sort: z.enum(["due_on", "completeness"]).optional().default("due_on"), + direction: z.enum(["asc", "desc"]).optional().default("asc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListMilestonesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_milestone)], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesListMilestones + router.get( + `/repos/:owner/:repo/milestones`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListMilestonesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListMilestonesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListMilestones(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesListMilestonesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesCreateMilestoneParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const issuesCreateMilestoneRequestBodySchema = z.object({ + title: z.string(), + state: z.enum(["open", "closed"]).optional().default("open"), + description: z.string().optional(), + due_on: z.string().datetime({ offset: true }).optional(), + }) + + const issuesCreateMilestoneResponseBodyValidator = responseValidationFactory( + [ + ["201", s_milestone], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // issuesCreateMilestone + router.post( + `/repos/:owner/:repo/milestones`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesCreateMilestoneParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesCreateMilestoneRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesCreateMilestone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesCreateMilestoneResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesGetMilestoneParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + milestone_number: z.coerce.number(), + }) + + const issuesGetMilestoneResponseBodyValidator = responseValidationFactory( + [ + ["200", s_milestone], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesGetMilestone + router.get( + `/repos/:owner/:repo/milestones/:milestone_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesGetMilestoneParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesGetMilestone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesGetMilestoneResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesUpdateMilestoneParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + milestone_number: z.coerce.number(), + }) + + const issuesUpdateMilestoneRequestBodySchema = z + .object({ + title: z.string().optional(), + state: z.enum(["open", "closed"]).optional().default("open"), + description: z.string().optional(), + due_on: z.string().datetime({ offset: true }).optional(), + }) + .optional() + + const issuesUpdateMilestoneResponseBodyValidator = responseValidationFactory( + [["200", s_milestone]], + undefined, + ) + + // issuesUpdateMilestone + router.patch( + `/repos/:owner/:repo/milestones/:milestone_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesUpdateMilestoneParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + issuesUpdateMilestoneRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesUpdateMilestone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesUpdateMilestoneResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesDeleteMilestoneParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + milestone_number: z.coerce.number(), + }) + + const issuesDeleteMilestoneResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesDeleteMilestone + router.delete( + `/repos/:owner/:repo/milestones/:milestone_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesDeleteMilestoneParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesDeleteMilestone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(issuesDeleteMilestoneResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListLabelsForMilestoneParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + milestone_number: z.coerce.number(), + }) + + const issuesListLabelsForMilestoneQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListLabelsForMilestoneResponseBodyValidator = + responseValidationFactory([["200", z.array(s_label)]], undefined) + + // issuesListLabelsForMilestone + router.get( + `/repos/:owner/:repo/milestones/:milestone_number/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + issuesListLabelsForMilestoneParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + issuesListLabelsForMilestoneQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListLabelsForMilestone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + issuesListLabelsForMilestoneResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListRepoNotificationsForAuthenticatedUserParamSchema = z.object( + { owner: z.string(), repo: z.string() }, + ) + + const activityListRepoNotificationsForAuthenticatedUserQuerySchema = z.object( + { + all: PermissiveBoolean.optional().default(false), + participating: PermissiveBoolean.optional().default(false), + since: z.string().datetime({ offset: true }).optional(), + before: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }, + ) + + const activityListRepoNotificationsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_thread)]], undefined) + + // activityListRepoNotificationsForAuthenticatedUser + router.get( + `/repos/:owner/:repo/notifications`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListRepoNotificationsForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListRepoNotificationsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListRepoNotificationsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListRepoNotificationsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityMarkRepoNotificationsAsReadParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityMarkRepoNotificationsAsReadRequestBodySchema = z + .object({ last_read_at: z.string().datetime({ offset: true }).optional() }) + .optional() + + const activityMarkRepoNotificationsAsReadResponseBodyValidator = + responseValidationFactory( + [ + [ + "202", + z.object({ + message: z.string().optional(), + url: z.string().optional(), + }), + ], + ["205", z.undefined()], + ], + undefined, + ) + + // activityMarkRepoNotificationsAsRead + router.put( + `/repos/:owner/:repo/notifications`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityMarkRepoNotificationsAsReadParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + activityMarkRepoNotificationsAsReadRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + message?: string | undefined + url?: string | undefined + }>(202) + }, + with205() { + return new ExpressRuntimeResponse(205) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityMarkRepoNotificationsAsRead(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityMarkRepoNotificationsAsReadResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetPagesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetPagesResponseBodyValidator = responseValidationFactory( + [ + ["200", s_page], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetPages + router.get( + `/repos/:owner/:repo/pages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetPagesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetPages(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetPagesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreatePagesSiteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreatePagesSiteRequestBodySchema = z + .object({ + build_type: z.enum(["legacy", "workflow"]).optional(), + source: z + .object({ + branch: z.string(), + path: z.enum(["/", "/docs"]).optional().default("/"), + }) + .optional(), + }) + .nullable() + + const reposCreatePagesSiteResponseBodyValidator = responseValidationFactory( + [ + ["201", s_page], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreatePagesSite + router.post( + `/repos/:owner/:repo/pages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreatePagesSiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreatePagesSiteRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreatePagesSite(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreatePagesSiteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateInformationAboutPagesSiteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposUpdateInformationAboutPagesSiteRequestBodySchema = z.object({ + cname: z.string().nullable().optional(), + https_enforced: PermissiveBoolean.optional(), + build_type: z.enum(["legacy", "workflow"]).optional(), + source: z + .union([ + z.enum(["gh-pages", "master", "master /docs"]), + z.object({ branch: z.string(), path: z.enum(["/", "/docs"]) }), + ]) + .optional(), + }) + + const reposUpdateInformationAboutPagesSiteResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["400", s_scim_error], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposUpdateInformationAboutPagesSite + router.put( + `/repos/:owner/:repo/pages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateInformationAboutPagesSiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateInformationAboutPagesSiteRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateInformationAboutPagesSite( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposUpdateInformationAboutPagesSiteResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeletePagesSiteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposDeletePagesSiteResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["409", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposDeletePagesSite + router.delete( + `/repos/:owner/:repo/pages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeletePagesSiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeletePagesSite(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeletePagesSiteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListPagesBuildsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListPagesBuildsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListPagesBuildsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_page_build)]], + undefined, + ) + + // reposListPagesBuilds + router.get( + `/repos/:owner/:repo/pages/builds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListPagesBuildsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListPagesBuildsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListPagesBuilds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListPagesBuildsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposRequestPagesBuildParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposRequestPagesBuildResponseBodyValidator = responseValidationFactory( + [["201", s_page_build_status]], + undefined, + ) + + // reposRequestPagesBuild + router.post( + `/repos/:owner/:repo/pages/builds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposRequestPagesBuildParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposRequestPagesBuild(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposRequestPagesBuildResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetLatestPagesBuildParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetLatestPagesBuildResponseBodyValidator = + responseValidationFactory([["200", s_page_build]], undefined) + + // reposGetLatestPagesBuild + router.get( + `/repos/:owner/:repo/pages/builds/latest`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetLatestPagesBuildParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetLatestPagesBuild(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetLatestPagesBuildResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetPagesBuildParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + build_id: z.coerce.number(), + }) + + const reposGetPagesBuildResponseBodyValidator = responseValidationFactory( + [["200", s_page_build]], + undefined, + ) + + // reposGetPagesBuild + router.get( + `/repos/:owner/:repo/pages/builds/:build_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetPagesBuildParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetPagesBuild(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetPagesBuildResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreatePagesDeploymentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreatePagesDeploymentRequestBodySchema = z.object({ + artifact_id: z.coerce.number().optional(), + artifact_url: z.string().optional(), + environment: z.string().optional().default("github-pages"), + pages_build_version: z.string().default("GITHUB_SHA"), + oidc_token: z.string(), + }) + + const reposCreatePagesDeploymentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_page_deployment], + ["400", s_scim_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreatePagesDeployment + router.post( + `/repos/:owner/:repo/pages/deployments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreatePagesDeploymentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreatePagesDeploymentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreatePagesDeployment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreatePagesDeploymentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetPagesDeploymentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pages_deployment_id: z.union([z.coerce.number(), z.string()]), + }) + + const reposGetPagesDeploymentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_pages_deployment_status], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetPagesDeployment + router.get( + `/repos/:owner/:repo/pages/deployments/:pages_deployment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetPagesDeploymentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetPagesDeployment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetPagesDeploymentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCancelPagesDeploymentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pages_deployment_id: z.union([z.coerce.number(), z.string()]), + }) + + const reposCancelPagesDeploymentResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposCancelPagesDeployment + router.post( + `/repos/:owner/:repo/pages/deployments/:pages_deployment_id/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCancelPagesDeploymentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCancelPagesDeployment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCancelPagesDeploymentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetPagesHealthCheckParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetPagesHealthCheckResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_pages_health_check], + ["202", s_empty_object], + ["400", z.undefined()], + ["404", s_basic_error], + ["422", z.undefined()], + ], + undefined, + ) + + // reposGetPagesHealthCheck + router.get( + `/repos/:owner/:repo/pages/health`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetPagesHealthCheckParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with202() { + return new ExpressRuntimeResponse(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetPagesHealthCheck(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetPagesHealthCheckResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCheckPrivateVulnerabilityReportingParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCheckPrivateVulnerabilityReportingResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.object({ enabled: PermissiveBoolean })], + ["422", s_scim_error], + ], + undefined, + ) + + // reposCheckPrivateVulnerabilityReporting + router.get( + `/repos/:owner/:repo/private-vulnerability-reporting`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCheckPrivateVulnerabilityReportingParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + enabled: boolean + }>(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCheckPrivateVulnerabilityReporting( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCheckPrivateVulnerabilityReportingResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposEnablePrivateVulnerabilityReportingParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposEnablePrivateVulnerabilityReportingResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["422", s_scim_error], + ], + undefined, + ) + + // reposEnablePrivateVulnerabilityReporting + router.put( + `/repos/:owner/:repo/private-vulnerability-reporting`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposEnablePrivateVulnerabilityReportingParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposEnablePrivateVulnerabilityReporting( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposEnablePrivateVulnerabilityReportingResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDisablePrivateVulnerabilityReportingParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposDisablePrivateVulnerabilityReportingResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["422", s_scim_error], + ], + undefined, + ) + + // reposDisablePrivateVulnerabilityReporting + router.delete( + `/repos/:owner/:repo/private-vulnerability-reporting`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDisablePrivateVulnerabilityReportingParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDisablePrivateVulnerabilityReporting( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDisablePrivateVulnerabilityReportingResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsListForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const projectsListForRepoQuerySchema = z.object({ + state: z.enum(["open", "closed", "all"]).optional().default("open"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const projectsListForRepoResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_project)], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsListForRepo + router.get( + `/repos/:owner/:repo/projects`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsListForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + projectsListForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsListForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsListForRepoResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsCreateForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const projectsCreateForRepoRequestBodySchema = z.object({ + name: z.string(), + body: z.string().optional(), + }) + + const projectsCreateForRepoResponseBodyValidator = responseValidationFactory( + [ + ["201", s_project], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["410", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsCreateForRepo + router.post( + `/repos/:owner/:repo/projects`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsCreateForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + projectsCreateForRepoRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with410() { + return new ExpressRuntimeResponse(410) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsCreateForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsCreateForRepoResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCustomPropertiesValuesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetCustomPropertiesValuesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_custom_property_value)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetCustomPropertiesValues + router.get( + `/repos/:owner/:repo/properties/values`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCustomPropertiesValuesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCustomPropertiesValues(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetCustomPropertiesValuesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateOrUpdateCustomPropertiesValuesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateOrUpdateCustomPropertiesValuesRequestBodySchema = z.object({ + properties: z.array(s_custom_property_value), + }) + + const reposCreateOrUpdateCustomPropertiesValuesResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateOrUpdateCustomPropertiesValues + router.patch( + `/repos/:owner/:repo/properties/values`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateOrUpdateCustomPropertiesValuesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateOrUpdateCustomPropertiesValuesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateOrUpdateCustomPropertiesValues( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreateOrUpdateCustomPropertiesValuesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsListParamSchema = z.object({ owner: z.string(), repo: z.string() }) + + const pullsListQuerySchema = z.object({ + state: z.enum(["open", "closed", "all"]).optional().default("open"), + head: z.string().optional(), + base: z.string().optional(), + sort: z + .enum(["created", "updated", "popularity", "long-running"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const pullsListResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_pull_request_simple)], + ["304", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // pullsList + router.get( + `/repos/:owner/:repo/pulls`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsListParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + pullsListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsListResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsCreateParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const pullsCreateRequestBodySchema = z.object({ + title: z.string().optional(), + head: z.string(), + head_repo: z.string().optional(), + base: z.string(), + body: z.string().optional(), + maintainer_can_modify: PermissiveBoolean.optional(), + draft: PermissiveBoolean.optional(), + issue: z.coerce.number().optional(), + }) + + const pullsCreateResponseBodyValidator = responseValidationFactory( + [ + ["201", s_pull_request], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // pullsCreate + router.post( + `/repos/:owner/:repo/pulls`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsCreateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsCreateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsCreate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsCreateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsListReviewCommentsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const pullsListReviewCommentsForRepoQuerySchema = z.object({ + sort: z.enum(["created", "updated", "created_at"]).optional(), + direction: z.enum(["asc", "desc"]).optional(), + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const pullsListReviewCommentsForRepoResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_pull_request_review_comment)]], + undefined, + ) + + // pullsListReviewCommentsForRepo + router.get( + `/repos/:owner/:repo/pulls/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsListReviewCommentsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + pullsListReviewCommentsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsListReviewCommentsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + pullsListReviewCommentsForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsGetReviewCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const pullsGetReviewCommentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request_review_comment], + ["404", s_basic_error], + ], + undefined, + ) + + // pullsGetReviewComment + router.get( + `/repos/:owner/:repo/pulls/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsGetReviewCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsGetReviewComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsGetReviewCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsUpdateReviewCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const pullsUpdateReviewCommentRequestBodySchema = z.object({ + body: z.string(), + }) + + const pullsUpdateReviewCommentResponseBodyValidator = + responseValidationFactory( + [["200", s_pull_request_review_comment]], + undefined, + ) + + // pullsUpdateReviewComment + router.patch( + `/repos/:owner/:repo/pulls/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsUpdateReviewCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsUpdateReviewCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsUpdateReviewComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsUpdateReviewCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsDeleteReviewCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const pullsDeleteReviewCommentResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // pullsDeleteReviewComment + router.delete( + `/repos/:owner/:repo/pulls/comments/:comment_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsDeleteReviewCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsDeleteReviewComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsDeleteReviewCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForPullRequestReviewCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reactionsListForPullRequestReviewCommentQuerySchema = z.object({ + content: z + .enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForPullRequestReviewCommentResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_reaction)], + ["404", s_basic_error], + ], + undefined, + ) + + // reactionsListForPullRequestReviewComment + router.get( + `/repos/:owner/:repo/pulls/comments/:comment_id/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForPullRequestReviewCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForPullRequestReviewCommentQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForPullRequestReviewComment( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsListForPullRequestReviewCommentResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForPullRequestReviewCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + }) + + const reactionsCreateForPullRequestReviewCommentRequestBodySchema = z.object({ + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + }) + + const reactionsCreateForPullRequestReviewCommentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_reaction], + ["201", s_reaction], + ["422", s_validation_error], + ], + undefined, + ) + + // reactionsCreateForPullRequestReviewComment + router.post( + `/repos/:owner/:repo/pulls/comments/:comment_id/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForPullRequestReviewCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForPullRequestReviewCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForPullRequestReviewComment( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsCreateForPullRequestReviewCommentResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsDeleteForPullRequestCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + comment_id: z.coerce.number(), + reaction_id: z.coerce.number(), + }) + + const reactionsDeleteForPullRequestCommentResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reactionsDeleteForPullRequestComment + router.delete( + `/repos/:owner/:repo/pulls/comments/:comment_id/reactions/:reaction_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsDeleteForPullRequestCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsDeleteForPullRequestComment( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsDeleteForPullRequestCommentResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsGetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsGetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request], + ["304", z.undefined()], + ["404", s_basic_error], + ["406", s_basic_error], + ["500", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // pullsGet + router.get( + `/repos/:owner/:repo/pulls/:pull_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with406() { + return new ExpressRuntimeResponse(406) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsUpdateParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsUpdateRequestBodySchema = z + .object({ + title: z.string().optional(), + body: z.string().optional(), + state: z.enum(["open", "closed"]).optional(), + base: z.string().optional(), + maintainer_can_modify: PermissiveBoolean.optional(), + }) + .optional() + + const pullsUpdateResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // pullsUpdate + router.patch( + `/repos/:owner/:repo/pulls/:pull_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesCreateWithPrForAuthenticatedUserParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const codespacesCreateWithPrForAuthenticatedUserRequestBodySchema = z + .object({ + location: z.string().optional(), + geo: z + .enum(["EuropeWest", "SoutheastAsia", "UsEast", "UsWest"]) + .optional(), + client_ip: z.string().optional(), + machine: z.string().optional(), + devcontainer_path: z.string().optional(), + multi_repo_permissions_opt_out: PermissiveBoolean.optional(), + working_directory: z.string().optional(), + idle_timeout_minutes: z.coerce.number().optional(), + display_name: z.string().optional(), + retention_period_minutes: z.coerce.number().optional(), + }) + .nullable() + + const codespacesCreateWithPrForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_codespace], + ["202", s_codespace], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codespacesCreateWithPrForAuthenticatedUser + router.post( + `/repos/:owner/:repo/pulls/:pull_number/codespaces`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesCreateWithPrForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesCreateWithPrForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with202() { + return new ExpressRuntimeResponse(202) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesCreateWithPrForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesCreateWithPrForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsListReviewCommentsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsListReviewCommentsQuerySchema = z.object({ + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional(), + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const pullsListReviewCommentsResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_pull_request_review_comment)]], + undefined, + ) + + // pullsListReviewComments + router.get( + `/repos/:owner/:repo/pulls/:pull_number/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsListReviewCommentsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + pullsListReviewCommentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsListReviewComments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsListReviewCommentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsCreateReviewCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsCreateReviewCommentRequestBodySchema = z.object({ + body: z.string(), + commit_id: z.string(), + path: z.string(), + position: z.coerce.number().optional(), + side: z.enum(["LEFT", "RIGHT"]).optional(), + line: z.coerce.number().optional(), + start_line: z.coerce.number().optional(), + start_side: z.enum(["LEFT", "RIGHT", "side"]).optional(), + in_reply_to: z.coerce.number().optional(), + subject_type: z.enum(["line", "file"]).optional(), + }) + + const pullsCreateReviewCommentResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_pull_request_review_comment], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // pullsCreateReviewComment + router.post( + `/repos/:owner/:repo/pulls/:pull_number/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsCreateReviewCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsCreateReviewCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse( + 201, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsCreateReviewComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsCreateReviewCommentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsCreateReplyForReviewCommentParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + comment_id: z.coerce.number(), + }) + + const pullsCreateReplyForReviewCommentRequestBodySchema = z.object({ + body: z.string(), + }) + + const pullsCreateReplyForReviewCommentResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_pull_request_review_comment], + ["404", s_basic_error], + ], + undefined, + ) + + // pullsCreateReplyForReviewComment + router.post( + `/repos/:owner/:repo/pulls/:pull_number/comments/:comment_id/replies`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsCreateReplyForReviewCommentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsCreateReplyForReviewCommentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse( + 201, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsCreateReplyForReviewComment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + pullsCreateReplyForReviewCommentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsListCommitsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsListCommitsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const pullsListCommitsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_commit)]], + undefined, + ) + + // pullsListCommits + router.get( + `/repos/:owner/:repo/pulls/:pull_number/commits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsListCommitsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + pullsListCommitsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsListCommits(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsListCommitsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsListFilesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsListFilesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const pullsListFilesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_diff_entry)], + ["422", s_validation_error], + ["500", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // pullsListFiles + router.get( + `/repos/:owner/:repo/pulls/:pull_number/files`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsListFilesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + pullsListFilesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsListFiles(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsListFilesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsCheckIfMergedParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsCheckIfMergedResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // pullsCheckIfMerged + router.get( + `/repos/:owner/:repo/pulls/:pull_number/merge`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsCheckIfMergedParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsCheckIfMerged(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsCheckIfMergedResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsMergeParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsMergeRequestBodySchema = z + .object({ + commit_title: z.string().optional(), + commit_message: z.string().optional(), + sha: z.string().optional(), + merge_method: z.enum(["merge", "squash", "rebase"]).optional(), + }) + .nullable() + .optional() + + const pullsMergeResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request_merge_result], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "405", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + [ + "409", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ["422", s_validation_error], + ], + undefined, + ) + + // pullsMerge + router.put( + `/repos/:owner/:repo/pulls/:pull_number/merge`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsMergeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsMergeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with405() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }>(405) + }, + with409() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }>(409) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsMerge(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsMergeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsListRequestedReviewersParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsListRequestedReviewersResponseBodyValidator = + responseValidationFactory( + [["200", s_pull_request_review_request]], + undefined, + ) + + // pullsListRequestedReviewers + router.get( + `/repos/:owner/:repo/pulls/:pull_number/requested_reviewers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsListRequestedReviewersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsListRequestedReviewers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + pullsListRequestedReviewersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsRequestReviewersParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsRequestReviewersRequestBodySchema = z + .object({ + reviewers: z.array(z.string()).optional(), + team_reviewers: z.array(z.string()).optional(), + }) + .optional() + + const pullsRequestReviewersResponseBodyValidator = responseValidationFactory( + [ + ["201", s_pull_request_simple], + ["403", s_basic_error], + ["422", z.undefined()], + ], + undefined, + ) + + // pullsRequestReviewers + router.post( + `/repos/:owner/:repo/pulls/:pull_number/requested_reviewers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsRequestReviewersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsRequestReviewersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsRequestReviewers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsRequestReviewersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsRemoveRequestedReviewersParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsRemoveRequestedReviewersRequestBodySchema = z.object({ + reviewers: z.array(z.string()), + team_reviewers: z.array(z.string()).optional(), + }) + + const pullsRemoveRequestedReviewersResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_pull_request_simple], + ["422", s_validation_error], + ], + undefined, + ) + + // pullsRemoveRequestedReviewers + router.delete( + `/repos/:owner/:repo/pulls/:pull_number/requested_reviewers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsRemoveRequestedReviewersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsRemoveRequestedReviewersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsRemoveRequestedReviewers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + pullsRemoveRequestedReviewersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsListReviewsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsListReviewsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const pullsListReviewsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_pull_request_review)]], + undefined, + ) + + // pullsListReviews + router.get( + `/repos/:owner/:repo/pulls/:pull_number/reviews`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsListReviewsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + pullsListReviewsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsListReviews(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsListReviewsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsCreateReviewParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsCreateReviewRequestBodySchema = z + .object({ + commit_id: z.string().optional(), + body: z.string().optional(), + event: z.enum(["APPROVE", "REQUEST_CHANGES", "COMMENT"]).optional(), + comments: z + .array( + z.object({ + path: z.string(), + position: z.coerce.number().optional(), + body: z.string(), + line: z.coerce.number().optional(), + side: z.string().optional(), + start_line: z.coerce.number().optional(), + start_side: z.string().optional(), + }), + ) + .optional(), + }) + .optional() + + const pullsCreateReviewResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request_review], + ["403", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // pullsCreateReview + router.post( + `/repos/:owner/:repo/pulls/:pull_number/reviews`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsCreateReviewParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsCreateReviewRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsCreateReview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsCreateReviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsGetReviewParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + review_id: z.coerce.number(), + }) + + const pullsGetReviewResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request_review], + ["404", s_basic_error], + ], + undefined, + ) + + // pullsGetReview + router.get( + `/repos/:owner/:repo/pulls/:pull_number/reviews/:review_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsGetReviewParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsGetReview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsGetReviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsUpdateReviewParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + review_id: z.coerce.number(), + }) + + const pullsUpdateReviewRequestBodySchema = z.object({ body: z.string() }) + + const pullsUpdateReviewResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request_review], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // pullsUpdateReview + router.put( + `/repos/:owner/:repo/pulls/:pull_number/reviews/:review_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsUpdateReviewParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsUpdateReviewRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsUpdateReview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsUpdateReviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsDeletePendingReviewParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + review_id: z.coerce.number(), + }) + + const pullsDeletePendingReviewResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_pull_request_review], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // pullsDeletePendingReview + router.delete( + `/repos/:owner/:repo/pulls/:pull_number/reviews/:review_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsDeletePendingReviewParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsDeletePendingReview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsDeletePendingReviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsListCommentsForReviewParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + review_id: z.coerce.number(), + }) + + const pullsListCommentsForReviewQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const pullsListCommentsForReviewResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_review_comment)], + ["404", s_basic_error], + ], + undefined, + ) + + // pullsListCommentsForReview + router.get( + `/repos/:owner/:repo/pulls/:pull_number/reviews/:review_id/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsListCommentsForReviewParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + pullsListCommentsForReviewQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsListCommentsForReview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + pullsListCommentsForReviewResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsDismissReviewParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + review_id: z.coerce.number(), + }) + + const pullsDismissReviewRequestBodySchema = z.object({ + message: z.string(), + event: z.enum(["DISMISS"]).optional(), + }) + + const pullsDismissReviewResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request_review], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // pullsDismissReview + router.put( + `/repos/:owner/:repo/pulls/:pull_number/reviews/:review_id/dismissals`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsDismissReviewParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsDismissReviewRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsDismissReview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsDismissReviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsSubmitReviewParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + review_id: z.coerce.number(), + }) + + const pullsSubmitReviewRequestBodySchema = z.object({ + body: z.string().optional(), + event: z.enum(["APPROVE", "REQUEST_CHANGES", "COMMENT"]), + }) + + const pullsSubmitReviewResponseBodyValidator = responseValidationFactory( + [ + ["200", s_pull_request_review], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // pullsSubmitReview + router.post( + `/repos/:owner/:repo/pulls/:pull_number/reviews/:review_id/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsSubmitReviewParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsSubmitReviewRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsSubmitReview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsSubmitReviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pullsUpdateBranchParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + pull_number: z.coerce.number(), + }) + + const pullsUpdateBranchRequestBodySchema = z + .object({ expected_head_sha: z.string().optional() }) + .nullable() + .optional() + + const pullsUpdateBranchResponseBodyValidator = responseValidationFactory( + [ + [ + "202", + z.object({ + message: z.string().optional(), + url: z.string().optional(), + }), + ], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // pullsUpdateBranch + router.put( + `/repos/:owner/:repo/pulls/:pull_number/update-branch`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pullsUpdateBranchParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + pullsUpdateBranchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + message?: string | undefined + url?: string | undefined + }>(202) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pullsUpdateBranch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(pullsUpdateBranchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetReadmeParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetReadmeQuerySchema = z.object({ ref: z.string().optional() }) + + const reposGetReadmeResponseBodyValidator = responseValidationFactory( + [ + ["200", s_content_file], + ["304", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposGetReadme + router.get( + `/repos/:owner/:repo/readme`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetReadmeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetReadmeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetReadme(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetReadmeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetReadmeInDirectoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + dir: z.string(), + }) + + const reposGetReadmeInDirectoryQuerySchema = z.object({ + ref: z.string().optional(), + }) + + const reposGetReadmeInDirectoryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_content_file], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposGetReadmeInDirectory + router.get( + `/repos/:owner/:repo/readme/:dir`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetReadmeInDirectoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetReadmeInDirectoryQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetReadmeInDirectory(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetReadmeInDirectoryResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListReleasesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListReleasesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListReleasesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_release)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListReleases + router.get( + `/repos/:owner/:repo/releases`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListReleasesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListReleasesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListReleases(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListReleasesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateReleaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateReleaseRequestBodySchema = z.object({ + tag_name: z.string(), + target_commitish: z.string().optional(), + name: z.string().optional(), + body: z.string().optional(), + draft: PermissiveBoolean.optional().default(false), + prerelease: PermissiveBoolean.optional().default(false), + discussion_category_name: z.string().optional(), + generate_release_notes: PermissiveBoolean.optional().default(false), + make_latest: z.enum(["true", "false", "legacy"]).optional().default("true"), + }) + + const reposCreateReleaseResponseBodyValidator = responseValidationFactory( + [ + ["201", s_release], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateRelease + router.post( + `/repos/:owner/:repo/releases`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateReleaseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateRelease(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateReleaseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetReleaseAssetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + asset_id: z.coerce.number(), + }) + + const reposGetReleaseAssetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_release_asset], + ["302", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetReleaseAsset + router.get( + `/repos/:owner/:repo/releases/assets/:asset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetReleaseAssetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with302() { + return new ExpressRuntimeResponse(302) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetReleaseAsset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetReleaseAssetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateReleaseAssetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + asset_id: z.coerce.number(), + }) + + const reposUpdateReleaseAssetRequestBodySchema = z + .object({ + name: z.string().optional(), + label: z.string().optional(), + state: z.string().optional(), + }) + .optional() + + const reposUpdateReleaseAssetResponseBodyValidator = + responseValidationFactory([["200", s_release_asset]], undefined) + + // reposUpdateReleaseAsset + router.patch( + `/repos/:owner/:repo/releases/assets/:asset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateReleaseAssetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateReleaseAssetRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateReleaseAsset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUpdateReleaseAssetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteReleaseAssetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + asset_id: z.coerce.number(), + }) + + const reposDeleteReleaseAssetResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposDeleteReleaseAsset + router.delete( + `/repos/:owner/:repo/releases/assets/:asset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteReleaseAssetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteReleaseAsset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteReleaseAssetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGenerateReleaseNotesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGenerateReleaseNotesRequestBodySchema = z.object({ + tag_name: z.string(), + target_commitish: z.string().optional(), + previous_tag_name: z.string().optional(), + configuration_file_path: z.string().optional(), + }) + + const reposGenerateReleaseNotesResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_release_notes_content], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGenerateReleaseNotes + router.post( + `/repos/:owner/:repo/releases/generate-notes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGenerateReleaseNotesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposGenerateReleaseNotesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGenerateReleaseNotes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGenerateReleaseNotesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetLatestReleaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetLatestReleaseResponseBodyValidator = responseValidationFactory( + [["200", s_release]], + undefined, + ) + + // reposGetLatestRelease + router.get( + `/repos/:owner/:repo/releases/latest`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetLatestReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetLatestRelease(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetLatestReleaseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetReleaseByTagParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + tag: z.string(), + }) + + const reposGetReleaseByTagResponseBodyValidator = responseValidationFactory( + [ + ["200", s_release], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetReleaseByTag + router.get( + `/repos/:owner/:repo/releases/tags/:tag`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetReleaseByTagParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetReleaseByTag(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetReleaseByTagResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetReleaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + release_id: z.coerce.number(), + }) + + const reposGetReleaseResponseBodyValidator = responseValidationFactory( + [ + ["200", s_release], + ["401", z.undefined()], + ], + undefined, + ) + + // reposGetRelease + router.get( + `/repos/:owner/:repo/releases/:release_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetRelease(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetReleaseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateReleaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + release_id: z.coerce.number(), + }) + + const reposUpdateReleaseRequestBodySchema = z + .object({ + tag_name: z.string().optional(), + target_commitish: z.string().optional(), + name: z.string().optional(), + body: z.string().optional(), + draft: PermissiveBoolean.optional(), + prerelease: PermissiveBoolean.optional(), + make_latest: z + .enum(["true", "false", "legacy"]) + .optional() + .default("true"), + discussion_category_name: z.string().optional(), + }) + .optional() + + const reposUpdateReleaseResponseBodyValidator = responseValidationFactory( + [ + ["200", s_release], + ["404", s_basic_error], + ], + undefined, + ) + + // reposUpdateRelease + router.patch( + `/repos/:owner/:repo/releases/:release_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateReleaseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateRelease(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUpdateReleaseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteReleaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + release_id: z.coerce.number(), + }) + + const reposDeleteReleaseResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // reposDeleteRelease + router.delete( + `/repos/:owner/:repo/releases/:release_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteRelease(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteReleaseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListReleaseAssetsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + release_id: z.coerce.number(), + }) + + const reposListReleaseAssetsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListReleaseAssetsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_release_asset)]], + undefined, + ) + + // reposListReleaseAssets + router.get( + `/repos/:owner/:repo/releases/:release_id/assets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListReleaseAssetsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListReleaseAssetsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListReleaseAssets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListReleaseAssetsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUploadReleaseAssetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + release_id: z.coerce.number(), + }) + + const reposUploadReleaseAssetQuerySchema = z.object({ + name: z.string(), + label: z.string().optional(), + }) + + const reposUploadReleaseAssetRequestBodySchema = z.string().optional() + + const reposUploadReleaseAssetResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_release_asset], + ["422", z.undefined()], + ], + undefined, + ) + + // reposUploadReleaseAsset + router.post( + `/repos/:owner/:repo/releases/:release_id/assets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUploadReleaseAssetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposUploadReleaseAssetQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + reposUploadReleaseAssetRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUploadReleaseAsset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUploadReleaseAssetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForReleaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + release_id: z.coerce.number(), + }) + + const reactionsListForReleaseQuerySchema = z.object({ + content: z + .enum(["+1", "laugh", "heart", "hooray", "rocket", "eyes"]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForReleaseResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_reaction)], + ["404", s_basic_error], + ], + undefined, + ) + + // reactionsListForRelease + router.get( + `/repos/:owner/:repo/releases/:release_id/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForReleaseQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForRelease(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reactionsListForReleaseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForReleaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + release_id: z.coerce.number(), + }) + + const reactionsCreateForReleaseRequestBodySchema = z.object({ + content: z.enum(["+1", "laugh", "heart", "hooray", "rocket", "eyes"]), + }) + + const reactionsCreateForReleaseResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_reaction], + ["201", s_reaction], + ["422", s_validation_error], + ], + undefined, + ) + + // reactionsCreateForRelease + router.post( + `/repos/:owner/:repo/releases/:release_id/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForReleaseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForRelease(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reactionsCreateForReleaseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsDeleteForReleaseParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + release_id: z.coerce.number(), + reaction_id: z.coerce.number(), + }) + + const reactionsDeleteForReleaseResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reactionsDeleteForRelease + router.delete( + `/repos/:owner/:repo/releases/:release_id/reactions/:reaction_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsDeleteForReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsDeleteForRelease(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reactionsDeleteForReleaseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetBranchRulesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + branch: z.string(), + }) + + const reposGetBranchRulesQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposGetBranchRulesResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_repository_rule_detailed)]], + undefined, + ) + + // reposGetBranchRules + router.get( + `/repos/:owner/:repo/rules/branches/:branch`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetBranchRulesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetBranchRulesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetBranchRules(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetBranchRulesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetRepoRulesetsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetRepoRulesetsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + includes_parents: PermissiveBoolean.optional().default(true), + targets: z.string().optional(), + }) + + const reposGetRepoRulesetsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_repository_ruleset)], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetRepoRulesets + router.get( + `/repos/:owner/:repo/rulesets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetRepoRulesetsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetRepoRulesetsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetRepoRulesets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetRepoRulesetsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateRepoRulesetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateRepoRulesetRequestBodySchema = z.object({ + name: z.string(), + target: z.enum(["branch", "tag", "push"]).optional().default("branch"), + enforcement: s_repository_rule_enforcement, + bypass_actors: z.array(s_repository_ruleset_bypass_actor).optional(), + conditions: s_repository_ruleset_conditions.optional(), + rules: z.array(s_repository_rule).optional(), + }) + + const reposCreateRepoRulesetResponseBodyValidator = responseValidationFactory( + [ + ["201", s_repository_ruleset], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposCreateRepoRuleset + router.post( + `/repos/:owner/:repo/rulesets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateRepoRulesetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateRepoRulesetRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateRepoRuleset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateRepoRulesetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetRepoRuleSuitesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetRepoRuleSuitesQuerySchema = z.object({ + ref: z.string().optional(), + time_period: z + .enum(["hour", "day", "week", "month"]) + .optional() + .default("day"), + actor_name: z.string().optional(), + rule_suite_result: z + .enum(["pass", "fail", "bypass", "all"]) + .optional() + .default("all"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposGetRepoRuleSuitesResponseBodyValidator = responseValidationFactory( + [ + ["200", s_rule_suites], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetRepoRuleSuites + router.get( + `/repos/:owner/:repo/rulesets/rule-suites`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetRepoRuleSuitesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetRepoRuleSuitesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetRepoRuleSuites(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetRepoRuleSuitesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetRepoRuleSuiteParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + rule_suite_id: z.coerce.number(), + }) + + const reposGetRepoRuleSuiteResponseBodyValidator = responseValidationFactory( + [ + ["200", s_rule_suite], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetRepoRuleSuite + router.get( + `/repos/:owner/:repo/rulesets/rule-suites/:rule_suite_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetRepoRuleSuiteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetRepoRuleSuite(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetRepoRuleSuiteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetRepoRulesetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ruleset_id: z.coerce.number(), + }) + + const reposGetRepoRulesetQuerySchema = z.object({ + includes_parents: PermissiveBoolean.optional().default(true), + }) + + const reposGetRepoRulesetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_repository_ruleset], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetRepoRuleset + router.get( + `/repos/:owner/:repo/rulesets/:ruleset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetRepoRulesetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetRepoRulesetQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetRepoRuleset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetRepoRulesetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposUpdateRepoRulesetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ruleset_id: z.coerce.number(), + }) + + const reposUpdateRepoRulesetRequestBodySchema = z + .object({ + name: z.string().optional(), + target: z.enum(["branch", "tag", "push"]).optional(), + enforcement: s_repository_rule_enforcement.optional(), + bypass_actors: z.array(s_repository_ruleset_bypass_actor).optional(), + conditions: s_repository_ruleset_conditions.optional(), + rules: z.array(s_repository_rule).optional(), + }) + .optional() + + const reposUpdateRepoRulesetResponseBodyValidator = responseValidationFactory( + [ + ["200", s_repository_ruleset], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposUpdateRepoRuleset + router.put( + `/repos/:owner/:repo/rulesets/:ruleset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposUpdateRepoRulesetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposUpdateRepoRulesetRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposUpdateRepoRuleset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposUpdateRepoRulesetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteRepoRulesetParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ruleset_id: z.coerce.number(), + }) + + const reposDeleteRepoRulesetResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposDeleteRepoRuleset + router.delete( + `/repos/:owner/:repo/rulesets/:ruleset_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteRepoRulesetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteRepoRuleset(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteRepoRulesetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetRepoRulesetHistoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ruleset_id: z.coerce.number(), + }) + + const reposGetRepoRulesetHistoryQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposGetRepoRulesetHistoryResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_ruleset_version)], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetRepoRulesetHistory + router.get( + `/repos/:owner/:repo/rulesets/:ruleset_id/history`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetRepoRulesetHistoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetRepoRulesetHistoryQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetRepoRulesetHistory(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetRepoRulesetHistoryResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetRepoRulesetVersionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ruleset_id: z.coerce.number(), + version_id: z.coerce.number(), + }) + + const reposGetRepoRulesetVersionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_ruleset_version_with_state], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // reposGetRepoRulesetVersion + router.get( + `/repos/:owner/:repo/rulesets/:ruleset_id/history/:version_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetRepoRulesetVersionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetRepoRulesetVersion(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetRepoRulesetVersionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const secretScanningListAlertsForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const secretScanningListAlertsForRepoQuerySchema = z.object({ + state: z.enum(["open", "resolved"]).optional(), + secret_type: z.string().optional(), + resolution: z.string().optional(), + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + validity: z.string().optional(), + is_publicly_leaked: PermissiveBoolean.optional().default(false), + is_multi_repo: PermissiveBoolean.optional().default(false), + }) + + const secretScanningListAlertsForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_secret_scanning_alert)], + ["404", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // secretScanningListAlertsForRepo + router.get( + `/repos/:owner/:repo/secret-scanning/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + secretScanningListAlertsForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + secretScanningListAlertsForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .secretScanningListAlertsForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + secretScanningListAlertsForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const secretScanningGetAlertParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const secretScanningGetAlertResponseBodyValidator = responseValidationFactory( + [ + ["200", s_secret_scanning_alert], + ["304", z.undefined()], + ["404", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // secretScanningGetAlert + router.get( + `/repos/:owner/:repo/secret-scanning/alerts/:alert_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + secretScanningGetAlertParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .secretScanningGetAlert(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(secretScanningGetAlertResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const secretScanningUpdateAlertParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const secretScanningUpdateAlertRequestBodySchema = z.object({ + state: s_secret_scanning_alert_state, + resolution: s_secret_scanning_alert_resolution.optional(), + resolution_comment: s_secret_scanning_alert_resolution_comment.optional(), + }) + + const secretScanningUpdateAlertResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_secret_scanning_alert], + ["400", z.undefined()], + ["404", z.undefined()], + ["422", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // secretScanningUpdateAlert + router.patch( + `/repos/:owner/:repo/secret-scanning/alerts/:alert_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + secretScanningUpdateAlertParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + secretScanningUpdateAlertRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .secretScanningUpdateAlert(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(secretScanningUpdateAlertResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const secretScanningListLocationsForAlertParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + alert_number: s_alert_number, + }) + + const secretScanningListLocationsForAlertQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const secretScanningListLocationsForAlertResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_secret_scanning_location)], + ["404", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // secretScanningListLocationsForAlert + router.get( + `/repos/:owner/:repo/secret-scanning/alerts/:alert_number/locations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + secretScanningListLocationsForAlertParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + secretScanningListLocationsForAlertQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .secretScanningListLocationsForAlert(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + secretScanningListLocationsForAlertResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const secretScanningCreatePushProtectionBypassParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const secretScanningCreatePushProtectionBypassRequestBodySchema = z.object({ + reason: s_secret_scanning_push_protection_bypass_reason, + placeholder_id: s_secret_scanning_push_protection_bypass_placeholder_id, + }) + + const secretScanningCreatePushProtectionBypassResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_secret_scanning_push_protection_bypass], + ["403", z.undefined()], + ["404", z.undefined()], + ["422", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // secretScanningCreatePushProtectionBypass + router.post( + `/repos/:owner/:repo/secret-scanning/push-protection-bypasses`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + secretScanningCreatePushProtectionBypassParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + secretScanningCreatePushProtectionBypassRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .secretScanningCreatePushProtectionBypass( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + secretScanningCreatePushProtectionBypassResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const secretScanningGetScanHistoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const secretScanningGetScanHistoryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_secret_scanning_scan_history], + ["404", z.undefined()], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // secretScanningGetScanHistory + router.get( + `/repos/:owner/:repo/secret-scanning/scan-history`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + secretScanningGetScanHistoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .secretScanningGetScanHistory(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + secretScanningGetScanHistoryResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesListRepositoryAdvisoriesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const securityAdvisoriesListRepositoryAdvisoriesQuerySchema = z.object({ + direction: z.enum(["asc", "desc"]).optional().default("desc"), + sort: z + .enum(["created", "updated", "published"]) + .optional() + .default("created"), + before: z.string().optional(), + after: z.string().optional(), + per_page: z.coerce.number().min(1).max(100).optional().default(30), + state: z.enum(["triage", "draft", "published", "closed"]).optional(), + }) + + const securityAdvisoriesListRepositoryAdvisoriesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_repository_advisory)], + ["400", s_scim_error], + ["404", s_basic_error], + ], + undefined, + ) + + // securityAdvisoriesListRepositoryAdvisories + router.get( + `/repos/:owner/:repo/security-advisories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesListRepositoryAdvisoriesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + securityAdvisoriesListRepositoryAdvisoriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesListRepositoryAdvisories( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesListRepositoryAdvisoriesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesCreateRepositoryAdvisoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const securityAdvisoriesCreateRepositoryAdvisoryRequestBodySchema = + s_repository_advisory_create + + const securityAdvisoriesCreateRepositoryAdvisoryResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_repository_advisory], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // securityAdvisoriesCreateRepositoryAdvisory + router.post( + `/repos/:owner/:repo/security-advisories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesCreateRepositoryAdvisoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + securityAdvisoriesCreateRepositoryAdvisoryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesCreateRepositoryAdvisory( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesCreateRepositoryAdvisoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesCreatePrivateVulnerabilityReportParamSchema = + z.object({ owner: z.string(), repo: z.string() }) + + const securityAdvisoriesCreatePrivateVulnerabilityReportRequestBodySchema = + s_private_vulnerability_report_create + + const securityAdvisoriesCreatePrivateVulnerabilityReportResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_repository_advisory], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // securityAdvisoriesCreatePrivateVulnerabilityReport + router.post( + `/repos/:owner/:repo/security-advisories/reports`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesCreatePrivateVulnerabilityReportParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + securityAdvisoriesCreatePrivateVulnerabilityReportRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesCreatePrivateVulnerabilityReport( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesCreatePrivateVulnerabilityReportResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesGetRepositoryAdvisoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ghsa_id: z.string(), + }) + + const securityAdvisoriesGetRepositoryAdvisoryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_repository_advisory], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // securityAdvisoriesGetRepositoryAdvisory + router.get( + `/repos/:owner/:repo/security-advisories/:ghsa_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesGetRepositoryAdvisoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesGetRepositoryAdvisory( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesGetRepositoryAdvisoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesUpdateRepositoryAdvisoryParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ghsa_id: z.string(), + }) + + const securityAdvisoriesUpdateRepositoryAdvisoryRequestBodySchema = + s_repository_advisory_update + + const securityAdvisoriesUpdateRepositoryAdvisoryResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_repository_advisory], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // securityAdvisoriesUpdateRepositoryAdvisory + router.patch( + `/repos/:owner/:repo/security-advisories/:ghsa_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesUpdateRepositoryAdvisoryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + securityAdvisoriesUpdateRepositoryAdvisoryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesUpdateRepositoryAdvisory( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesUpdateRepositoryAdvisoryResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesCreateRepositoryAdvisoryCveRequestParamSchema = + z.object({ owner: z.string(), repo: z.string(), ghsa_id: z.string() }) + + const securityAdvisoriesCreateRepositoryAdvisoryCveRequestResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // securityAdvisoriesCreateRepositoryAdvisoryCveRequest + router.post( + `/repos/:owner/:repo/security-advisories/:ghsa_id/cve`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesCreateRepositoryAdvisoryCveRequestParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesCreateRepositoryAdvisoryCveRequest( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesCreateRepositoryAdvisoryCveRequestResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const securityAdvisoriesCreateForkParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ghsa_id: z.string(), + }) + + const securityAdvisoriesCreateForkResponseBodyValidator = + responseValidationFactory( + [ + ["202", s_full_repository], + ["400", s_scim_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // securityAdvisoriesCreateFork + router.post( + `/repos/:owner/:repo/security-advisories/:ghsa_id/forks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + securityAdvisoriesCreateForkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .securityAdvisoriesCreateFork(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + securityAdvisoriesCreateForkResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListStargazersForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityListStargazersForRepoQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListStargazersForRepoResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.union([z.array(s_simple_user), z.array(s_stargazer)])], + ["422", s_validation_error], + ], + undefined, + ) + + // activityListStargazersForRepo + router.get( + `/repos/:owner/:repo/stargazers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListStargazersForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListStargazersForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListStargazersForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListStargazersForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCodeFrequencyStatsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetCodeFrequencyStatsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_code_frequency_stat)], + ["202", z.record(z.unknown())], + ["204", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // reposGetCodeFrequencyStats + router.get( + `/repos/:owner/:repo/stats/code_frequency`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCodeFrequencyStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCodeFrequencyStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetCodeFrequencyStatsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetCommitActivityStatsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetCommitActivityStatsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_commit_activity)], + ["202", z.record(z.unknown())], + ["204", z.undefined()], + ], + undefined, + ) + + // reposGetCommitActivityStats + router.get( + `/repos/:owner/:repo/stats/commit_activity`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetCommitActivityStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetCommitActivityStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetCommitActivityStatsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetContributorsStatsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetContributorsStatsResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_contributor_activity)], + ["202", z.record(z.unknown())], + ["204", z.undefined()], + ], + undefined, + ) + + // reposGetContributorsStats + router.get( + `/repos/:owner/:repo/stats/contributors`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetContributorsStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetContributorsStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetContributorsStatsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetParticipationStatsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetParticipationStatsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_participation_stats], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetParticipationStats + router.get( + `/repos/:owner/:repo/stats/participation`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetParticipationStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetParticipationStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposGetParticipationStatsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetPunchCardStatsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetPunchCardStatsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_code_frequency_stat)], + ["204", z.undefined()], + ], + undefined, + ) + + // reposGetPunchCardStats + router.get( + `/repos/:owner/:repo/stats/punch_card`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetPunchCardStatsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetPunchCardStats(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetPunchCardStatsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateCommitStatusParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + sha: z.string(), + }) + + const reposCreateCommitStatusRequestBodySchema = z.object({ + state: z.enum(["error", "failure", "pending", "success"]), + target_url: z.string().nullable().optional(), + description: z.string().nullable().optional(), + context: z.string().optional().default("default"), + }) + + const reposCreateCommitStatusResponseBodyValidator = + responseValidationFactory([["201", s_status]], undefined) + + // reposCreateCommitStatus + router.post( + `/repos/:owner/:repo/statuses/:sha`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateCommitStatusParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateCommitStatusRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateCommitStatus(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateCommitStatusResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListWatchersForRepoParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityListWatchersForRepoQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListWatchersForRepoResponseBodyValidator = + responseValidationFactory([["200", z.array(s_simple_user)]], undefined) + + // activityListWatchersForRepo + router.get( + `/repos/:owner/:repo/subscribers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListWatchersForRepoParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListWatchersForRepoQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListWatchersForRepo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListWatchersForRepoResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityGetRepoSubscriptionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityGetRepoSubscriptionResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_repository_subscription], + ["403", s_basic_error], + ["404", z.undefined()], + ], + undefined, + ) + + // activityGetRepoSubscription + router.get( + `/repos/:owner/:repo/subscription`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityGetRepoSubscriptionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityGetRepoSubscription(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityGetRepoSubscriptionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activitySetRepoSubscriptionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activitySetRepoSubscriptionRequestBodySchema = z + .object({ + subscribed: PermissiveBoolean.optional(), + ignored: PermissiveBoolean.optional(), + }) + .optional() + + const activitySetRepoSubscriptionResponseBodyValidator = + responseValidationFactory([["200", s_repository_subscription]], undefined) + + // activitySetRepoSubscription + router.put( + `/repos/:owner/:repo/subscription`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activitySetRepoSubscriptionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + activitySetRepoSubscriptionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activitySetRepoSubscription(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activitySetRepoSubscriptionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityDeleteRepoSubscriptionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityDeleteRepoSubscriptionResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // activityDeleteRepoSubscription + router.delete( + `/repos/:owner/:repo/subscription`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityDeleteRepoSubscriptionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityDeleteRepoSubscription(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityDeleteRepoSubscriptionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListTagsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListTagsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListTagsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_tag)]], + undefined, + ) + + // reposListTags + router.get( + `/repos/:owner/:repo/tags`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListTagsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListTagsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListTags(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListTagsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListTagProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListTagProtectionResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_tag_protection)], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListTagProtection + router.get( + `/repos/:owner/:repo/tags/protection`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListTagProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListTagProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListTagProtectionResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateTagProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCreateTagProtectionRequestBodySchema = z.object({ + pattern: z.string(), + }) + + const reposCreateTagProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_tag_protection], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposCreateTagProtection + router.post( + `/repos/:owner/:repo/tags/protection`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateTagProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateTagProtectionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateTagProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateTagProtectionResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeleteTagProtectionParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + tag_protection_id: z.coerce.number(), + }) + + const reposDeleteTagProtectionResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposDeleteTagProtection + router.delete( + `/repos/:owner/:repo/tags/protection/:tag_protection_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeleteTagProtectionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeleteTagProtection(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposDeleteTagProtectionResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDownloadTarballArchiveParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const reposDownloadTarballArchiveResponseBodyValidator = + responseValidationFactory([["302", z.undefined()]], undefined) + + // reposDownloadTarballArchive + router.get( + `/repos/:owner/:repo/tarball/:ref`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDownloadTarballArchiveParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with302() { + return new ExpressRuntimeResponse(302) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDownloadTarballArchive(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDownloadTarballArchiveResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListTeamsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposListTeamsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListTeamsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_team)], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListTeams + router.get( + `/repos/:owner/:repo/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListTeamsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListTeamsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListTeams(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListTeamsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetAllTopicsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetAllTopicsQuerySchema = z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const reposGetAllTopicsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_topic], + ["404", s_basic_error], + ], + undefined, + ) + + // reposGetAllTopics + router.get( + `/repos/:owner/:repo/topics`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetAllTopicsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetAllTopicsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetAllTopics(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetAllTopicsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposReplaceAllTopicsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposReplaceAllTopicsRequestBodySchema = z.object({ + names: z.array(z.string()), + }) + + const reposReplaceAllTopicsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_topic], + ["404", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // reposReplaceAllTopics + router.put( + `/repos/:owner/:repo/topics`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposReplaceAllTopicsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposReplaceAllTopicsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposReplaceAllTopics(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposReplaceAllTopicsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetClonesParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetClonesQuerySchema = z.object({ + per: z.enum(["day", "week"]).optional().default("day"), + }) + + const reposGetClonesResponseBodyValidator = responseValidationFactory( + [ + ["200", s_clone_traffic], + ["403", s_basic_error], + ], + undefined, + ) + + // reposGetClones + router.get( + `/repos/:owner/:repo/traffic/clones`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetClonesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetClonesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetClones(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetClonesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetTopPathsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetTopPathsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_content_traffic)], + ["403", s_basic_error], + ], + undefined, + ) + + // reposGetTopPaths + router.get( + `/repos/:owner/:repo/traffic/popular/paths`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetTopPathsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetTopPaths(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetTopPathsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetTopReferrersParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetTopReferrersResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_referrer_traffic)], + ["403", s_basic_error], + ], + undefined, + ) + + // reposGetTopReferrers + router.get( + `/repos/:owner/:repo/traffic/popular/referrers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetTopReferrersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetTopReferrers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetTopReferrersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposGetViewsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposGetViewsQuerySchema = z.object({ + per: z.enum(["day", "week"]).optional().default("day"), + }) + + const reposGetViewsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_view_traffic], + ["403", s_basic_error], + ], + undefined, + ) + + // reposGetViews + router.get( + `/repos/:owner/:repo/traffic/views`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposGetViewsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposGetViewsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposGetViews(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposGetViewsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposTransferParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposTransferRequestBodySchema = z.object({ + new_owner: z.string(), + new_name: z.string().optional(), + team_ids: z.array(z.coerce.number()).optional(), + }) + + const reposTransferResponseBodyValidator = responseValidationFactory( + [["202", s_minimal_repository]], + undefined, + ) + + // reposTransfer + router.post( + `/repos/:owner/:repo/transfer`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposTransferParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposTransferRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposTransfer(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposTransferResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCheckVulnerabilityAlertsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposCheckVulnerabilityAlertsResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // reposCheckVulnerabilityAlerts + router.get( + `/repos/:owner/:repo/vulnerability-alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCheckVulnerabilityAlertsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCheckVulnerabilityAlerts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCheckVulnerabilityAlertsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposEnableVulnerabilityAlertsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposEnableVulnerabilityAlertsResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposEnableVulnerabilityAlerts + router.put( + `/repos/:owner/:repo/vulnerability-alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposEnableVulnerabilityAlertsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposEnableVulnerabilityAlerts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposEnableVulnerabilityAlertsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDisableVulnerabilityAlertsParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const reposDisableVulnerabilityAlertsResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // reposDisableVulnerabilityAlerts + router.delete( + `/repos/:owner/:repo/vulnerability-alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDisableVulnerabilityAlertsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDisableVulnerabilityAlerts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDisableVulnerabilityAlertsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDownloadZipballArchiveParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + ref: z.string(), + }) + + const reposDownloadZipballArchiveResponseBodyValidator = + responseValidationFactory([["302", z.undefined()]], undefined) + + // reposDownloadZipballArchive + router.get( + `/repos/:owner/:repo/zipball/:ref`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDownloadZipballArchiveParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with302() { + return new ExpressRuntimeResponse(302) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDownloadZipballArchive(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDownloadZipballArchiveResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateUsingTemplateParamSchema = z.object({ + template_owner: z.string(), + template_repo: z.string(), + }) + + const reposCreateUsingTemplateRequestBodySchema = z.object({ + owner: z.string().optional(), + name: z.string(), + description: z.string().optional(), + include_all_branches: PermissiveBoolean.optional().default(false), + private: PermissiveBoolean.optional().default(false), + }) + + const reposCreateUsingTemplateResponseBodyValidator = + responseValidationFactory([["201", s_full_repository]], undefined) + + // reposCreateUsingTemplate + router.post( + `/repos/:template_owner/:template_repo/generate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposCreateUsingTemplateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reposCreateUsingTemplateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateUsingTemplate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposCreateUsingTemplateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListPublicQuerySchema = z.object({ + since: z.coerce.number().optional(), + }) + + const reposListPublicResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_minimal_repository)], + ["304", z.undefined()], + ["422", s_validation_error], + ], + undefined, + ) + + // reposListPublic + router.get( + `/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + reposListPublicQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListPublic(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListPublicResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const searchCodeQuerySchema = z.object({ + q: z.string(), + sort: z.enum(["indexed"]).optional(), + order: z.enum(["desc", "asc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const searchCodeResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + incomplete_results: PermissiveBoolean, + items: z.array(s_code_search_result_item), + }), + ], + ["304", z.undefined()], + ["403", s_basic_error], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // searchCode + router.get( + `/search/code`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + searchCodeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_code_search_result_item[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .searchCode(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(searchCodeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const searchCommitsQuerySchema = z.object({ + q: z.string(), + sort: z.enum(["author-date", "committer-date"]).optional(), + order: z.enum(["desc", "asc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const searchCommitsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + incomplete_results: PermissiveBoolean, + items: z.array(s_commit_search_result_item), + }), + ], + ["304", z.undefined()], + ], + undefined, + ) + + // searchCommits + router.get( + `/search/commits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + searchCommitsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_commit_search_result_item[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .searchCommits(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(searchCommitsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const searchIssuesAndPullRequestsQuerySchema = z.object({ + q: z.string(), + sort: z + .enum([ + "comments", + "reactions", + "reactions-+1", + "reactions--1", + "reactions-smile", + "reactions-thinking_face", + "reactions-heart", + "reactions-tada", + "interactions", + "created", + "updated", + ]) + .optional(), + order: z.enum(["desc", "asc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + advanced_search: z.string().optional(), + }) + + const searchIssuesAndPullRequestsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + incomplete_results: PermissiveBoolean, + items: z.array(s_issue_search_result_item), + }), + ], + ["304", z.undefined()], + ["403", s_basic_error], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // searchIssuesAndPullRequests + router.get( + `/search/issues`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + searchIssuesAndPullRequestsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_issue_search_result_item[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .searchIssuesAndPullRequests(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + searchIssuesAndPullRequestsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const searchLabelsQuerySchema = z.object({ + repository_id: z.coerce.number(), + q: z.string(), + sort: z.enum(["created", "updated"]).optional(), + order: z.enum(["desc", "asc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const searchLabelsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + incomplete_results: PermissiveBoolean, + items: z.array(s_label_search_result_item), + }), + ], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // searchLabels + router.get( + `/search/labels`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + searchLabelsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_label_search_result_item[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .searchLabels(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(searchLabelsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const searchReposQuerySchema = z.object({ + q: z.string(), + sort: z + .enum(["stars", "forks", "help-wanted-issues", "updated"]) + .optional(), + order: z.enum(["desc", "asc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const searchReposResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + incomplete_results: PermissiveBoolean, + items: z.array(s_repo_search_result_item), + }), + ], + ["304", z.undefined()], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // searchRepos + router.get( + `/search/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + searchReposQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_repo_search_result_item[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .searchRepos(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(searchReposResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const searchTopicsQuerySchema = z.object({ + q: z.string(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const searchTopicsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + incomplete_results: PermissiveBoolean, + items: z.array(s_topic_search_result_item), + }), + ], + ["304", z.undefined()], + ], + undefined, + ) + + // searchTopics + router.get( + `/search/topics`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + searchTopicsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_topic_search_result_item[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .searchTopics(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(searchTopicsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const searchUsersQuerySchema = z.object({ + q: z.string(), + sort: z.enum(["followers", "repositories", "joined"]).optional(), + order: z.enum(["desc", "asc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const searchUsersResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + incomplete_results: PermissiveBoolean, + items: z.array(s_user_search_result_item), + }), + ], + ["304", z.undefined()], + ["422", s_validation_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // searchUsers + router.get( + `/search/users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + searchUsersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + incomplete_results: boolean + items: t_user_search_result_item[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .searchUsers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(searchUsersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetLegacyParamSchema = z.object({ team_id: z.coerce.number() }) + + const teamsGetLegacyResponseBodyValidator = responseValidationFactory( + [ + ["200", s_team_full], + ["404", s_basic_error], + ], + undefined, + ) + + // teamsGetLegacy + router.get( + `/teams/:team_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsGetLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsUpdateLegacyParamSchema = z.object({ team_id: z.coerce.number() }) + + const teamsUpdateLegacyRequestBodySchema = z.object({ + name: z.string(), + description: z.string().optional(), + privacy: z.enum(["secret", "closed"]).optional(), + notification_setting: z + .enum(["notifications_enabled", "notifications_disabled"]) + .optional(), + permission: z.enum(["pull", "push", "admin"]).optional().default("pull"), + parent_team_id: z.coerce.number().nullable().optional(), + }) + + const teamsUpdateLegacyResponseBodyValidator = responseValidationFactory( + [ + ["200", s_team_full], + ["201", s_team_full], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // teamsUpdateLegacy + router.patch( + `/teams/:team_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsUpdateLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsUpdateLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsUpdateLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsUpdateLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsDeleteLegacyParamSchema = z.object({ team_id: z.coerce.number() }) + + const teamsDeleteLegacyResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // teamsDeleteLegacy + router.delete( + `/teams/:team_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsDeleteLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsDeleteLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsDeleteLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListDiscussionsLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + }) + + const teamsListDiscussionsLegacyQuerySchema = z.object({ + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListDiscussionsLegacyResponseBodyValidator = + responseValidationFactory([["200", z.array(s_team_discussion)]], undefined) + + // teamsListDiscussionsLegacy + router.get( + `/teams/:team_id/discussions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListDiscussionsLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListDiscussionsLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListDiscussionsLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsListDiscussionsLegacyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCreateDiscussionLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + }) + + const teamsCreateDiscussionLegacyRequestBodySchema = z.object({ + title: z.string(), + body: z.string(), + private: PermissiveBoolean.optional().default(false), + }) + + const teamsCreateDiscussionLegacyResponseBodyValidator = + responseValidationFactory([["201", s_team_discussion]], undefined) + + // teamsCreateDiscussionLegacy + router.post( + `/teams/:team_id/discussions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCreateDiscussionLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsCreateDiscussionLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCreateDiscussionLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsCreateDiscussionLegacyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetDiscussionLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + }) + + const teamsGetDiscussionLegacyResponseBodyValidator = + responseValidationFactory([["200", s_team_discussion]], undefined) + + // teamsGetDiscussionLegacy + router.get( + `/teams/:team_id/discussions/:discussion_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetDiscussionLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetDiscussionLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsGetDiscussionLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsUpdateDiscussionLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + }) + + const teamsUpdateDiscussionLegacyRequestBodySchema = z + .object({ title: z.string().optional(), body: z.string().optional() }) + .optional() + + const teamsUpdateDiscussionLegacyResponseBodyValidator = + responseValidationFactory([["200", s_team_discussion]], undefined) + + // teamsUpdateDiscussionLegacy + router.patch( + `/teams/:team_id/discussions/:discussion_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsUpdateDiscussionLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsUpdateDiscussionLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsUpdateDiscussionLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsUpdateDiscussionLegacyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsDeleteDiscussionLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + }) + + const teamsDeleteDiscussionLegacyResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // teamsDeleteDiscussionLegacy + router.delete( + `/teams/:team_id/discussions/:discussion_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsDeleteDiscussionLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsDeleteDiscussionLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsDeleteDiscussionLegacyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListDiscussionCommentsLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + }) + + const teamsListDiscussionCommentsLegacyQuerySchema = z.object({ + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListDiscussionCommentsLegacyResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_team_discussion_comment)]], + undefined, + ) + + // teamsListDiscussionCommentsLegacy + router.get( + `/teams/:team_id/discussions/:discussion_number/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListDiscussionCommentsLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListDiscussionCommentsLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListDiscussionCommentsLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsListDiscussionCommentsLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCreateDiscussionCommentLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + }) + + const teamsCreateDiscussionCommentLegacyRequestBodySchema = z.object({ + body: z.string(), + }) + + const teamsCreateDiscussionCommentLegacyResponseBodyValidator = + responseValidationFactory([["201", s_team_discussion_comment]], undefined) + + // teamsCreateDiscussionCommentLegacy + router.post( + `/teams/:team_id/discussions/:discussion_number/comments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCreateDiscussionCommentLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsCreateDiscussionCommentLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCreateDiscussionCommentLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsCreateDiscussionCommentLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetDiscussionCommentLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const teamsGetDiscussionCommentLegacyResponseBodyValidator = + responseValidationFactory([["200", s_team_discussion_comment]], undefined) + + // teamsGetDiscussionCommentLegacy + router.get( + `/teams/:team_id/discussions/:discussion_number/comments/:comment_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetDiscussionCommentLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetDiscussionCommentLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsGetDiscussionCommentLegacyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsUpdateDiscussionCommentLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const teamsUpdateDiscussionCommentLegacyRequestBodySchema = z.object({ + body: z.string(), + }) + + const teamsUpdateDiscussionCommentLegacyResponseBodyValidator = + responseValidationFactory([["200", s_team_discussion_comment]], undefined) + + // teamsUpdateDiscussionCommentLegacy + router.patch( + `/teams/:team_id/discussions/:discussion_number/comments/:comment_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsUpdateDiscussionCommentLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsUpdateDiscussionCommentLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsUpdateDiscussionCommentLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsUpdateDiscussionCommentLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsDeleteDiscussionCommentLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const teamsDeleteDiscussionCommentLegacyResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // teamsDeleteDiscussionCommentLegacy + router.delete( + `/teams/:team_id/discussions/:discussion_number/comments/:comment_number`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsDeleteDiscussionCommentLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsDeleteDiscussionCommentLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsDeleteDiscussionCommentLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForTeamDiscussionCommentLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const reactionsListForTeamDiscussionCommentLegacyQuerySchema = z.object({ + content: z + .enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForTeamDiscussionCommentLegacyResponseBodyValidator = + responseValidationFactory([["200", z.array(s_reaction)]], undefined) + + // reactionsListForTeamDiscussionCommentLegacy + router.get( + `/teams/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForTeamDiscussionCommentLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForTeamDiscussionCommentLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForTeamDiscussionCommentLegacy( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsListForTeamDiscussionCommentLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForTeamDiscussionCommentLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + comment_number: z.coerce.number(), + }) + + const reactionsCreateForTeamDiscussionCommentLegacyRequestBodySchema = + z.object({ + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + }) + + const reactionsCreateForTeamDiscussionCommentLegacyResponseBodyValidator = + responseValidationFactory([["201", s_reaction]], undefined) + + // reactionsCreateForTeamDiscussionCommentLegacy + router.post( + `/teams/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForTeamDiscussionCommentLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForTeamDiscussionCommentLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForTeamDiscussionCommentLegacy( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsCreateForTeamDiscussionCommentLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsListForTeamDiscussionLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + }) + + const reactionsListForTeamDiscussionLegacyQuerySchema = z.object({ + content: z + .enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]) + .optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reactionsListForTeamDiscussionLegacyResponseBodyValidator = + responseValidationFactory([["200", z.array(s_reaction)]], undefined) + + // reactionsListForTeamDiscussionLegacy + router.get( + `/teams/:team_id/discussions/:discussion_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsListForTeamDiscussionLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reactionsListForTeamDiscussionLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsListForTeamDiscussionLegacy( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsListForTeamDiscussionLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reactionsCreateForTeamDiscussionLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + discussion_number: z.coerce.number(), + }) + + const reactionsCreateForTeamDiscussionLegacyRequestBodySchema = z.object({ + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + }) + + const reactionsCreateForTeamDiscussionLegacyResponseBodyValidator = + responseValidationFactory([["201", s_reaction]], undefined) + + // reactionsCreateForTeamDiscussionLegacy + router.post( + `/teams/:team_id/discussions/:discussion_number/reactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reactionsCreateForTeamDiscussionLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + reactionsCreateForTeamDiscussionLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reactionsCreateForTeamDiscussionLegacy( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reactionsCreateForTeamDiscussionLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListPendingInvitationsLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + }) + + const teamsListPendingInvitationsLegacyQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListPendingInvitationsLegacyResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_organization_invitation)]], + undefined, + ) + + // teamsListPendingInvitationsLegacy + router.get( + `/teams/:team_id/invitations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListPendingInvitationsLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListPendingInvitationsLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListPendingInvitationsLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsListPendingInvitationsLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListMembersLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + }) + + const teamsListMembersLegacyQuerySchema = z.object({ + role: z.enum(["member", "maintainer", "all"]).optional().default("all"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListMembersLegacyResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["404", s_basic_error], + ], + undefined, + ) + + // teamsListMembersLegacy + router.get( + `/teams/:team_id/members`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListMembersLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListMembersLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListMembersLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListMembersLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetMemberLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + username: z.string(), + }) + + const teamsGetMemberLegacyResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // teamsGetMemberLegacy + router.get( + `/teams/:team_id/members/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetMemberLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetMemberLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsGetMemberLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsAddMemberLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + username: z.string(), + }) + + const teamsAddMemberLegacyResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["404", z.undefined()], + ["422", z.undefined()], + ], + undefined, + ) + + // teamsAddMemberLegacy + router.put( + `/teams/:team_id/members/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsAddMemberLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsAddMemberLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsAddMemberLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsRemoveMemberLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + username: z.string(), + }) + + const teamsRemoveMemberLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // teamsRemoveMemberLegacy + router.delete( + `/teams/:team_id/members/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsRemoveMemberLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsRemoveMemberLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsRemoveMemberLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsGetMembershipForUserLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + username: z.string(), + }) + + const teamsGetMembershipForUserLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_team_membership], + ["404", s_basic_error], + ], + undefined, + ) + + // teamsGetMembershipForUserLegacy + router.get( + `/teams/:team_id/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsGetMembershipForUserLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsGetMembershipForUserLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsGetMembershipForUserLegacyResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsAddOrUpdateMembershipForUserLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + username: z.string(), + }) + + const teamsAddOrUpdateMembershipForUserLegacyRequestBodySchema = z + .object({ + role: z.enum(["member", "maintainer"]).optional().default("member"), + }) + .optional() + + const teamsAddOrUpdateMembershipForUserLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_team_membership], + ["403", z.undefined()], + ["404", s_basic_error], + ["422", z.undefined()], + ], + undefined, + ) + + // teamsAddOrUpdateMembershipForUserLegacy + router.put( + `/teams/:team_id/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsAddOrUpdateMembershipForUserLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsAddOrUpdateMembershipForUserLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsAddOrUpdateMembershipForUserLegacy( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsAddOrUpdateMembershipForUserLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsRemoveMembershipForUserLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + username: z.string(), + }) + + const teamsRemoveMembershipForUserLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", z.undefined()], + ], + undefined, + ) + + // teamsRemoveMembershipForUserLegacy + router.delete( + `/teams/:team_id/memberships/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsRemoveMembershipForUserLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsRemoveMembershipForUserLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsRemoveMembershipForUserLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListProjectsLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + }) + + const teamsListProjectsLegacyQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListProjectsLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_team_project)], + ["404", s_basic_error], + ], + undefined, + ) + + // teamsListProjectsLegacy + router.get( + `/teams/:team_id/projects`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListProjectsLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListProjectsLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListProjectsLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListProjectsLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCheckPermissionsForProjectLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + project_id: z.coerce.number(), + }) + + const teamsCheckPermissionsForProjectLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_team_project], + ["404", z.undefined()], + ], + undefined, + ) + + // teamsCheckPermissionsForProjectLegacy + router.get( + `/teams/:team_id/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCheckPermissionsForProjectLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCheckPermissionsForProjectLegacy( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsCheckPermissionsForProjectLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsAddOrUpdateProjectPermissionsLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + project_id: z.coerce.number(), + }) + + const teamsAddOrUpdateProjectPermissionsLegacyRequestBodySchema = z + .object({ permission: z.enum(["read", "write", "admin"]).optional() }) + .optional() + + const teamsAddOrUpdateProjectPermissionsLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + [ + "403", + z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // teamsAddOrUpdateProjectPermissionsLegacy + router.put( + `/teams/:team_id/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsAddOrUpdateProjectPermissionsLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsAddOrUpdateProjectPermissionsLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse<{ + documentation_url?: string | undefined + message?: string | undefined + }>(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsAddOrUpdateProjectPermissionsLegacy( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsAddOrUpdateProjectPermissionsLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsRemoveProjectLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + project_id: z.coerce.number(), + }) + + const teamsRemoveProjectLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // teamsRemoveProjectLegacy + router.delete( + `/teams/:team_id/projects/:project_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsRemoveProjectLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsRemoveProjectLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsRemoveProjectLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListReposLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + }) + + const teamsListReposLegacyQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListReposLegacyResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_minimal_repository)], + ["404", s_basic_error], + ], + undefined, + ) + + // teamsListReposLegacy + router.get( + `/teams/:team_id/repos`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListReposLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListReposLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListReposLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListReposLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsCheckPermissionsForRepoLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + owner: z.string(), + repo: z.string(), + }) + + const teamsCheckPermissionsForRepoLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_team_repository], + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // teamsCheckPermissionsForRepoLegacy + router.get( + `/teams/:team_id/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsCheckPermissionsForRepoLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsCheckPermissionsForRepoLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsCheckPermissionsForRepoLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsAddOrUpdateRepoPermissionsLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + owner: z.string(), + repo: z.string(), + }) + + const teamsAddOrUpdateRepoPermissionsLegacyRequestBodySchema = z + .object({ permission: z.enum(["pull", "push", "admin"]).optional() }) + .optional() + + const teamsAddOrUpdateRepoPermissionsLegacyResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // teamsAddOrUpdateRepoPermissionsLegacy + router.put( + `/teams/:team_id/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsAddOrUpdateRepoPermissionsLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + teamsAddOrUpdateRepoPermissionsLegacyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsAddOrUpdateRepoPermissionsLegacy( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsAddOrUpdateRepoPermissionsLegacyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsRemoveRepoLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + owner: z.string(), + repo: z.string(), + }) + + const teamsRemoveRepoLegacyResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // teamsRemoveRepoLegacy + router.delete( + `/teams/:team_id/repos/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsRemoveRepoLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsRemoveRepoLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsRemoveRepoLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListChildLegacyParamSchema = z.object({ + team_id: z.coerce.number(), + }) + + const teamsListChildLegacyQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListChildLegacyResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_team)], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // teamsListChildLegacy + router.get( + `/teams/:team_id/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + teamsListChildLegacyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + teamsListChildLegacyQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListChildLegacy(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(teamsListChildLegacyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersGetAuthenticatedResponseBodyValidator = responseValidationFactory( + [ + ["200", z.union([s_private_user, s_public_user])], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // usersGetAuthenticated + router.get( + `/user`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersGetAuthenticated(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersGetAuthenticatedResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersUpdateAuthenticatedRequestBodySchema = z + .object({ + name: z.string().optional(), + email: z.string().optional(), + blog: z.string().optional(), + twitter_username: z.string().nullable().optional(), + company: z.string().optional(), + location: z.string().optional(), + hireable: PermissiveBoolean.optional(), + bio: z.string().optional(), + }) + .optional() + + const usersUpdateAuthenticatedResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_private_user], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersUpdateAuthenticated + router.patch( + `/user`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersUpdateAuthenticatedRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersUpdateAuthenticated(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersUpdateAuthenticatedResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListBlockedByAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListBlockedByAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersListBlockedByAuthenticatedUser + router.get( + `/user/blocks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListBlockedByAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListBlockedByAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListBlockedByAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersCheckBlockedParamSchema = z.object({ username: z.string() }) + + const usersCheckBlockedResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersCheckBlocked + router.get( + `/user/blocks/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersCheckBlockedParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersCheckBlocked(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersCheckBlockedResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersBlockParamSchema = z.object({ username: z.string() }) + + const usersBlockResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersBlock + router.put( + `/user/blocks/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersBlockParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersBlock(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersBlockResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersUnblockParamSchema = z.object({ username: z.string() }) + + const usersUnblockResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersUnblock + router.delete( + `/user/blocks/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersUnblockParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersUnblock(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersUnblockResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + repository_id: z.coerce.number().optional(), + }) + + const codespacesListForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + codespaces: z.array(s_codespace), + }), + ], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesListForAuthenticatedUser + router.get( + `/user/codespaces`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + codespacesListForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + codespaces: t_codespace[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesListForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesCreateForAuthenticatedUserRequestBodySchema = z.union([ + z.object({ + repository_id: z.coerce.number(), + ref: z.string().optional(), + location: z.string().optional(), + geo: z + .enum(["EuropeWest", "SoutheastAsia", "UsEast", "UsWest"]) + .optional(), + client_ip: z.string().optional(), + machine: z.string().optional(), + devcontainer_path: z.string().optional(), + multi_repo_permissions_opt_out: PermissiveBoolean.optional(), + working_directory: z.string().optional(), + idle_timeout_minutes: z.coerce.number().optional(), + display_name: z.string().optional(), + retention_period_minutes: z.coerce.number().optional(), + }), + z.object({ + pull_request: z.object({ + pull_request_number: z.coerce.number(), + repository_id: z.coerce.number(), + }), + location: z.string().optional(), + geo: z + .enum(["EuropeWest", "SoutheastAsia", "UsEast", "UsWest"]) + .optional(), + machine: z.string().optional(), + devcontainer_path: z.string().optional(), + working_directory: z.string().optional(), + idle_timeout_minutes: z.coerce.number().optional(), + }), + ]) + + const codespacesCreateForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_codespace], + ["202", s_codespace], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + [ + "503", + z.object({ + code: z.string().optional(), + message: z.string().optional(), + documentation_url: z.string().optional(), + }), + ], + ], + undefined, + ) + + // codespacesCreateForAuthenticatedUser + router.post( + `/user/codespaces`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + codespacesCreateForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with202() { + return new ExpressRuntimeResponse(202) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with503() { + return new ExpressRuntimeResponse<{ + code?: string | undefined + documentation_url?: string | undefined + message?: string | undefined + }>(503) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesCreateForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesCreateForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListSecretsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const codespacesListSecretsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + secrets: z.array(s_codespaces_secret), + }), + ], + ], + undefined, + ) + + // codespacesListSecretsForAuthenticatedUser + router.get( + `/user/codespaces/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + codespacesListSecretsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + secrets: t_codespaces_secret[] + total_count: number + }>(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListSecretsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesListSecretsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetPublicKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [["200", s_codespaces_user_public_key]], + undefined, + ) + + // codespacesGetPublicKeyForAuthenticatedUser + router.get( + `/user/codespaces/secrets/public-key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetPublicKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesGetPublicKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetSecretForAuthenticatedUserParamSchema = z.object({ + secret_name: z.string(), + }) + + const codespacesGetSecretForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["200", s_codespaces_secret]], undefined) + + // codespacesGetSecretForAuthenticatedUser + router.get( + `/user/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesGetSecretForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetSecretForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesGetSecretForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesCreateOrUpdateSecretForAuthenticatedUserParamSchema = + z.object({ secret_name: z.string() }) + + const codespacesCreateOrUpdateSecretForAuthenticatedUserRequestBodySchema = + z.object({ + encrypted_value: z + .string() + .regex( + new RegExp( + "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + ), + ) + .optional(), + key_id: z.string(), + selected_repository_ids: z + .array(z.union([z.coerce.number(), z.string()])) + .optional(), + }) + + const codespacesCreateOrUpdateSecretForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_empty_object], + ["204", z.undefined()], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // codespacesCreateOrUpdateSecretForAuthenticatedUser + router.put( + `/user/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesCreateOrUpdateSecretForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesCreateOrUpdateSecretForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesCreateOrUpdateSecretForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesCreateOrUpdateSecretForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesDeleteSecretForAuthenticatedUserParamSchema = z.object({ + secret_name: z.string(), + }) + + const codespacesDeleteSecretForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // codespacesDeleteSecretForAuthenticatedUser + router.delete( + `/user/codespaces/secrets/:secret_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesDeleteSecretForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesDeleteSecretForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesDeleteSecretForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesListRepositoriesForSecretForAuthenticatedUserParamSchema = + z.object({ secret_name: z.string() }) + + const codespacesListRepositoriesForSecretForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repositories: z.array(s_minimal_repository), + }), + ], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesListRepositoriesForSecretForAuthenticatedUser + router.get( + `/user/codespaces/secrets/:secret_name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesListRepositoriesForSecretForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_minimal_repository[] + total_count: number + }>(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesListRepositoriesForSecretForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesListRepositoriesForSecretForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesSetRepositoriesForSecretForAuthenticatedUserParamSchema = + z.object({ secret_name: z.string() }) + + const codespacesSetRepositoriesForSecretForAuthenticatedUserRequestBodySchema = + z.object({ selected_repository_ids: z.array(z.coerce.number()) }) + + const codespacesSetRepositoriesForSecretForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesSetRepositoriesForSecretForAuthenticatedUser + router.put( + `/user/codespaces/secrets/:secret_name/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesSetRepositoriesForSecretForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesSetRepositoriesForSecretForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesSetRepositoriesForSecretForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesSetRepositoriesForSecretForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesAddRepositoryForSecretForAuthenticatedUserParamSchema = + z.object({ secret_name: z.string(), repository_id: z.coerce.number() }) + + const codespacesAddRepositoryForSecretForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesAddRepositoryForSecretForAuthenticatedUser + router.put( + `/user/codespaces/secrets/:secret_name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesAddRepositoryForSecretForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesAddRepositoryForSecretForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesAddRepositoryForSecretForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesRemoveRepositoryForSecretForAuthenticatedUserParamSchema = + z.object({ secret_name: z.string(), repository_id: z.coerce.number() }) + + const codespacesRemoveRepositoryForSecretForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesRemoveRepositoryForSecretForAuthenticatedUser + router.delete( + `/user/codespaces/secrets/:secret_name/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesRemoveRepositoryForSecretForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesRemoveRepositoryForSecretForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesRemoveRepositoryForSecretForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + }) + + const codespacesGetForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_codespace], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesGetForAuthenticatedUser + router.get( + `/user/codespaces/:codespace_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesGetForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesGetForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesUpdateForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + }) + + const codespacesUpdateForAuthenticatedUserRequestBodySchema = z + .object({ + machine: z.string().optional(), + display_name: z.string().optional(), + recent_folders: z.array(z.string()).optional(), + }) + .optional() + + const codespacesUpdateForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_codespace], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // codespacesUpdateForAuthenticatedUser + router.patch( + `/user/codespaces/:codespace_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesUpdateForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesUpdateForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesUpdateForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesUpdateForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesDeleteForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + }) + + const codespacesDeleteForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["202", z.record(z.unknown())], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesDeleteForAuthenticatedUser + router.delete( + `/user/codespaces/:codespace_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesDeleteForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + [key: string]: unknown | undefined + }>(202) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesDeleteForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesDeleteForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesExportForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + }) + + const codespacesExportForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["202", s_codespace_export_details], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesExportForAuthenticatedUser + router.post( + `/user/codespaces/:codespace_name/exports`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesExportForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesExportForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesExportForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesGetExportDetailsForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + export_id: z.string(), + }) + + const codespacesGetExportDetailsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_codespace_export_details], + ["404", s_basic_error], + ], + undefined, + ) + + // codespacesGetExportDetailsForAuthenticatedUser + router.get( + `/user/codespaces/:codespace_name/exports/:export_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesGetExportDetailsForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesGetExportDetailsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesGetExportDetailsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesCodespaceMachinesForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + }) + + const codespacesCodespaceMachinesForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + machines: z.array(s_codespace_machine), + }), + ], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesCodespaceMachinesForAuthenticatedUser + router.get( + `/user/codespaces/:codespace_name/machines`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesCodespaceMachinesForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + machines: t_codespace_machine[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesCodespaceMachinesForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesCodespaceMachinesForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesPublishForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + }) + + const codespacesPublishForAuthenticatedUserRequestBodySchema = z.object({ + name: z.string().optional(), + private: PermissiveBoolean.optional().default(false), + }) + + const codespacesPublishForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_codespace_with_full_repository], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // codespacesPublishForAuthenticatedUser + router.post( + `/user/codespaces/:codespace_name/publish`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesPublishForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + codespacesPublishForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse( + 201, + ) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesPublishForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesPublishForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesStartForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + }) + + const codespacesStartForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_codespace], + ["304", z.undefined()], + ["400", s_scim_error], + ["401", s_basic_error], + ["402", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesStartForAuthenticatedUser + router.post( + `/user/codespaces/:codespace_name/start`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesStartForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with402() { + return new ExpressRuntimeResponse(402) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesStartForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesStartForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const codespacesStopForAuthenticatedUserParamSchema = z.object({ + codespace_name: z.string(), + }) + + const codespacesStopForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_codespace], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["500", s_basic_error], + ], + undefined, + ) + + // codespacesStopForAuthenticatedUser + router.post( + `/user/codespaces/:codespace_name/stop`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + codespacesStopForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .codespacesStopForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + codespacesStopForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesListDockerMigrationConflictingPackagesForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_package)]], undefined) + + // packagesListDockerMigrationConflictingPackagesForAuthenticatedUser + router.get( + `/user/docker/conflicts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesListDockerMigrationConflictingPackagesForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesListDockerMigrationConflictingPackagesForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersSetPrimaryEmailVisibilityForAuthenticatedUserRequestBodySchema = + z.object({ visibility: z.enum(["public", "private"]) }) + + const usersSetPrimaryEmailVisibilityForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_email)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersSetPrimaryEmailVisibilityForAuthenticatedUser + router.patch( + `/user/email/visibility`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersSetPrimaryEmailVisibilityForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersSetPrimaryEmailVisibilityForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersSetPrimaryEmailVisibilityForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListEmailsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListEmailsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_email)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersListEmailsForAuthenticatedUser + router.get( + `/user/emails`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListEmailsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListEmailsForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListEmailsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersAddEmailForAuthenticatedUserRequestBodySchema = z + .union([ + z.object({ emails: z.array(z.string()).min(1) }), + z.array(z.string()).min(1), + z.string(), + ]) + .optional() + + const usersAddEmailForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", z.array(s_email)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersAddEmailForAuthenticatedUser + router.post( + `/user/emails`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersAddEmailForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersAddEmailForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersAddEmailForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersDeleteEmailForAuthenticatedUserRequestBodySchema = z.union([ + z.object({ emails: z.array(z.string()).min(1) }), + z.array(z.string()).min(1), + z.string(), + ]) + + const usersDeleteEmailForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersDeleteEmailForAuthenticatedUser + router.delete( + `/user/emails`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersDeleteEmailForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersDeleteEmailForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersDeleteEmailForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListFollowersForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListFollowersForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // usersListFollowersForAuthenticatedUser + router.get( + `/user/followers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListFollowersForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListFollowersForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListFollowersForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListFollowedByAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListFollowedByAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // usersListFollowedByAuthenticatedUser + router.get( + `/user/following`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListFollowedByAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListFollowedByAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListFollowedByAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersCheckPersonIsFollowedByAuthenticatedParamSchema = z.object({ + username: z.string(), + }) + + const usersCheckPersonIsFollowedByAuthenticatedResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersCheckPersonIsFollowedByAuthenticated + router.get( + `/user/following/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersCheckPersonIsFollowedByAuthenticatedParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersCheckPersonIsFollowedByAuthenticated( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersCheckPersonIsFollowedByAuthenticatedResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersFollowParamSchema = z.object({ username: z.string() }) + + const usersFollowResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersFollow + router.put( + `/user/following/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersFollowParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersFollow(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersFollowResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersUnfollowParamSchema = z.object({ username: z.string() }) + + const usersUnfollowResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersUnfollow + router.delete( + `/user/following/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersUnfollowParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersUnfollow(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersUnfollowResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListGpgKeysForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListGpgKeysForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_gpg_key)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersListGpgKeysForAuthenticatedUser + router.get( + `/user/gpg_keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListGpgKeysForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListGpgKeysForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListGpgKeysForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersCreateGpgKeyForAuthenticatedUserRequestBodySchema = z.object({ + name: z.string().optional(), + armored_public_key: z.string(), + }) + + const usersCreateGpgKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_gpg_key], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersCreateGpgKeyForAuthenticatedUser + router.post( + `/user/gpg_keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersCreateGpgKeyForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersCreateGpgKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersCreateGpgKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersGetGpgKeyForAuthenticatedUserParamSchema = z.object({ + gpg_key_id: z.coerce.number(), + }) + + const usersGetGpgKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_gpg_key], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersGetGpgKeyForAuthenticatedUser + router.get( + `/user/gpg_keys/:gpg_key_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersGetGpgKeyForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersGetGpgKeyForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersGetGpgKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersDeleteGpgKeyForAuthenticatedUserParamSchema = z.object({ + gpg_key_id: z.coerce.number(), + }) + + const usersDeleteGpgKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersDeleteGpgKeyForAuthenticatedUser + router.delete( + `/user/gpg_keys/:gpg_key_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersDeleteGpgKeyForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersDeleteGpgKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersDeleteGpgKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListInstallationsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListInstallationsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + installations: z.array(s_installation), + }), + ], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // appsListInstallationsForAuthenticatedUser + router.get( + `/user/installations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListInstallationsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + installations: t_installation[] + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListInstallationsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsListInstallationsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListInstallationReposForAuthenticatedUserParamSchema = z.object({ + installation_id: z.coerce.number(), + }) + + const appsListInstallationReposForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListInstallationReposForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + total_count: z.coerce.number(), + repository_selection: z.string().optional(), + repositories: z.array(s_repository), + }), + ], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // appsListInstallationReposForAuthenticatedUser + router.get( + `/user/installations/:installation_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsListInstallationReposForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + appsListInstallationReposForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + repositories: t_repository[] + repository_selection?: string | undefined + total_count: number + }>(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListInstallationReposForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsListInstallationReposForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsAddRepoToInstallationForAuthenticatedUserParamSchema = z.object({ + installation_id: z.coerce.number(), + repository_id: z.coerce.number(), + }) + + const appsAddRepoToInstallationForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // appsAddRepoToInstallationForAuthenticatedUser + router.put( + `/user/installations/:installation_id/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsAddRepoToInstallationForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsAddRepoToInstallationForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsAddRepoToInstallationForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsRemoveRepoFromInstallationForAuthenticatedUserParamSchema = + z.object({ + installation_id: z.coerce.number(), + repository_id: z.coerce.number(), + }) + + const appsRemoveRepoFromInstallationForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", z.undefined()], + ], + undefined, + ) + + // appsRemoveRepoFromInstallationForAuthenticatedUser + router.delete( + `/user/installations/:installation_id/repositories/:repository_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsRemoveRepoFromInstallationForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsRemoveRepoFromInstallationForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsRemoveRepoFromInstallationForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsGetRestrictionsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.union([s_interaction_limit_response, z.object({})])], + ["204", z.undefined()], + ], + undefined, + ) + + // interactionsGetRestrictionsForAuthenticatedUser + router.get( + `/user/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_interaction_limit_response | EmptyObject + >(200) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsGetRestrictionsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsGetRestrictionsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsSetRestrictionsForAuthenticatedUserRequestBodySchema = + s_interaction_limit + + const interactionsSetRestrictionsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_interaction_limit_response], + ["422", s_validation_error], + ], + undefined, + ) + + // interactionsSetRestrictionsForAuthenticatedUser + router.put( + `/user/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + interactionsSetRestrictionsForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsSetRestrictionsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsSetRestrictionsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const interactionsRemoveRestrictionsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["204", z.undefined()]], undefined) + + // interactionsRemoveRestrictionsForAuthenticatedUser + router.delete( + `/user/interaction-limits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .interactionsRemoveRestrictionsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + interactionsRemoveRestrictionsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const issuesListForAuthenticatedUserQuerySchema = z.object({ + filter: z + .enum(["assigned", "created", "mentioned", "subscribed", "repos", "all"]) + .optional() + .default("assigned"), + state: z.enum(["open", "closed", "all"]).optional().default("open"), + labels: z.string().optional(), + sort: z + .enum(["created", "updated", "comments"]) + .optional() + .default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const issuesListForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_issue)], + ["304", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // issuesListForAuthenticatedUser + router.get( + `/user/issues`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + issuesListForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .issuesListForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + issuesListForAuthenticatedUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListPublicSshKeysForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListPublicSshKeysForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_key)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersListPublicSshKeysForAuthenticatedUser + router.get( + `/user/keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListPublicSshKeysForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListPublicSshKeysForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListPublicSshKeysForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersCreatePublicSshKeyForAuthenticatedUserRequestBodySchema = z.object( + { + title: z.string().optional(), + key: z + .string() + .regex( + new RegExp("^ssh-(rsa|dss|ed25519) |^ecdsa-sha2-nistp(256|384|521) "), + ), + }, + ) + + const usersCreatePublicSshKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_key], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersCreatePublicSshKeyForAuthenticatedUser + router.post( + `/user/keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersCreatePublicSshKeyForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersCreatePublicSshKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersCreatePublicSshKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersGetPublicSshKeyForAuthenticatedUserParamSchema = z.object({ + key_id: z.coerce.number(), + }) + + const usersGetPublicSshKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_key], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersGetPublicSshKeyForAuthenticatedUser + router.get( + `/user/keys/:key_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersGetPublicSshKeyForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersGetPublicSshKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersGetPublicSshKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersDeletePublicSshKeyForAuthenticatedUserParamSchema = z.object({ + key_id: z.coerce.number(), + }) + + const usersDeletePublicSshKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersDeletePublicSshKeyForAuthenticatedUser + router.delete( + `/user/keys/:key_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersDeletePublicSshKeyForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersDeletePublicSshKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersDeletePublicSshKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListSubscriptionsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListSubscriptionsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_user_marketplace_purchase)], + ["304", z.undefined()], + ["401", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // appsListSubscriptionsForAuthenticatedUser + router.get( + `/user/marketplace_purchases`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListSubscriptionsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListSubscriptionsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsListSubscriptionsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsListSubscriptionsForAuthenticatedUserStubbedQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const appsListSubscriptionsForAuthenticatedUserStubbedResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_user_marketplace_purchase)], + ["304", z.undefined()], + ["401", s_basic_error], + ], + undefined, + ) + + // appsListSubscriptionsForAuthenticatedUserStubbed + router.get( + `/user/marketplace_purchases/stubbed`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + appsListSubscriptionsForAuthenticatedUserStubbedQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsListSubscriptionsForAuthenticatedUserStubbed( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + appsListSubscriptionsForAuthenticatedUserStubbedResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListMembershipsForAuthenticatedUserQuerySchema = z.object({ + state: z.enum(["active", "pending"]).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListMembershipsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_org_membership)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsListMembershipsForAuthenticatedUser + router.get( + `/user/memberships/orgs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + orgsListMembershipsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListMembershipsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsListMembershipsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsGetMembershipForAuthenticatedUserParamSchema = z.object({ + org: z.string(), + }) + + const orgsGetMembershipForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_org_membership], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // orgsGetMembershipForAuthenticatedUser + router.get( + `/user/memberships/orgs/:org`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsGetMembershipForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsGetMembershipForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsGetMembershipForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsUpdateMembershipForAuthenticatedUserParamSchema = z.object({ + org: z.string(), + }) + + const orgsUpdateMembershipForAuthenticatedUserRequestBodySchema = z.object({ + state: z.enum(["active"]), + }) + + const orgsUpdateMembershipForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_org_membership], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // orgsUpdateMembershipForAuthenticatedUser + router.patch( + `/user/memberships/orgs/:org`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsUpdateMembershipForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + orgsUpdateMembershipForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsUpdateMembershipForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsUpdateMembershipForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsListForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const migrationsListForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_migration)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // migrationsListForAuthenticatedUser + router.get( + `/user/migrations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + migrationsListForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsListForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsListForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsStartForAuthenticatedUserRequestBodySchema = z.object({ + lock_repositories: PermissiveBoolean.optional(), + exclude_metadata: PermissiveBoolean.optional(), + exclude_git_data: PermissiveBoolean.optional(), + exclude_attachments: PermissiveBoolean.optional(), + exclude_releases: PermissiveBoolean.optional(), + exclude_owner_projects: PermissiveBoolean.optional(), + org_metadata_only: PermissiveBoolean.optional().default(false), + exclude: z.array(z.enum(["repositories"])).optional(), + repositories: z.array(z.string()), + }) + + const migrationsStartForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_migration], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // migrationsStartForAuthenticatedUser + router.post( + `/user/migrations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + migrationsStartForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsStartForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsStartForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsGetStatusForAuthenticatedUserParamSchema = z.object({ + migration_id: z.coerce.number(), + }) + + const migrationsGetStatusForAuthenticatedUserQuerySchema = z.object({ + exclude: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), + }) + + const migrationsGetStatusForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_migration], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsGetStatusForAuthenticatedUser + router.get( + `/user/migrations/:migration_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsGetStatusForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + migrationsGetStatusForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsGetStatusForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsGetStatusForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsGetArchiveForAuthenticatedUserParamSchema = z.object({ + migration_id: z.coerce.number(), + }) + + const migrationsGetArchiveForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["302", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // migrationsGetArchiveForAuthenticatedUser + router.get( + `/user/migrations/:migration_id/archive`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsGetArchiveForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with302() { + return new ExpressRuntimeResponse(302) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsGetArchiveForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsGetArchiveForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsDeleteArchiveForAuthenticatedUserParamSchema = z.object({ + migration_id: z.coerce.number(), + }) + + const migrationsDeleteArchiveForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsDeleteArchiveForAuthenticatedUser + router.delete( + `/user/migrations/:migration_id/archive`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsDeleteArchiveForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsDeleteArchiveForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsDeleteArchiveForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsUnlockRepoForAuthenticatedUserParamSchema = z.object({ + migration_id: z.coerce.number(), + repo_name: z.string(), + }) + + const migrationsUnlockRepoForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsUnlockRepoForAuthenticatedUser + router.delete( + `/user/migrations/:migration_id/repos/:repo_name/lock`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsUnlockRepoForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsUnlockRepoForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsUnlockRepoForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const migrationsListReposForAuthenticatedUserParamSchema = z.object({ + migration_id: z.coerce.number(), + }) + + const migrationsListReposForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const migrationsListReposForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_minimal_repository)], + ["404", s_basic_error], + ], + undefined, + ) + + // migrationsListReposForAuthenticatedUser + router.get( + `/user/migrations/:migration_id/repositories`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + migrationsListReposForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + migrationsListReposForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .migrationsListReposForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + migrationsListReposForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_organization_simple)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // orgsListForAuthenticatedUser + router.get( + `/user/orgs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + orgsListForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + orgsListForAuthenticatedUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesListPackagesForAuthenticatedUserQuerySchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + visibility: z.enum(["public", "private", "internal"]).optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const packagesListPackagesForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_package)], + ["400", z.undefined()], + ], + undefined, + ) + + // packagesListPackagesForAuthenticatedUser + router.get( + `/user/packages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + packagesListPackagesForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesListPackagesForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesListPackagesForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetPackageForAuthenticatedUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + }) + + const packagesGetPackageForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["200", s_package]], undefined) + + // packagesGetPackageForAuthenticatedUser + router.get( + `/user/packages/:package_type/:package_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetPackageForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetPackageForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesGetPackageForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesDeletePackageForAuthenticatedUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + }) + + const packagesDeletePackageForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesDeletePackageForAuthenticatedUser + router.delete( + `/user/packages/:package_type/:package_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesDeletePackageForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesDeletePackageForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesDeletePackageForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesRestorePackageForAuthenticatedUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + }) + + const packagesRestorePackageForAuthenticatedUserQuerySchema = z.object({ + token: z.string().optional(), + }) + + const packagesRestorePackageForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesRestorePackageForAuthenticatedUser + router.post( + `/user/packages/:package_type/:package_name/restore`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesRestorePackageForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + packagesRestorePackageForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesRestorePackageForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesRestorePackageForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserParamSchema = + z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + }) + + const packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserQuerySchema = + z.object({ + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + state: z.enum(["active", "deleted"]).optional().default("active"), + }) + + const packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_package_version)], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUser + router.get( + `/user/packages/:package_type/:package_name/versions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetPackageVersionForAuthenticatedUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + package_version_id: z.coerce.number(), + }) + + const packagesGetPackageVersionForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["200", s_package_version]], undefined) + + // packagesGetPackageVersionForAuthenticatedUser + router.get( + `/user/packages/:package_type/:package_name/versions/:package_version_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetPackageVersionForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetPackageVersionForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesGetPackageVersionForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesDeletePackageVersionForAuthenticatedUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + package_version_id: z.coerce.number(), + }) + + const packagesDeletePackageVersionForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesDeletePackageVersionForAuthenticatedUser + router.delete( + `/user/packages/:package_type/:package_name/versions/:package_version_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesDeletePackageVersionForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesDeletePackageVersionForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesDeletePackageVersionForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesRestorePackageVersionForAuthenticatedUserParamSchema = z.object( + { + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + package_version_id: z.coerce.number(), + }, + ) + + const packagesRestorePackageVersionForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesRestorePackageVersionForAuthenticatedUser + router.post( + `/user/packages/:package_type/:package_name/versions/:package_version_id/restore`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesRestorePackageVersionForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesRestorePackageVersionForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesRestorePackageVersionForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsCreateForAuthenticatedUserRequestBodySchema = z.object({ + name: z.string(), + body: z.string().nullable().optional(), + }) + + const projectsCreateForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_project], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["422", s_validation_error_simple], + ], + undefined, + ) + + // projectsCreateForAuthenticatedUser + router.post( + `/user/projects`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + projectsCreateForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsCreateForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + projectsCreateForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListPublicEmailsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListPublicEmailsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_email)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersListPublicEmailsForAuthenticatedUser + router.get( + `/user/public_emails`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListPublicEmailsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListPublicEmailsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListPublicEmailsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListForAuthenticatedUserQuerySchema = z.object({ + visibility: z.enum(["all", "public", "private"]).optional().default("all"), + affiliation: z + .string() + .optional() + .default("owner,collaborator,organization_member"), + type: z + .enum(["all", "owner", "public", "private", "member"]) + .optional() + .default("all"), + sort: z + .enum(["created", "updated", "pushed", "full_name"]) + .optional() + .default("full_name"), + direction: z.enum(["asc", "desc"]).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + since: z.string().datetime({ offset: true }).optional(), + before: z.string().datetime({ offset: true }).optional(), + }) + + const reposListForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_repository)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposListForAuthenticatedUser + router.get( + `/user/repos`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + reposListForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListForAuthenticatedUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposCreateForAuthenticatedUserRequestBodySchema = z.object({ + name: z.string(), + description: z.string().optional(), + homepage: z.string().optional(), + private: PermissiveBoolean.optional().default(false), + has_issues: PermissiveBoolean.optional().default(true), + has_projects: PermissiveBoolean.optional().default(true), + has_wiki: PermissiveBoolean.optional().default(true), + has_discussions: PermissiveBoolean.optional().default(false), + team_id: z.coerce.number().optional(), + auto_init: PermissiveBoolean.optional().default(false), + gitignore_template: z.string().optional(), + license_template: z.string().optional(), + allow_squash_merge: PermissiveBoolean.optional().default(true), + allow_merge_commit: PermissiveBoolean.optional().default(true), + allow_rebase_merge: PermissiveBoolean.optional().default(true), + allow_auto_merge: PermissiveBoolean.optional().default(false), + delete_branch_on_merge: PermissiveBoolean.optional().default(false), + squash_merge_commit_title: z + .enum(["PR_TITLE", "COMMIT_OR_PR_TITLE"]) + .optional(), + squash_merge_commit_message: z + .enum(["PR_BODY", "COMMIT_MESSAGES", "BLANK"]) + .optional(), + merge_commit_title: z.enum(["PR_TITLE", "MERGE_MESSAGE"]).optional(), + merge_commit_message: z.enum(["PR_BODY", "PR_TITLE", "BLANK"]).optional(), + has_downloads: PermissiveBoolean.optional().default(true), + is_template: PermissiveBoolean.optional().default(false), + }) + + const reposCreateForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_full_repository], + ["304", z.undefined()], + ["400", s_scim_error], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // reposCreateForAuthenticatedUser + router.post( + `/user/repos`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + reposCreateForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposCreateForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposCreateForAuthenticatedUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListInvitationsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListInvitationsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_repository_invitation)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // reposListInvitationsForAuthenticatedUser + router.get( + `/user/repository_invitations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + reposListInvitationsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListInvitationsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposListInvitationsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposAcceptInvitationForAuthenticatedUserParamSchema = z.object({ + invitation_id: z.coerce.number(), + }) + + const reposAcceptInvitationForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // reposAcceptInvitationForAuthenticatedUser + router.patch( + `/user/repository_invitations/:invitation_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposAcceptInvitationForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposAcceptInvitationForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposAcceptInvitationForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposDeclineInvitationForAuthenticatedUserParamSchema = z.object({ + invitation_id: z.coerce.number(), + }) + + const reposDeclineInvitationForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ["409", s_basic_error], + ], + undefined, + ) + + // reposDeclineInvitationForAuthenticatedUser + router.delete( + `/user/repository_invitations/:invitation_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposDeclineInvitationForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposDeclineInvitationForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + reposDeclineInvitationForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListSocialAccountsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListSocialAccountsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_social_account)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersListSocialAccountsForAuthenticatedUser + router.get( + `/user/social_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListSocialAccountsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListSocialAccountsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListSocialAccountsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersAddSocialAccountForAuthenticatedUserRequestBodySchema = z.object({ + account_urls: z.array(z.string()), + }) + + const usersAddSocialAccountForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", z.array(s_social_account)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersAddSocialAccountForAuthenticatedUser + router.post( + `/user/social_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersAddSocialAccountForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersAddSocialAccountForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersAddSocialAccountForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersDeleteSocialAccountForAuthenticatedUserRequestBodySchema = + z.object({ account_urls: z.array(z.string()) }) + + const usersDeleteSocialAccountForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersDeleteSocialAccountForAuthenticatedUser + router.delete( + `/user/social_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersDeleteSocialAccountForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersDeleteSocialAccountForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersDeleteSocialAccountForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListSshSigningKeysForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListSshSigningKeysForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_ssh_signing_key)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersListSshSigningKeysForAuthenticatedUser + router.get( + `/user/ssh_signing_keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListSshSigningKeysForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListSshSigningKeysForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListSshSigningKeysForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersCreateSshSigningKeyForAuthenticatedUserRequestBodySchema = + z.object({ + title: z.string().optional(), + key: z + .string() + .regex( + new RegExp( + "^ssh-(rsa|dss|ed25519) |^ecdsa-sha2-nistp(256|384|521) |^(sk-ssh-ed25519|sk-ecdsa-sha2-nistp256)@openssh.com ", + ), + ), + }) + + const usersCreateSshSigningKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["201", s_ssh_signing_key], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersCreateSshSigningKeyForAuthenticatedUser + router.post( + `/user/ssh_signing_keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + usersCreateSshSigningKeyForAuthenticatedUserRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersCreateSshSigningKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersCreateSshSigningKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersGetSshSigningKeyForAuthenticatedUserParamSchema = z.object({ + ssh_signing_key_id: z.coerce.number(), + }) + + const usersGetSshSigningKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_ssh_signing_key], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersGetSshSigningKeyForAuthenticatedUser + router.get( + `/user/ssh_signing_keys/:ssh_signing_key_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersGetSshSigningKeyForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersGetSshSigningKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersGetSshSigningKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersDeleteSshSigningKeyForAuthenticatedUserParamSchema = z.object({ + ssh_signing_key_id: z.coerce.number(), + }) + + const usersDeleteSshSigningKeyForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // usersDeleteSshSigningKeyForAuthenticatedUser + router.delete( + `/user/ssh_signing_keys/:ssh_signing_key_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersDeleteSshSigningKeyForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersDeleteSshSigningKeyForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersDeleteSshSigningKeyForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListReposStarredByAuthenticatedUserQuerySchema = z.object({ + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListReposStarredByAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_starred_repository)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // activityListReposStarredByAuthenticatedUser + router.get( + `/user/starred`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + activityListReposStarredByAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListReposStarredByAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListReposStarredByAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityCheckRepoIsStarredByAuthenticatedUserParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityCheckRepoIsStarredByAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // activityCheckRepoIsStarredByAuthenticatedUser + router.get( + `/user/starred/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityCheckRepoIsStarredByAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityCheckRepoIsStarredByAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityCheckRepoIsStarredByAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityStarRepoForAuthenticatedUserParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityStarRepoForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // activityStarRepoForAuthenticatedUser + router.put( + `/user/starred/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityStarRepoForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityStarRepoForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityStarRepoForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityUnstarRepoForAuthenticatedUserParamSchema = z.object({ + owner: z.string(), + repo: z.string(), + }) + + const activityUnstarRepoForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // activityUnstarRepoForAuthenticatedUser + router.delete( + `/user/starred/:owner/:repo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityUnstarRepoForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityUnstarRepoForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityUnstarRepoForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListWatchedReposForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListWatchedReposForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_minimal_repository)], + ["304", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // activityListWatchedReposForAuthenticatedUser + router.get( + `/user/subscriptions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + activityListWatchedReposForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListWatchedReposForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListWatchedReposForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const teamsListForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const teamsListForAuthenticatedUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_team_full)], + ["304", z.undefined()], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // teamsListForAuthenticatedUser + router.get( + `/user/teams`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + teamsListForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .teamsListForAuthenticatedUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + teamsListForAuthenticatedUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersGetByIdParamSchema = z.object({ account_id: z.coerce.number() }) + + const usersGetByIdResponseBodyValidator = responseValidationFactory( + [ + ["200", z.union([s_private_user, s_public_user])], + ["404", s_basic_error], + ], + undefined, + ) + + // usersGetById + router.get( + `/user/:account_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersGetByIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersGetById(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersGetByIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListQuerySchema = z.object({ + since: z.coerce.number().optional(), + per_page: z.coerce.number().optional().default(30), + }) + + const usersListResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_simple_user)], + ["304", z.undefined()], + ], + undefined, + ) + + // usersList + router.get( + `/users`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + usersListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with304() { + return new ExpressRuntimeResponse(304) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersListResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersGetByUsernameParamSchema = z.object({ username: z.string() }) + + const usersGetByUsernameResponseBodyValidator = responseValidationFactory( + [ + ["200", z.union([s_private_user, s_public_user])], + ["404", s_basic_error], + ], + undefined, + ) + + // usersGetByUsername + router.get( + `/users/:username`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersGetByUsernameParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersGetByUsername(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersGetByUsernameResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListAttestationsParamSchema = z.object({ + username: z.string(), + subject_digest: z.string(), + }) + + const usersListAttestationsQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + before: z.string().optional(), + after: z.string().optional(), + predicate_type: z.string().optional(), + }) + + const usersListAttestationsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + attestations: z + .array( + z.object({ + bundle: z + .object({ + mediaType: z.string().optional(), + verificationMaterial: z.record(z.unknown()).optional(), + dsseEnvelope: z.record(z.unknown()).optional(), + }) + .optional(), + repository_id: z.coerce.number().optional(), + bundle_url: z.string().optional(), + }), + ) + .optional(), + }), + ], + ["201", s_empty_object], + ["204", z.undefined()], + ["404", s_basic_error], + ], + undefined, + ) + + // usersListAttestations + router.get( + `/users/:username/attestations/:subject_digest`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersListAttestationsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + usersListAttestationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + attestations?: + | { + bundle?: + | { + dsseEnvelope?: + | { + [key: string]: unknown | undefined + } + | undefined + mediaType?: string | undefined + verificationMaterial?: + | { + [key: string]: unknown | undefined + } + | undefined + } + | undefined + bundle_url?: string | undefined + repository_id?: number | undefined + }[] + | undefined + }>(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListAttestations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersListAttestationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesListDockerMigrationConflictingPackagesForUserParamSchema = + z.object({ username: z.string() }) + + const packagesListDockerMigrationConflictingPackagesForUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_package)], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // packagesListDockerMigrationConflictingPackagesForUser + router.get( + `/users/:username/docker/conflicts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesListDockerMigrationConflictingPackagesForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesListDockerMigrationConflictingPackagesForUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesListDockerMigrationConflictingPackagesForUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListEventsForAuthenticatedUserParamSchema = z.object({ + username: z.string(), + }) + + const activityListEventsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListEventsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_event)]], undefined) + + // activityListEventsForAuthenticatedUser + router.get( + `/users/:username/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListEventsForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListEventsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListEventsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListEventsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListOrgEventsForAuthenticatedUserParamSchema = z.object({ + username: z.string(), + org: z.string(), + }) + + const activityListOrgEventsForAuthenticatedUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListOrgEventsForAuthenticatedUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_event)]], undefined) + + // activityListOrgEventsForAuthenticatedUser + router.get( + `/users/:username/events/orgs/:org`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListOrgEventsForAuthenticatedUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListOrgEventsForAuthenticatedUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListOrgEventsForAuthenticatedUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListOrgEventsForAuthenticatedUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListPublicEventsForUserParamSchema = z.object({ + username: z.string(), + }) + + const activityListPublicEventsForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListPublicEventsForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_event)]], undefined) + + // activityListPublicEventsForUser + router.get( + `/users/:username/events/public`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListPublicEventsForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListPublicEventsForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListPublicEventsForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListPublicEventsForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListFollowersForUserParamSchema = z.object({ + username: z.string(), + }) + + const usersListFollowersForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListFollowersForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_simple_user)]], undefined) + + // usersListFollowersForUser + router.get( + `/users/:username/followers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersListFollowersForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + usersListFollowersForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListFollowersForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersListFollowersForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListFollowingForUserParamSchema = z.object({ + username: z.string(), + }) + + const usersListFollowingForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListFollowingForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_simple_user)]], undefined) + + // usersListFollowingForUser + router.get( + `/users/:username/following`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersListFollowingForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + usersListFollowingForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListFollowingForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersListFollowingForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersCheckFollowingForUserParamSchema = z.object({ + username: z.string(), + target_user: z.string(), + }) + + const usersCheckFollowingForUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ], + undefined, + ) + + // usersCheckFollowingForUser + router.get( + `/users/:username/following/:target_user`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersCheckFollowingForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersCheckFollowingForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersCheckFollowingForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const gistsListForUserParamSchema = z.object({ username: z.string() }) + + const gistsListForUserQuerySchema = z.object({ + since: z.string().datetime({ offset: true }).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const gistsListForUserResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_base_gist)], + ["422", s_validation_error], + ], + undefined, + ) + + // gistsListForUser + router.get( + `/users/:username/gists`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + gistsListForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + gistsListForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .gistsListForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(gistsListForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListGpgKeysForUserParamSchema = z.object({ username: z.string() }) + + const usersListGpgKeysForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListGpgKeysForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_gpg_key)]], undefined) + + // usersListGpgKeysForUser + router.get( + `/users/:username/gpg_keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersListGpgKeysForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + usersListGpgKeysForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListGpgKeysForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersListGpgKeysForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersGetContextForUserParamSchema = z.object({ username: z.string() }) + + const usersGetContextForUserQuerySchema = z.object({ + subject_type: z + .enum(["organization", "repository", "issue", "pull_request"]) + .optional(), + subject_id: z.string().optional(), + }) + + const usersGetContextForUserResponseBodyValidator = responseValidationFactory( + [ + ["200", s_hovercard], + ["404", s_basic_error], + ["422", s_validation_error], + ], + undefined, + ) + + // usersGetContextForUser + router.get( + `/users/:username/hovercard`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersGetContextForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + usersGetContextForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersGetContextForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(usersGetContextForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const appsGetUserInstallationParamSchema = z.object({ username: z.string() }) + + const appsGetUserInstallationResponseBodyValidator = + responseValidationFactory([["200", s_installation]], undefined) + + // appsGetUserInstallation + router.get( + `/users/:username/installation`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + appsGetUserInstallationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .appsGetUserInstallation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(appsGetUserInstallationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListPublicKeysForUserParamSchema = z.object({ + username: z.string(), + }) + + const usersListPublicKeysForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListPublicKeysForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_key_simple)]], undefined) + + // usersListPublicKeysForUser + router.get( + `/users/:username/keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersListPublicKeysForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + usersListPublicKeysForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListPublicKeysForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListPublicKeysForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const orgsListForUserParamSchema = z.object({ username: z.string() }) + + const orgsListForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const orgsListForUserResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_organization_simple)]], + undefined, + ) + + // orgsListForUser + router.get( + `/users/:username/orgs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + orgsListForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + orgsListForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .orgsListForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(orgsListForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesListPackagesForUserParamSchema = z.object({ + username: z.string(), + }) + + const packagesListPackagesForUserQuerySchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + visibility: z.enum(["public", "private", "internal"]).optional(), + page: z.coerce.number().optional().default(1), + per_page: z.coerce.number().optional().default(30), + }) + + const packagesListPackagesForUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_package)], + ["400", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ], + undefined, + ) + + // packagesListPackagesForUser + router.get( + `/users/:username/packages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesListPackagesForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + packagesListPackagesForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesListPackagesForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesListPackagesForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetPackageForUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + username: z.string(), + }) + + const packagesGetPackageForUserResponseBodyValidator = + responseValidationFactory([["200", s_package]], undefined) + + // packagesGetPackageForUser + router.get( + `/users/:username/packages/:package_type/:package_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetPackageForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetPackageForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(packagesGetPackageForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesDeletePackageForUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + username: z.string(), + }) + + const packagesDeletePackageForUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesDeletePackageForUser + router.delete( + `/users/:username/packages/:package_type/:package_name`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesDeletePackageForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesDeletePackageForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesDeletePackageForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesRestorePackageForUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + username: z.string(), + }) + + const packagesRestorePackageForUserQuerySchema = z.object({ + token: z.string().optional(), + }) + + const packagesRestorePackageForUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesRestorePackageForUser + router.post( + `/users/:username/packages/:package_type/:package_name/restore`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesRestorePackageForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + packagesRestorePackageForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesRestorePackageForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesRestorePackageForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetAllPackageVersionsForPackageOwnedByUserParamSchema = + z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + username: z.string(), + }) + + const packagesGetAllPackageVersionsForPackageOwnedByUserResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_package_version)], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesGetAllPackageVersionsForPackageOwnedByUser + router.get( + `/users/:username/packages/:package_type/:package_name/versions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetAllPackageVersionsForPackageOwnedByUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetAllPackageVersionsForPackageOwnedByUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesGetAllPackageVersionsForPackageOwnedByUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesGetPackageVersionForUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + package_version_id: z.coerce.number(), + username: z.string(), + }) + + const packagesGetPackageVersionForUserResponseBodyValidator = + responseValidationFactory([["200", s_package_version]], undefined) + + // packagesGetPackageVersionForUser + router.get( + `/users/:username/packages/:package_type/:package_name/versions/:package_version_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesGetPackageVersionForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesGetPackageVersionForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesGetPackageVersionForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesDeletePackageVersionForUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + username: z.string(), + package_version_id: z.coerce.number(), + }) + + const packagesDeletePackageVersionForUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesDeletePackageVersionForUser + router.delete( + `/users/:username/packages/:package_type/:package_name/versions/:package_version_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesDeletePackageVersionForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesDeletePackageVersionForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesDeletePackageVersionForUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const packagesRestorePackageVersionForUserParamSchema = z.object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + package_name: z.string(), + username: z.string(), + package_version_id: z.coerce.number(), + }) + + const packagesRestorePackageVersionForUserResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_basic_error], + ["403", s_basic_error], + ["404", s_basic_error], + ], + undefined, + ) + + // packagesRestorePackageVersionForUser + router.post( + `/users/:username/packages/:package_type/:package_name/versions/:package_version_id/restore`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + packagesRestorePackageVersionForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .packagesRestorePackageVersionForUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + packagesRestorePackageVersionForUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const projectsListForUserParamSchema = z.object({ username: z.string() }) + + const projectsListForUserQuerySchema = z.object({ + state: z.enum(["open", "closed", "all"]).optional().default("open"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const projectsListForUserResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_project)], + ["422", s_validation_error], + ], + undefined, + ) + + // projectsListForUser + router.get( + `/users/:username/projects`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + projectsListForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + projectsListForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with422() { + return new ExpressRuntimeResponse(422) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .projectsListForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(projectsListForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListReceivedEventsForUserParamSchema = z.object({ + username: z.string(), + }) + + const activityListReceivedEventsForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListReceivedEventsForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_event)]], undefined) + + // activityListReceivedEventsForUser + router.get( + `/users/:username/received_events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListReceivedEventsForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListReceivedEventsForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListReceivedEventsForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListReceivedEventsForUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListReceivedPublicEventsForUserParamSchema = z.object({ + username: z.string(), + }) + + const activityListReceivedPublicEventsForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListReceivedPublicEventsForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_event)]], undefined) + + // activityListReceivedPublicEventsForUser + router.get( + `/users/:username/received_events/public`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListReceivedPublicEventsForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListReceivedPublicEventsForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListReceivedPublicEventsForUser( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListReceivedPublicEventsForUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const reposListForUserParamSchema = z.object({ username: z.string() }) + + const reposListForUserQuerySchema = z.object({ + type: z.enum(["all", "owner", "member"]).optional().default("owner"), + sort: z + .enum(["created", "updated", "pushed", "full_name"]) + .optional() + .default("full_name"), + direction: z.enum(["asc", "desc"]).optional(), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const reposListForUserResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_minimal_repository)]], + undefined, + ) + + // reposListForUser + router.get( + `/users/:username/repos`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + reposListForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + reposListForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .reposListForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(reposListForUserResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const billingGetGithubActionsBillingUserParamSchema = z.object({ + username: z.string(), + }) + + const billingGetGithubActionsBillingUserResponseBodyValidator = + responseValidationFactory([["200", s_actions_billing_usage]], undefined) + + // billingGetGithubActionsBillingUser + router.get( + `/users/:username/settings/billing/actions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + billingGetGithubActionsBillingUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .billingGetGithubActionsBillingUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + billingGetGithubActionsBillingUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const billingGetGithubPackagesBillingUserParamSchema = z.object({ + username: z.string(), + }) + + const billingGetGithubPackagesBillingUserResponseBodyValidator = + responseValidationFactory([["200", s_packages_billing_usage]], undefined) + + // billingGetGithubPackagesBillingUser + router.get( + `/users/:username/settings/billing/packages`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + billingGetGithubPackagesBillingUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .billingGetGithubPackagesBillingUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + billingGetGithubPackagesBillingUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const billingGetSharedStorageBillingUserParamSchema = z.object({ + username: z.string(), + }) + + const billingGetSharedStorageBillingUserResponseBodyValidator = + responseValidationFactory([["200", s_combined_billing_usage]], undefined) + + // billingGetSharedStorageBillingUser + router.get( + `/users/:username/settings/billing/shared-storage`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + billingGetSharedStorageBillingUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .billingGetSharedStorageBillingUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + billingGetSharedStorageBillingUserResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListSocialAccountsForUserParamSchema = z.object({ + username: z.string(), + }) + + const usersListSocialAccountsForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListSocialAccountsForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_social_account)]], undefined) + + // usersListSocialAccountsForUser + router.get( + `/users/:username/social_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersListSocialAccountsForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + usersListSocialAccountsForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListSocialAccountsForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListSocialAccountsForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const usersListSshSigningKeysForUserParamSchema = z.object({ + username: z.string(), + }) + + const usersListSshSigningKeysForUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const usersListSshSigningKeysForUserResponseBodyValidator = + responseValidationFactory([["200", z.array(s_ssh_signing_key)]], undefined) + + // usersListSshSigningKeysForUser + router.get( + `/users/:username/ssh_signing_keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + usersListSshSigningKeysForUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + usersListSshSigningKeysForUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .usersListSshSigningKeysForUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + usersListSshSigningKeysForUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListReposStarredByUserParamSchema = z.object({ + username: z.string(), + }) + + const activityListReposStarredByUserQuerySchema = z.object({ + sort: z.enum(["created", "updated"]).optional().default("created"), + direction: z.enum(["asc", "desc"]).optional().default("desc"), + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListReposStarredByUserResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([z.array(s_starred_repository), z.array(s_repository)]), + ], + ], + undefined, + ) + + // activityListReposStarredByUser + router.get( + `/users/:username/starred`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListReposStarredByUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListReposStarredByUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_starred_repository[] | t_repository[] + >(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListReposStarredByUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListReposStarredByUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const activityListReposWatchedByUserParamSchema = z.object({ + username: z.string(), + }) + + const activityListReposWatchedByUserQuerySchema = z.object({ + per_page: z.coerce.number().optional().default(30), + page: z.coerce.number().optional().default(1), + }) + + const activityListReposWatchedByUserResponseBodyValidator = + responseValidationFactory( + [["200", z.array(s_minimal_repository)]], + undefined, + ) + + // activityListReposWatchedByUser + router.get( + `/users/:username/subscriptions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + activityListReposWatchedByUserParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + activityListReposWatchedByUserQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .activityListReposWatchedByUser(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + activityListReposWatchedByUserResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const metaGetAllVersionsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(z.string())], + ["404", s_basic_error], + ], + undefined, + ) + + // metaGetAllVersions + router.get( + `/versions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .metaGetAllVersions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(metaGetAllVersionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const metaGetZenResponseBodyValidator = responseValidationFactory( + [["200", z.string()]], + undefined, + ) + + // metaGetZen + router.get( + `/zen`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .metaGetZen(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(metaGetZenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export async function bootstrap(config: ServerConfig) { + // GitHub v3 REST API + return startServer(config) +} diff --git a/integration-tests/typescript-express/src/generated/api.github.com.yaml/models.ts b/integration-tests/typescript-express/src/generated/api.github.com.yaml/models.ts new file mode 100644 index 000000000..7a9c8ca0a --- /dev/null +++ b/integration-tests/typescript-express/src/generated/api.github.com.yaml/models.ts @@ -0,0 +1,17301 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type EmptyObject = { [key: string]: never } + +export type t_actions_billing_usage = { + included_minutes: number + minutes_used_breakdown: { + MACOS?: number | undefined + UBUNTU?: number | undefined + WINDOWS?: number | undefined + macos_12_core?: number | undefined + total?: number | undefined + ubuntu_16_core?: number | undefined + ubuntu_32_core?: number | undefined + ubuntu_4_core?: number | undefined + ubuntu_64_core?: number | undefined + ubuntu_8_core?: number | undefined + windows_16_core?: number | undefined + windows_32_core?: number | undefined + windows_4_core?: number | undefined + windows_64_core?: number | undefined + windows_8_core?: number | undefined + } + total_minutes_used: number + total_paid_minutes_used: number +} + +export type t_actions_cache_list = { + actions_caches: { + created_at?: string | undefined + id?: number | undefined + key?: string | undefined + last_accessed_at?: string | undefined + ref?: string | undefined + size_in_bytes?: number | undefined + version?: string | undefined + }[] + total_count: number +} + +export type t_actions_cache_usage_by_repository = { + active_caches_count: number + active_caches_size_in_bytes: number + full_name: string +} + +export type t_actions_cache_usage_org_enterprise = { + total_active_caches_count: number + total_active_caches_size_in_bytes: number +} + +export type t_actions_can_approve_pull_request_reviews = boolean + +export type t_actions_default_workflow_permissions = "read" | "write" + +export type t_actions_enabled = boolean + +export type t_actions_get_default_workflow_permissions = { + can_approve_pull_request_reviews: t_actions_can_approve_pull_request_reviews + default_workflow_permissions: t_actions_default_workflow_permissions +} + +export type t_actions_hosted_runner = { + id: number + image_details: t_nullable_actions_hosted_runner_pool_image + last_active_on?: (string | null) | undefined + machine_size_details: t_actions_hosted_runner_machine_spec + maximum_runners?: number | undefined + name: string + platform: string + public_ip_enabled: boolean + public_ips?: t_public_ip[] | undefined + runner_group_id?: number | undefined + status: "Ready" | "Provisioning" | "Shutdown" | "Deleting" | "Stuck" +} + +export type t_actions_hosted_runner_image = { + display_name: string + id: string + platform: string + size_gb: number + source: "github" | "partner" | "custom" +} + +export type t_actions_hosted_runner_limits = { + public_ips: { + current_usage: number + maximum: number + } +} + +export type t_actions_hosted_runner_machine_spec = { + cpu_cores: number + id: string + memory_gb: number + storage_gb: number +} + +export type t_actions_organization_permissions = { + allowed_actions?: t_allowed_actions | undefined + enabled_repositories: t_enabled_repositories + selected_actions_url?: t_selected_actions_url | undefined + selected_repositories_url?: string | undefined +} + +export type t_actions_public_key = { + created_at?: string | undefined + id?: number | undefined + key: string + key_id: string + title?: string | undefined + url?: string | undefined +} + +export type t_actions_repository_permissions = { + allowed_actions?: t_allowed_actions | undefined + enabled: t_actions_enabled + selected_actions_url?: t_selected_actions_url | undefined +} + +export type t_actions_secret = { + created_at: string + name: string + updated_at: string +} + +export type t_actions_variable = { + created_at: string + name: string + updated_at: string + value: string +} + +export type t_actions_workflow_access_to_repository = { + access_level: "none" | "user" | "organization" +} + +export type t_activity = { + activity_type: + | "push" + | "force_push" + | "branch_deletion" + | "branch_creation" + | "pr_merge" + | "merge_queue_merge" + actor: t_nullable_simple_user + after: string + before: string + id: number + node_id: string + ref: string + timestamp: string +} + +export type t_actor = { + avatar_url: string + display_login?: string | undefined + gravatar_id: string | null + id: number + login: string + url: string +} + +export type t_added_to_project_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + project_card?: + | { + column_name: string + id: number + previous_column_name?: string | undefined + project_id: number + project_url: string + url: string + } + | undefined + url: string +} + +export type t_alert_auto_dismissed_at = string | null + +export type t_alert_created_at = string + +export type t_alert_dismissed_at = string | null + +export type t_alert_fixed_at = string | null + +export type t_alert_html_url = string + +export type t_alert_instances_url = string + +export type t_alert_number = number + +export type t_alert_updated_at = string + +export type t_alert_url = string + +export type t_allowed_actions = "all" | "local_only" | "selected" + +export type t_api_insights_route_stats = { + api_route?: string | undefined + http_method?: string | undefined + last_rate_limited_timestamp?: (string | null) | undefined + last_request_timestamp?: string | undefined + rate_limited_request_count?: number | undefined + total_request_count?: number | undefined +}[] + +export type t_api_insights_subject_stats = { + last_rate_limited_timestamp?: (string | null) | undefined + last_request_timestamp?: string | undefined + rate_limited_request_count?: number | undefined + subject_id?: number | undefined + subject_name?: string | undefined + subject_type?: string | undefined + total_request_count?: number | undefined +}[] + +export type t_api_insights_summary_stats = { + rate_limited_request_count?: number | undefined + total_request_count?: number | undefined +} + +export type t_api_insights_time_stats = { + rate_limited_request_count?: number | undefined + timestamp?: string | undefined + total_request_count?: number | undefined +}[] + +export type t_api_insights_user_stats = { + actor_id?: number | undefined + actor_name?: string | undefined + actor_type?: string | undefined + integration_id?: (number | null) | undefined + last_rate_limited_timestamp?: (string | null) | undefined + last_request_timestamp?: string | undefined + oauth_application_id?: (number | null) | undefined + rate_limited_request_count?: number | undefined + total_request_count?: number | undefined +}[] + +export type t_api_overview = { + actions?: string[] | undefined + actions_macos?: string[] | undefined + api?: string[] | undefined + codespaces?: string[] | undefined + copilot?: string[] | undefined + dependabot?: string[] | undefined + domains?: + | { + actions?: string[] | undefined + actions_inbound?: + | { + full_domains?: string[] | undefined + wildcard_domains?: string[] | undefined + } + | undefined + artifact_attestations?: + | { + services?: string[] | undefined + trust_domain?: string | undefined + } + | undefined + codespaces?: string[] | undefined + copilot?: string[] | undefined + packages?: string[] | undefined + website?: string[] | undefined + } + | undefined + git?: string[] | undefined + github_enterprise_importer?: string[] | undefined + hooks?: string[] | undefined + importer?: string[] | undefined + packages?: string[] | undefined + pages?: string[] | undefined + ssh_key_fingerprints?: + | { + SHA256_DSA?: string | undefined + SHA256_ECDSA?: string | undefined + SHA256_ED25519?: string | undefined + SHA256_RSA?: string | undefined + } + | undefined + ssh_keys?: string[] | undefined + verifiable_password_authentication: boolean + web?: string[] | undefined +} + +export type t_app_permissions = { + actions?: ("read" | "write") | undefined + administration?: ("read" | "write") | undefined + checks?: ("read" | "write") | undefined + codespaces?: ("read" | "write") | undefined + contents?: ("read" | "write") | undefined + dependabot_secrets?: ("read" | "write") | undefined + deployments?: ("read" | "write") | undefined + email_addresses?: ("read" | "write") | undefined + environments?: ("read" | "write") | undefined + followers?: ("read" | "write") | undefined + git_ssh_keys?: ("read" | "write") | undefined + gpg_keys?: ("read" | "write") | undefined + interaction_limits?: ("read" | "write") | undefined + issues?: ("read" | "write") | undefined + members?: ("read" | "write") | undefined + metadata?: ("read" | "write") | undefined + organization_administration?: ("read" | "write") | undefined + organization_announcement_banners?: ("read" | "write") | undefined + organization_copilot_seat_management?: "write" | undefined + organization_custom_org_roles?: ("read" | "write") | undefined + organization_custom_properties?: ("read" | "write" | "admin") | undefined + organization_custom_roles?: ("read" | "write") | undefined + organization_events?: "read" | undefined + organization_hooks?: ("read" | "write") | undefined + organization_packages?: ("read" | "write") | undefined + organization_personal_access_token_requests?: ("read" | "write") | undefined + organization_personal_access_tokens?: ("read" | "write") | undefined + organization_plan?: "read" | undefined + organization_projects?: ("read" | "write" | "admin") | undefined + organization_secrets?: ("read" | "write") | undefined + organization_self_hosted_runners?: ("read" | "write") | undefined + organization_user_blocking?: ("read" | "write") | undefined + packages?: ("read" | "write") | undefined + pages?: ("read" | "write") | undefined + profile?: "write" | undefined + pull_requests?: ("read" | "write") | undefined + repository_custom_properties?: ("read" | "write") | undefined + repository_hooks?: ("read" | "write") | undefined + repository_projects?: ("read" | "write" | "admin") | undefined + secret_scanning_alerts?: ("read" | "write") | undefined + secrets?: ("read" | "write") | undefined + security_events?: ("read" | "write") | undefined + single_file?: ("read" | "write") | undefined + starring?: ("read" | "write") | undefined + statuses?: ("read" | "write") | undefined + team_discussions?: ("read" | "write") | undefined + vulnerability_alerts?: ("read" | "write") | undefined + workflows?: "write" | undefined +} + +export type t_artifact = { + archive_download_url: string + created_at: string | null + digest?: (string | null) | undefined + expired: boolean + expires_at: string | null + id: number + name: string + node_id: string + size_in_bytes: number + updated_at: string | null + url: string + workflow_run?: + | ({ + head_branch?: string | undefined + head_repository_id?: number | undefined + head_sha?: string | undefined + id?: number | undefined + repository_id?: number | undefined + } | null) + | undefined +} + +export type t_assigned_issue_event = { + actor: t_simple_user + assignee: t_simple_user + assigner: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_integration + url: string +} + +export type t_authentication_token = { + expires_at: string + permissions?: EmptyObject | undefined + repositories?: t_repository[] | undefined + repository_selection?: ("all" | "selected") | undefined + single_file?: (string | null) | undefined + token: string +} + +export type t_author_association = + | "COLLABORATOR" + | "CONTRIBUTOR" + | "FIRST_TIMER" + | "FIRST_TIME_CONTRIBUTOR" + | "MANNEQUIN" + | "MEMBER" + | "NONE" + | "OWNER" + +export type t_authorization = { + app: { + client_id: string + name: string + url: string + } + created_at: string + expires_at: string | null + fingerprint: string | null + hashed_token: string | null + id: number + installation?: t_nullable_scoped_installation | undefined + note: string | null + note_url: string | null + scopes: string[] | null + token: string + token_last_eight: string | null + updated_at: string + url: string + user?: t_nullable_simple_user | undefined +} + +export type t_auto_merge = { + commit_message: string + commit_title: string + enabled_by: t_simple_user + merge_method: "merge" | "squash" | "rebase" +} | null + +export type t_autolink = { + id: number + is_alphanumeric: boolean + key_prefix: string + url_template: string +} + +export type t_base_gist = { + comments: number + comments_enabled?: boolean | undefined + comments_url: string + commits_url: string + created_at: string + description: string | null + files: { + [key: string]: + | { + encoding?: string | undefined + filename?: string | undefined + language?: string | undefined + raw_url?: string | undefined + size?: number | undefined + type?: string | undefined + } + | undefined + } + forks?: unknown[] | undefined + forks_url: string + git_pull_url: string + git_push_url: string + history?: unknown[] | undefined + html_url: string + id: string + node_id: string + owner?: t_simple_user | undefined + public: boolean + truncated?: boolean | undefined + updated_at: string + url: string + user: t_nullable_simple_user +} + +export type t_basic_error = { + documentation_url?: string | undefined + message?: string | undefined + status?: string | undefined + url?: string | undefined +} + +export type t_billing_usage_report = { + usageItems?: + | { + date: string + discountAmount: number + grossAmount: number + netAmount: number + organizationName: string + pricePerUnit: number + product: string + quantity: number + repositoryName?: string | undefined + sku: string + unitType: string + }[] + | undefined +} + +export type t_blob = { + content: string + encoding: string + highlighted_content?: string | undefined + node_id: string + sha: string + size: number | null + url: string +} + +export type t_branch_protection = { + allow_deletions?: + | { + enabled?: boolean | undefined + } + | undefined + allow_force_pushes?: + | { + enabled?: boolean | undefined + } + | undefined + allow_fork_syncing?: + | { + enabled?: boolean | undefined + } + | undefined + block_creations?: + | { + enabled?: boolean | undefined + } + | undefined + enabled?: boolean | undefined + enforce_admins?: t_protected_branch_admin_enforced | undefined + lock_branch?: + | { + enabled?: boolean | undefined + } + | undefined + name?: string | undefined + protection_url?: string | undefined + required_conversation_resolution?: + | { + enabled?: boolean | undefined + } + | undefined + required_linear_history?: + | { + enabled?: boolean | undefined + } + | undefined + required_pull_request_reviews?: + | t_protected_branch_pull_request_review + | undefined + required_signatures?: + | { + enabled: boolean + url: string + } + | undefined + required_status_checks?: t_protected_branch_required_status_check | undefined + restrictions?: t_branch_restriction_policy | undefined + url?: string | undefined +} + +export type t_branch_restriction_policy = { + apps: { + client_id?: string | undefined + created_at?: string | undefined + description?: string | undefined + events?: string[] | undefined + external_url?: string | undefined + html_url?: string | undefined + id?: number | undefined + name?: string | undefined + node_id?: string | undefined + owner?: + | { + avatar_url?: string | undefined + description?: string | undefined + events_url?: string | undefined + followers_url?: string | undefined + following_url?: string | undefined + gists_url?: string | undefined + gravatar_id?: string | undefined + hooks_url?: string | undefined + html_url?: string | undefined + id?: number | undefined + issues_url?: string | undefined + login?: string | undefined + members_url?: string | undefined + node_id?: string | undefined + organizations_url?: string | undefined + public_members_url?: string | undefined + received_events_url?: string | undefined + repos_url?: string | undefined + site_admin?: boolean | undefined + starred_url?: string | undefined + subscriptions_url?: string | undefined + type?: string | undefined + url?: string | undefined + user_view_type?: string | undefined + } + | undefined + permissions?: + | { + contents?: string | undefined + issues?: string | undefined + metadata?: string | undefined + single_file?: string | undefined + } + | undefined + slug?: string | undefined + updated_at?: string | undefined + }[] + apps_url: string + teams: { + description?: (string | null) | undefined + html_url?: string | undefined + id?: number | undefined + members_url?: string | undefined + name?: string | undefined + node_id?: string | undefined + notification_setting?: string | undefined + parent?: (string | null) | undefined + permission?: string | undefined + privacy?: string | undefined + repositories_url?: string | undefined + slug?: string | undefined + url?: string | undefined + }[] + teams_url: string + url: string + users: { + avatar_url?: string | undefined + events_url?: string | undefined + followers_url?: string | undefined + following_url?: string | undefined + gists_url?: string | undefined + gravatar_id?: string | undefined + html_url?: string | undefined + id?: number | undefined + login?: string | undefined + node_id?: string | undefined + organizations_url?: string | undefined + received_events_url?: string | undefined + repos_url?: string | undefined + site_admin?: boolean | undefined + starred_url?: string | undefined + subscriptions_url?: string | undefined + type?: string | undefined + url?: string | undefined + user_view_type?: string | undefined + }[] + users_url: string +} + +export type t_branch_short = { + commit: { + sha: string + url: string + } + name: string + protected: boolean +} + +export type t_branch_with_protection = { + _links: { + html: string + self: string + } + commit: t_commit + name: string + pattern?: string | undefined + protected: boolean + protection: t_branch_protection + protection_url: string + required_approving_review_count?: number | undefined +} + +export type t_campaign_state = "open" | "closed" + +export type t_campaign_summary = { + alert_stats?: + | { + closed_count: number + in_progress_count: number + open_count: number + } + | undefined + closed_at?: (string | null) | undefined + contact_link: string | null + created_at: string + description: string + ends_at: string + managers: t_simple_user[] + name?: string | undefined + number: number + published_at?: string | undefined + state: t_campaign_state + team_managers?: t_team[] | undefined + updated_at: string +} + +export type t_check_annotation = { + annotation_level: string | null + blob_href: string + end_column: number | null + end_line: number + message: string | null + path: string + raw_details: string | null + start_column: number | null + start_line: number + title: string | null +} + +export type t_check_automated_security_fixes = { + enabled: boolean + paused: boolean +} + +export type t_check_run = { + app: t_nullable_integration + check_suite: { + id: number + } | null + completed_at: string | null + conclusion: + | "success" + | "failure" + | "neutral" + | "cancelled" + | "skipped" + | "timed_out" + | "action_required" + | null + deployment?: t_deployment_simple | undefined + details_url: string | null + external_id: string | null + head_sha: string + html_url: string | null + id: number + name: string + node_id: string + output: { + annotations_count: number + annotations_url: string + summary: string | null + text: string | null + title: string | null + } + pull_requests: t_pull_request_minimal[] + started_at: string | null + status: + | "queued" + | "in_progress" + | "completed" + | "waiting" + | "requested" + | "pending" + url: string +} + +export type t_check_suite = { + after: string | null + app: t_nullable_integration + before: string | null + check_runs_url: string + conclusion: + | "success" + | "failure" + | "neutral" + | "cancelled" + | "skipped" + | "timed_out" + | "action_required" + | "startup_failure" + | "stale" + | null + created_at: string | null + head_branch: string | null + head_commit: t_simple_commit + head_sha: string + id: number + latest_check_runs_count: number + node_id: string + pull_requests: t_pull_request_minimal[] | null + repository: t_minimal_repository + rerequestable?: boolean | undefined + runs_rerequestable?: boolean | undefined + status: + | "queued" + | "in_progress" + | "completed" + | "waiting" + | "requested" + | "pending" + | null + updated_at: string | null + url: string | null +} + +export type t_check_suite_preference = { + preferences: { + auto_trigger_checks?: + | { + app_id: number + setting: boolean + }[] + | undefined + } + repository: t_minimal_repository +} + +export type t_classroom = { + archived: boolean + id: number + name: string + organization: t_simple_classroom_organization + url: string +} + +export type t_classroom_accepted_assignment = { + assignment: t_simple_classroom_assignment + commit_count: number + grade: string + id: number + passing: boolean + repository: t_simple_classroom_repository + students: t_simple_classroom_user[] + submitted: boolean +} + +export type t_classroom_assignment = { + accepted: number + classroom: t_classroom + deadline: string | null + editor: string + feedback_pull_requests_enabled: boolean + id: number + invitations_enabled: boolean + invite_link: string + language: string + max_members: number | null + max_teams: number | null + passing: number + public_repo: boolean + slug: string + starter_code_repository: t_simple_classroom_repository + students_are_repo_admins: boolean + submitted: number + title: string + type: "individual" | "group" +} + +export type t_classroom_assignment_grade = { + assignment_name: string + assignment_url: string + github_username: string + group_name?: string | undefined + points_available: number + points_awarded: number + roster_identifier: string + starter_code_url: string + student_repository_name: string + student_repository_url: string + submission_timestamp: string +} + +export type t_clone_traffic = { + clones: t_traffic[] + count: number + uniques: number +} + +export type t_code_frequency_stat = number[] + +export type t_code_of_conduct = { + body?: string | undefined + html_url: string | null + key: string + name: string + url: string +} + +export type t_code_of_conduct_simple = { + html_url: string | null + key: string + name: string + url: string +} + +export type t_code_scanning_alert = { + created_at: t_alert_created_at + dismissal_approved_by?: t_nullable_simple_user | undefined + dismissed_at: t_alert_dismissed_at + dismissed_by: t_nullable_simple_user + dismissed_comment?: t_code_scanning_alert_dismissed_comment | undefined + dismissed_reason: t_code_scanning_alert_dismissed_reason + fixed_at?: t_alert_fixed_at | undefined + html_url: t_alert_html_url + instances_url: t_alert_instances_url + most_recent_instance: t_code_scanning_alert_instance + number: t_alert_number + rule: t_code_scanning_alert_rule + state: t_code_scanning_alert_state + tool: t_code_scanning_analysis_tool + updated_at?: t_alert_updated_at | undefined + url: t_alert_url +} + +export type t_code_scanning_alert_classification = + | "source" + | "generated" + | "test" + | "library" + | null + +export type t_code_scanning_alert_create_request = boolean + +export type t_code_scanning_alert_dismissed_comment = string | null + +export type t_code_scanning_alert_dismissed_reason = + | "false positive" + | "won't fix" + | "used in tests" + | null + +export type t_code_scanning_alert_environment = string + +export type t_code_scanning_alert_instance = { + analysis_key?: t_code_scanning_analysis_analysis_key | undefined + category?: t_code_scanning_analysis_category | undefined + classifications?: t_code_scanning_alert_classification[] | undefined + commit_sha?: string | undefined + environment?: t_code_scanning_alert_environment | undefined + html_url?: string | undefined + location?: t_code_scanning_alert_location | undefined + message?: + | { + text?: string | undefined + } + | undefined + ref?: t_code_scanning_ref | undefined + state?: t_code_scanning_alert_state | undefined +} + +export type t_code_scanning_alert_items = { + created_at: t_alert_created_at + dismissal_approved_by?: t_nullable_simple_user | undefined + dismissed_at: t_alert_dismissed_at + dismissed_by: t_nullable_simple_user + dismissed_comment?: t_code_scanning_alert_dismissed_comment | undefined + dismissed_reason: t_code_scanning_alert_dismissed_reason + fixed_at?: t_alert_fixed_at | undefined + html_url: t_alert_html_url + instances_url: t_alert_instances_url + most_recent_instance: t_code_scanning_alert_instance + number: t_alert_number + rule: t_code_scanning_alert_rule_summary + state: t_code_scanning_alert_state + tool: t_code_scanning_analysis_tool + updated_at?: t_alert_updated_at | undefined + url: t_alert_url +} + +export type t_code_scanning_alert_location = { + end_column?: number | undefined + end_line?: number | undefined + path?: string | undefined + start_column?: number | undefined + start_line?: number | undefined +} + +export type t_code_scanning_alert_rule = { + description?: string | undefined + full_description?: string | undefined + help?: (string | null) | undefined + help_uri?: (string | null) | undefined + id?: (string | null) | undefined + name?: string | undefined + security_severity_level?: + | ("low" | "medium" | "high" | "critical" | null) + | undefined + severity?: ("none" | "note" | "warning" | "error" | null) | undefined + tags?: (string[] | null) | undefined +} + +export type t_code_scanning_alert_rule_summary = { + description?: string | undefined + full_description?: string | undefined + help?: (string | null) | undefined + help_uri?: (string | null) | undefined + id?: (string | null) | undefined + name?: string | undefined + security_severity_level?: + | ("low" | "medium" | "high" | "critical" | null) + | undefined + severity?: ("none" | "note" | "warning" | "error" | null) | undefined + tags?: (string[] | null) | undefined +} + +export type t_code_scanning_alert_set_state = "open" | "dismissed" + +export type t_code_scanning_alert_severity = + | "critical" + | "high" + | "medium" + | "low" + | "warning" + | "note" + | "error" + +export type t_code_scanning_alert_state = "open" | "dismissed" | "fixed" | null + +export type t_code_scanning_alert_state_query = + | "open" + | "closed" + | "dismissed" + | "fixed" + +export type t_code_scanning_analysis = { + analysis_key: t_code_scanning_analysis_analysis_key + category?: t_code_scanning_analysis_category | undefined + commit_sha: t_code_scanning_analysis_commit_sha + created_at: t_code_scanning_analysis_created_at + deletable: boolean + environment: t_code_scanning_analysis_environment + error: string + id: number + ref: t_code_scanning_ref + results_count: number + rules_count: number + sarif_id: t_code_scanning_analysis_sarif_id + tool: t_code_scanning_analysis_tool + url: t_code_scanning_analysis_url + warning: string +} + +export type t_code_scanning_analysis_analysis_key = string + +export type t_code_scanning_analysis_category = string + +export type t_code_scanning_analysis_commit_sha = string + +export type t_code_scanning_analysis_created_at = string + +export type t_code_scanning_analysis_deletion = { + readonly confirm_delete_url: string | null + readonly next_analysis_url: string | null +} + +export type t_code_scanning_analysis_environment = string + +export type t_code_scanning_analysis_sarif_file = string + +export type t_code_scanning_analysis_sarif_id = string + +export type t_code_scanning_analysis_tool = { + guid?: t_code_scanning_analysis_tool_guid | undefined + name?: t_code_scanning_analysis_tool_name | undefined + version?: t_code_scanning_analysis_tool_version | undefined +} + +export type t_code_scanning_analysis_tool_guid = string | null + +export type t_code_scanning_analysis_tool_name = string + +export type t_code_scanning_analysis_tool_version = string | null + +export type t_code_scanning_analysis_url = string + +export type t_code_scanning_autofix = { + description: t_code_scanning_autofix_description + started_at: t_code_scanning_autofix_started_at + status: t_code_scanning_autofix_status +} + +export type t_code_scanning_autofix_commits_response = { + sha?: string | undefined + target_ref?: string | undefined +} + +export type t_code_scanning_autofix_description = string | null + +export type t_code_scanning_autofix_started_at = string + +export type t_code_scanning_autofix_status = + | "pending" + | "error" + | "success" + | "outdated" + +export type t_code_scanning_codeql_database = { + commit_oid?: (string | null) | undefined + content_type: string + created_at: string + id: number + language: string + name: string + size: number + updated_at: string + uploader: t_simple_user + url: string +} + +export type t_code_scanning_default_setup = { + languages?: + | ( + | "actions" + | "c-cpp" + | "csharp" + | "go" + | "java-kotlin" + | "javascript-typescript" + | "javascript" + | "python" + | "ruby" + | "typescript" + | "swift" + )[] + | undefined + query_suite?: ("default" | "extended") | undefined + runner_label?: (string | null) | undefined + runner_type?: ("standard" | "labeled" | null) | undefined + schedule?: ("weekly" | null) | undefined + state?: ("configured" | "not-configured") | undefined + updated_at?: (string | null) | undefined +} + +export type t_code_scanning_default_setup_options = { + runner_label?: (string | null) | undefined + runner_type?: ("standard" | "labeled" | "not_set") | undefined +} | null + +export type t_code_scanning_default_setup_update_response = { + run_id?: number | undefined + run_url?: string | undefined +} + +export type t_code_scanning_organization_alert_items = { + created_at: t_alert_created_at + dismissal_approved_by?: t_nullable_simple_user | undefined + dismissed_at: t_alert_dismissed_at + dismissed_by: t_nullable_simple_user + dismissed_comment?: t_code_scanning_alert_dismissed_comment | undefined + dismissed_reason: t_code_scanning_alert_dismissed_reason + fixed_at?: t_alert_fixed_at | undefined + html_url: t_alert_html_url + instances_url: t_alert_instances_url + most_recent_instance: t_code_scanning_alert_instance + number: t_alert_number + repository: t_simple_repository + rule: t_code_scanning_alert_rule_summary + state: t_code_scanning_alert_state + tool: t_code_scanning_analysis_tool + updated_at?: t_alert_updated_at | undefined + url: t_alert_url +} + +export type t_code_scanning_ref = string + +export type t_code_scanning_ref_full = string + +export type t_code_scanning_sarifs_receipt = { + id?: t_code_scanning_analysis_sarif_id | undefined + readonly url?: string | undefined +} + +export type t_code_scanning_sarifs_status = { + readonly analyses_url?: (string | null) | undefined + readonly errors?: (string[] | null) | undefined + processing_status?: ("pending" | "complete" | "failed") | undefined +} + +export type t_code_scanning_variant_analysis = { + actions_workflow_run_id?: number | undefined + actor: t_simple_user + completed_at?: (string | null) | undefined + controller_repo: t_simple_repository + created_at?: string | undefined + failure_reason?: + | ("no_repos_queried" | "actions_workflow_run_failed" | "internal_error") + | undefined + id: number + query_language: t_code_scanning_variant_analysis_language + query_pack_url: string + scanned_repositories?: + | { + analysis_status: t_code_scanning_variant_analysis_status + artifact_size_in_bytes?: number | undefined + failure_message?: string | undefined + repository: t_code_scanning_variant_analysis_repository + result_count?: number | undefined + }[] + | undefined + skipped_repositories?: + | { + access_mismatch_repos: t_code_scanning_variant_analysis_skipped_repo_group + no_codeql_db_repos: t_code_scanning_variant_analysis_skipped_repo_group + not_found_repos: { + repository_count: number + repository_full_names: string[] + } + over_limit_repos: t_code_scanning_variant_analysis_skipped_repo_group + } + | undefined + status: "in_progress" | "succeeded" | "failed" | "cancelled" + updated_at?: string | undefined +} + +export type t_code_scanning_variant_analysis_language = + | "cpp" + | "csharp" + | "go" + | "java" + | "javascript" + | "python" + | "ruby" + | "rust" + | "swift" + +export type t_code_scanning_variant_analysis_repo_task = { + analysis_status: t_code_scanning_variant_analysis_status + artifact_size_in_bytes?: number | undefined + artifact_url?: string | undefined + database_commit_sha?: string | undefined + failure_message?: string | undefined + repository: t_simple_repository + result_count?: number | undefined + source_location_prefix?: string | undefined +} + +export type t_code_scanning_variant_analysis_repository = { + full_name: string + id: number + name: string + private: boolean + stargazers_count: number + updated_at: string | null +} + +export type t_code_scanning_variant_analysis_skipped_repo_group = { + repositories: t_code_scanning_variant_analysis_repository[] + repository_count: number +} + +export type t_code_scanning_variant_analysis_status = + | "pending" + | "in_progress" + | "succeeded" + | "failed" + | "canceled" + | "timed_out" + +export type t_code_search_result_item = { + file_size?: number | undefined + git_url: string + html_url: string + language?: (string | null) | undefined + last_modified_at?: string | undefined + line_numbers?: string[] | undefined + name: string + path: string + repository: t_minimal_repository + score: number + sha: string + text_matches?: t_search_result_text_matches | undefined + url: string +} + +export type t_code_security_configuration = { + advanced_security?: + | ("enabled" | "disabled" | "code_security" | "secret_protection") + | undefined + code_scanning_default_setup?: ("enabled" | "disabled" | "not_set") | undefined + code_scanning_default_setup_options?: + | ({ + runner_label?: (string | null) | undefined + runner_type?: ("standard" | "labeled" | "not_set" | null) | undefined + } | null) + | undefined + code_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + created_at?: string | undefined + dependabot_alerts?: ("enabled" | "disabled" | "not_set") | undefined + dependabot_security_updates?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph_autosubmit_action?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependency_graph_autosubmit_action_options?: + | { + labeled_runners?: boolean | undefined + } + | undefined + description?: string | undefined + enforcement?: ("enforced" | "unenforced") | undefined + html_url?: string | undefined + id?: number | undefined + name?: string | undefined + private_vulnerability_reporting?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning?: ("enabled" | "disabled" | "not_set") | undefined + secret_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_delegated_bypass?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_delegated_bypass_options?: + | { + reviewers?: + | { + reviewer_id: number + reviewer_type: "TEAM" | "ROLE" + }[] + | undefined + } + | undefined + secret_scanning_generic_secrets?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_non_provider_patterns?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_push_protection?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_validity_checks?: + | ("enabled" | "disabled" | "not_set") + | undefined + target_type?: ("global" | "organization" | "enterprise") | undefined + updated_at?: string | undefined + url?: string | undefined +} + +export type t_code_security_configuration_for_repository = { + configuration?: t_code_security_configuration | undefined + status?: + | ( + | "attached" + | "attaching" + | "detached" + | "removed" + | "enforced" + | "failed" + | "updating" + | "removed_by_enterprise" + ) + | undefined +} + +export type t_code_security_configuration_repositories = { + repository?: t_simple_repository | undefined + status?: + | ( + | "attached" + | "attaching" + | "detached" + | "removed" + | "enforced" + | "failed" + | "updating" + | "removed_by_enterprise" + ) + | undefined +} + +export type t_code_security_default_configurations = { + configuration?: t_code_security_configuration | undefined + default_for_new_repos?: EmptyObject | undefined +}[] + +export type t_codeowners_errors = { + errors: { + column: number + kind: string + line: number + message: string + path: string + source?: string | undefined + suggestion?: (string | null) | undefined + }[] +} + +export type t_codespace = { + billable_owner: t_simple_user + created_at: string + devcontainer_path?: (string | null) | undefined + display_name?: (string | null) | undefined + environment_id: string | null + git_status: { + ahead?: number | undefined + behind?: number | undefined + has_uncommitted_changes?: boolean | undefined + has_unpushed_changes?: boolean | undefined + ref?: string | undefined + } + id: number + idle_timeout_minutes: number | null + idle_timeout_notice?: (string | null) | undefined + last_known_stop_notice?: (string | null) | undefined + last_used_at: string + location: "EastUs" | "SouthEastAsia" | "WestEurope" | "WestUs2" + machine: t_nullable_codespace_machine + machines_url: string + name: string + owner: t_simple_user + pending_operation?: (boolean | null) | undefined + pending_operation_disabled_reason?: (string | null) | undefined + prebuild: boolean | null + publish_url?: (string | null) | undefined + pulls_url: string | null + recent_folders: string[] + repository: t_minimal_repository + retention_expires_at?: (string | null) | undefined + retention_period_minutes?: (number | null) | undefined + runtime_constraints?: + | { + allowed_port_privacy_settings?: (string[] | null) | undefined + } + | undefined + start_url: string + state: + | "Unknown" + | "Created" + | "Queued" + | "Provisioning" + | "Available" + | "Awaiting" + | "Unavailable" + | "Deleted" + | "Moved" + | "Shutdown" + | "Archived" + | "Starting" + | "ShuttingDown" + | "Failed" + | "Exporting" + | "Updating" + | "Rebuilding" + stop_url: string + updated_at: string + url: string + web_url: string +} + +export type t_codespace_export_details = { + branch?: (string | null) | undefined + completed_at?: (string | null) | undefined + export_url?: string | undefined + html_url?: (string | null) | undefined + id?: string | undefined + sha?: (string | null) | undefined + state?: (string | null) | undefined +} + +export type t_codespace_machine = { + cpus: number + display_name: string + memory_in_bytes: number + name: string + operating_system: string + prebuild_availability: "none" | "ready" | "in_progress" | null + storage_in_bytes: number +} + +export type t_codespace_with_full_repository = { + billable_owner: t_simple_user + created_at: string + devcontainer_path?: (string | null) | undefined + display_name?: (string | null) | undefined + environment_id: string | null + git_status: { + ahead?: number | undefined + behind?: number | undefined + has_uncommitted_changes?: boolean | undefined + has_unpushed_changes?: boolean | undefined + ref?: string | undefined + } + id: number + idle_timeout_minutes: number | null + idle_timeout_notice?: (string | null) | undefined + last_used_at: string + location: "EastUs" | "SouthEastAsia" | "WestEurope" | "WestUs2" + machine: t_nullable_codespace_machine + machines_url: string + name: string + owner: t_simple_user + pending_operation?: (boolean | null) | undefined + pending_operation_disabled_reason?: (string | null) | undefined + prebuild: boolean | null + publish_url?: (string | null) | undefined + pulls_url: string | null + recent_folders: string[] + repository: t_full_repository + retention_expires_at?: (string | null) | undefined + retention_period_minutes?: (number | null) | undefined + runtime_constraints?: + | { + allowed_port_privacy_settings?: (string[] | null) | undefined + } + | undefined + start_url: string + state: + | "Unknown" + | "Created" + | "Queued" + | "Provisioning" + | "Available" + | "Awaiting" + | "Unavailable" + | "Deleted" + | "Moved" + | "Shutdown" + | "Archived" + | "Starting" + | "ShuttingDown" + | "Failed" + | "Exporting" + | "Updating" + | "Rebuilding" + stop_url: string + updated_at: string + url: string + web_url: string +} + +export type t_codespaces_org_secret = { + created_at: string + name: string + selected_repositories_url?: string | undefined + updated_at: string + visibility: "all" | "private" | "selected" +} + +export type t_codespaces_permissions_check_for_devcontainer = { + accepted: boolean +} + +export type t_codespaces_public_key = { + created_at?: string | undefined + id?: number | undefined + key: string + key_id: string + title?: string | undefined + url?: string | undefined +} + +export type t_codespaces_secret = { + created_at: string + name: string + selected_repositories_url: string + updated_at: string + visibility: "all" | "private" | "selected" +} + +export type t_codespaces_user_public_key = { + key: string + key_id: string +} + +export type t_collaborator = { + avatar_url: string + email?: (string | null) | undefined + events_url: string + followers_url: string + following_url: string + gists_url: string + gravatar_id: string | null + html_url: string + id: number + login: string + name?: (string | null) | undefined + node_id: string + organizations_url: string + permissions?: + | { + admin: boolean + maintain?: boolean | undefined + pull: boolean + push: boolean + triage?: boolean | undefined + } + | undefined + received_events_url: string + repos_url: string + role_name: string + site_admin: boolean + starred_url: string + subscriptions_url: string + type: string + url: string + user_view_type?: string | undefined +} + +export type t_combined_billing_usage = { + days_left_in_billing_cycle: number + estimated_paid_storage_for_month: number + estimated_storage_for_month: number +} + +export type t_combined_commit_status = { + commit_url: string + repository: t_minimal_repository + sha: string + state: string + statuses: t_simple_commit_status[] + total_count: number + url: string +} + +export type t_commit = { + author: t_simple_user | t_empty_object | null + comments_url: string + commit: { + author: t_nullable_git_user + comment_count: number + committer: t_nullable_git_user + message: string + tree: { + sha: string + url: string + } + url: string + verification?: t_verification | undefined + } + committer: t_simple_user | t_empty_object | null + files?: t_diff_entry[] | undefined + html_url: string + node_id: string + parents: { + html_url?: string | undefined + sha: string + url: string + }[] + sha: string + stats?: + | { + additions?: number | undefined + deletions?: number | undefined + total?: number | undefined + } + | undefined + url: string +} + +export type t_commit_activity = { + days: number[] + total: number + week: number +} + +export type t_commit_comment = { + author_association: t_author_association + body: string + commit_id: string + created_at: string + html_url: string + id: number + line: number | null + node_id: string + path: string | null + position: number | null + reactions?: t_reaction_rollup | undefined + updated_at: string + url: string + user: t_nullable_simple_user +} + +export type t_commit_comparison = { + ahead_by: number + base_commit: t_commit + behind_by: number + commits: t_commit[] + diff_url: string + files?: t_diff_entry[] | undefined + html_url: string + merge_base_commit: t_commit + patch_url: string + permalink_url: string + status: "diverged" | "ahead" | "behind" | "identical" + total_commits: number + url: string +} + +export type t_commit_search_result_item = { + author: t_nullable_simple_user + comments_url: string + commit: { + author: { + date: string + email: string + name: string + } + comment_count: number + committer: t_nullable_git_user + message: string + tree: { + sha: string + url: string + } + url: string + verification?: t_verification | undefined + } + committer: t_nullable_git_user + html_url: string + node_id: string + parents: { + html_url?: string | undefined + sha?: string | undefined + url?: string | undefined + }[] + repository: t_minimal_repository + score: number + sha: string + text_matches?: t_search_result_text_matches | undefined + url: string +} + +export type t_community_profile = { + content_reports_enabled?: boolean | undefined + description: string | null + documentation: string | null + files: { + code_of_conduct: t_nullable_code_of_conduct_simple + code_of_conduct_file: t_nullable_community_health_file + contributing: t_nullable_community_health_file + issue_template: t_nullable_community_health_file + license: t_nullable_license_simple + pull_request_template: t_nullable_community_health_file + readme: t_nullable_community_health_file + } + health_percentage: number + updated_at: string | null +} + +export type t_content_directory = { + _links: { + git: string | null + html: string | null + self: string + } + content?: string | undefined + download_url: string | null + git_url: string | null + html_url: string | null + name: string + path: string + sha: string + size: number + type: "dir" | "file" | "submodule" | "symlink" + url: string +}[] + +export type t_content_file = { + _links: { + git: string | null + html: string | null + self: string + } + content: string + download_url: string | null + encoding: string + git_url: string | null + html_url: string | null + name: string + path: string + sha: string + size: number + submodule_git_url?: string | undefined + target?: string | undefined + type: "file" + url: string +} + +export type t_content_submodule = { + _links: { + git: string | null + html: string | null + self: string + } + download_url: string | null + git_url: string | null + html_url: string | null + name: string + path: string + sha: string + size: number + submodule_git_url: string + type: "submodule" + url: string +} + +export type t_content_symlink = { + _links: { + git: string | null + html: string | null + self: string + } + download_url: string | null + git_url: string | null + html_url: string | null + name: string + path: string + sha: string + size: number + target: string + type: "symlink" + url: string +} + +export type t_content_traffic = { + count: number + path: string + title: string + uniques: number +} + +export type t_contributor = { + avatar_url?: string | undefined + contributions: number + email?: string | undefined + events_url?: string | undefined + followers_url?: string | undefined + following_url?: string | undefined + gists_url?: string | undefined + gravatar_id?: (string | null) | undefined + html_url?: string | undefined + id?: number | undefined + login?: string | undefined + name?: string | undefined + node_id?: string | undefined + organizations_url?: string | undefined + received_events_url?: string | undefined + repos_url?: string | undefined + site_admin?: boolean | undefined + starred_url?: string | undefined + subscriptions_url?: string | undefined + type: string + url?: string | undefined + user_view_type?: string | undefined +} + +export type t_contributor_activity = { + author: t_nullable_simple_user + total: number + weeks: { + a?: number | undefined + c?: number | undefined + d?: number | undefined + w?: number | undefined + }[] +} + +export type t_converted_note_to_issue_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_integration + project_card?: + | { + column_name: string + id: number + previous_column_name?: string | undefined + project_id: number + project_url: string + url: string + } + | undefined + url: string +} + +export type t_copilot_dotcom_chat = { + models?: + | { + custom_model_training_date?: (string | null) | undefined + is_custom_model?: boolean | undefined + name?: string | undefined + total_chats?: number | undefined + total_engaged_users?: number | undefined + }[] + | undefined + total_engaged_users?: number | undefined + [key: string]: unknown | undefined +} | null + +export type t_copilot_dotcom_pull_requests = { + repositories?: + | { + models?: + | { + custom_model_training_date?: (string | null) | undefined + is_custom_model?: boolean | undefined + name?: string | undefined + total_engaged_users?: number | undefined + total_pr_summaries_created?: number | undefined + }[] + | undefined + name?: string | undefined + total_engaged_users?: number | undefined + }[] + | undefined + total_engaged_users?: number | undefined + [key: string]: unknown | undefined +} | null + +export type t_copilot_ide_chat = { + editors?: + | { + models?: + | { + custom_model_training_date?: (string | null) | undefined + is_custom_model?: boolean | undefined + name?: string | undefined + total_chat_copy_events?: number | undefined + total_chat_insertion_events?: number | undefined + total_chats?: number | undefined + total_engaged_users?: number | undefined + }[] + | undefined + name?: string | undefined + total_engaged_users?: number | undefined + }[] + | undefined + total_engaged_users?: number | undefined + [key: string]: unknown | undefined +} | null + +export type t_copilot_ide_code_completions = { + editors?: + | { + models?: + | { + custom_model_training_date?: (string | null) | undefined + is_custom_model?: boolean | undefined + languages?: + | { + name?: string | undefined + total_code_acceptances?: number | undefined + total_code_lines_accepted?: number | undefined + total_code_lines_suggested?: number | undefined + total_code_suggestions?: number | undefined + total_engaged_users?: number | undefined + }[] + | undefined + name?: string | undefined + total_engaged_users?: number | undefined + }[] + | undefined + name?: string | undefined + total_engaged_users?: number | undefined + [key: string]: unknown | undefined + }[] + | undefined + languages?: + | { + name?: string | undefined + total_engaged_users?: number | undefined + }[] + | undefined + total_engaged_users?: number | undefined + [key: string]: unknown | undefined +} | null + +export type t_copilot_organization_details = { + cli?: ("enabled" | "disabled" | "unconfigured") | undefined + ide_chat?: ("enabled" | "disabled" | "unconfigured") | undefined + plan_type?: ("business" | "enterprise") | undefined + platform_chat?: ("enabled" | "disabled" | "unconfigured") | undefined + public_code_suggestions: "allow" | "block" | "unconfigured" + seat_breakdown: t_copilot_organization_seat_breakdown + seat_management_setting: + | "assign_all" + | "assign_selected" + | "disabled" + | "unconfigured" + [key: string]: unknown | undefined +} + +export type t_copilot_organization_seat_breakdown = { + active_this_cycle?: number | undefined + added_this_cycle?: number | undefined + inactive_this_cycle?: number | undefined + pending_cancellation?: number | undefined + pending_invitation?: number | undefined + total?: number | undefined +} + +export type t_copilot_seat_details = { + assignee?: t_nullable_simple_user | undefined + assigning_team?: (t_team | t_enterprise_team | null) | undefined + created_at: string + last_activity_at?: (string | null) | undefined + last_activity_editor?: (string | null) | undefined + organization?: t_nullable_organization_simple | undefined + pending_cancellation_date?: (string | null) | undefined + plan_type?: ("business" | "enterprise" | "unknown") | undefined + updated_at?: string | undefined +} + +export type t_copilot_usage_metrics_day = { + copilot_dotcom_chat?: t_copilot_dotcom_chat | undefined + copilot_dotcom_pull_requests?: t_copilot_dotcom_pull_requests | undefined + copilot_ide_chat?: t_copilot_ide_chat | undefined + copilot_ide_code_completions?: t_copilot_ide_code_completions | undefined + date: string + total_active_users?: number | undefined + total_engaged_users?: number | undefined + [key: string]: unknown | undefined +} + +export type t_custom_deployment_rule_app = { + id: number + integration_url: string + node_id: string + slug: string +} + +export type t_custom_property = { + allowed_values?: (string[] | null) | undefined + default_value?: (string | string[] | null) | undefined + description?: (string | null) | undefined + property_name: string + required?: boolean | undefined + source_type?: ("organization" | "enterprise") | undefined + url?: string | undefined + value_type: "string" | "single_select" | "multi_select" | "true_false" + values_editable_by?: ("org_actors" | "org_and_repo_actors" | null) | undefined +} + +export type t_custom_property_value = { + property_name: string + value: string | string[] | null +} + +export type t_cvss_severities = { + cvss_v3?: + | ({ + readonly score: number | null + vector_string: string | null + } | null) + | undefined + cvss_v4?: + | ({ + readonly score: number | null + vector_string: string | null + } | null) + | undefined +} | null + +export type t_demilestoned_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + milestone: { + title: string + } + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_dependabot_alert = { + auto_dismissed_at?: t_alert_auto_dismissed_at | undefined + created_at: t_alert_created_at + readonly dependency: { + readonly manifest_path?: string | undefined + package?: t_dependabot_alert_package | undefined + readonly relationship?: + | ("unknown" | "direct" | "transitive" | null) + | undefined + readonly scope?: ("development" | "runtime" | null) | undefined + } + dismissed_at: t_alert_dismissed_at + dismissed_by: t_nullable_simple_user + dismissed_comment: string | null + dismissed_reason: + | "fix_started" + | "inaccurate" + | "no_bandwidth" + | "not_used" + | "tolerable_risk" + | null + fixed_at: t_alert_fixed_at + html_url: t_alert_html_url + number: t_alert_number + security_advisory: t_dependabot_alert_security_advisory + security_vulnerability: t_dependabot_alert_security_vulnerability + readonly state: "auto_dismissed" | "dismissed" | "fixed" | "open" + updated_at: t_alert_updated_at + url: t_alert_url +} + +export type t_dependabot_alert_package = { + readonly ecosystem: string + readonly name: string +} + +export type t_dependabot_alert_security_advisory = { + readonly cve_id: string | null + readonly cvss: { + readonly score: number + readonly vector_string: string | null + } + cvss_severities?: t_cvss_severities | undefined + readonly cwes: { + readonly cwe_id: string + readonly name: string + }[] + readonly description: string + epss?: t_security_advisory_epss | undefined + readonly ghsa_id: string + readonly identifiers: { + readonly type: "CVE" | "GHSA" + readonly value: string + }[] + readonly published_at: string + readonly references: { + readonly url: string + }[] + readonly severity: "low" | "medium" | "high" | "critical" + readonly summary: string + readonly updated_at: string + readonly vulnerabilities: t_dependabot_alert_security_vulnerability[] + readonly withdrawn_at: string | null +} + +export type t_dependabot_alert_security_vulnerability = { + readonly first_patched_version: { + readonly identifier: string + } | null + package: t_dependabot_alert_package + readonly severity: "low" | "medium" | "high" | "critical" + readonly vulnerable_version_range: string +} + +export type t_dependabot_alert_with_repository = { + auto_dismissed_at?: t_alert_auto_dismissed_at | undefined + created_at: t_alert_created_at + readonly dependency: { + readonly manifest_path?: string | undefined + package?: t_dependabot_alert_package | undefined + readonly relationship?: + | ("unknown" | "direct" | "transitive" | null) + | undefined + readonly scope?: ("development" | "runtime" | null) | undefined + } + dismissed_at: t_alert_dismissed_at + dismissed_by: t_nullable_simple_user + dismissed_comment: string | null + dismissed_reason: + | "fix_started" + | "inaccurate" + | "no_bandwidth" + | "not_used" + | "tolerable_risk" + | null + fixed_at: t_alert_fixed_at + html_url: t_alert_html_url + number: t_alert_number + repository: t_simple_repository + security_advisory: t_dependabot_alert_security_advisory + security_vulnerability: t_dependabot_alert_security_vulnerability + readonly state: "auto_dismissed" | "dismissed" | "fixed" | "open" + updated_at: t_alert_updated_at + url: t_alert_url +} + +export type t_dependabot_public_key = { + key: string + key_id: string +} + +export type t_dependabot_secret = { + created_at: string + name: string + updated_at: string +} + +export type t_dependency = { + dependencies?: string[] | undefined + metadata?: t_metadata | undefined + package_url?: string | undefined + relationship?: ("direct" | "indirect") | undefined + scope?: ("runtime" | "development") | undefined +} + +export type t_dependency_graph_diff = { + change_type: "added" | "removed" + ecosystem: string + license: string | null + manifest: string + name: string + package_url: string | null + scope: "unknown" | "runtime" | "development" + source_repository_url: string | null + version: string + vulnerabilities: { + advisory_ghsa_id: string + advisory_summary: string + advisory_url: string + severity: string + }[] +}[] + +export type t_dependency_graph_spdx_sbom = { + sbom: { + SPDXID: string + comment?: string | undefined + creationInfo: { + created: string + creators: string[] + } + dataLicense: string + documentNamespace: string + name: string + packages: { + SPDXID?: string | undefined + copyrightText?: string | undefined + downloadLocation?: string | undefined + externalRefs?: + | { + referenceCategory: string + referenceLocator: string + referenceType: string + }[] + | undefined + filesAnalyzed?: boolean | undefined + licenseConcluded?: string | undefined + licenseDeclared?: string | undefined + name?: string | undefined + supplier?: string | undefined + versionInfo?: string | undefined + }[] + relationships?: + | { + relatedSpdxElement?: string | undefined + relationshipType?: string | undefined + spdxElementId?: string | undefined + }[] + | undefined + spdxVersion: string + } +} + +export type t_deploy_key = { + added_by?: (string | null) | undefined + created_at: string + enabled?: boolean | undefined + id: number + key: string + last_used?: (string | null) | undefined + read_only: boolean + title: string + url: string + verified: boolean +} + +export type t_deployment = { + created_at: string + creator: t_nullable_simple_user + description: string | null + environment: string + id: number + node_id: string + original_environment?: string | undefined + payload: + | { + [key: string]: unknown | undefined + } + | string + performed_via_github_app?: t_nullable_integration | undefined + production_environment?: boolean | undefined + ref: string + repository_url: string + sha: string + statuses_url: string + task: string + transient_environment?: boolean | undefined + updated_at: string + url: string +} + +export type t_deployment_branch_policy = { + id?: number | undefined + name?: string | undefined + node_id?: string | undefined + type?: ("branch" | "tag") | undefined +} + +export type t_deployment_branch_policy_settings = { + custom_branch_policies: boolean + protected_branches: boolean +} | null + +export type t_deployment_protection_rule = { + app: t_custom_deployment_rule_app + enabled: boolean + id: number + node_id: string +} + +export type t_deployment_reviewer_type = "User" | "Team" + +export type t_deployment_simple = { + created_at: string + description: string | null + environment: string + id: number + node_id: string + original_environment?: string | undefined + performed_via_github_app?: t_nullable_integration | undefined + production_environment?: boolean | undefined + repository_url: string + statuses_url: string + task: string + transient_environment?: boolean | undefined + updated_at: string + url: string +} + +export type t_deployment_status = { + created_at: string + creator: t_nullable_simple_user + deployment_url: string + description: string + environment?: string | undefined + environment_url?: string | undefined + id: number + log_url?: string | undefined + node_id: string + performed_via_github_app?: t_nullable_integration | undefined + repository_url: string + state: + | "error" + | "failure" + | "inactive" + | "pending" + | "success" + | "queued" + | "in_progress" + target_url: string + updated_at: string + url: string +} + +export type t_diff_entry = { + additions: number + blob_url: string + changes: number + contents_url: string + deletions: number + filename: string + patch?: string | undefined + previous_filename?: string | undefined + raw_url: string + sha: string + status: + | "added" + | "removed" + | "modified" + | "renamed" + | "copied" + | "changed" + | "unchanged" +} + +export type t_email = { + email: string + primary: boolean + verified: boolean + visibility: string | null +} + +export type t_empty_object = EmptyObject + +export type t_enabled_repositories = "all" | "none" | "selected" + +export type t_enterprise = { + avatar_url: string + created_at: string | null + description?: (string | null) | undefined + html_url: string + id: number + name: string + node_id: string + slug: string + updated_at: string | null + website_url?: (string | null) | undefined +} + +export type t_enterprise_team = { + created_at: string + group_id?: (string | null) | undefined + group_name?: (string | null) | undefined + html_url: string + id: number + members_url: string + name: string + slug: string + sync_to_organizations: string + updated_at: string + url: string +} + +export type t_environment = { + created_at: string + deployment_branch_policy?: t_deployment_branch_policy_settings | undefined + html_url: string + id: number + name: string + node_id: string + protection_rules?: + | ( + | { + id: number + node_id: string + type: string + wait_timer?: t_wait_timer | undefined + } + | { + id: number + node_id: string + prevent_self_review?: boolean | undefined + reviewers?: + | { + reviewer?: (t_simple_user | t_team) | undefined + type?: t_deployment_reviewer_type | undefined + }[] + | undefined + type: string + } + | { + id: number + node_id: string + type: string + } + )[] + | undefined + updated_at: string + url: string +} + +export type t_environment_approvals = { + comment: string + environments: { + created_at?: string | undefined + html_url?: string | undefined + id?: number | undefined + name?: string | undefined + node_id?: string | undefined + updated_at?: string | undefined + url?: string | undefined + }[] + state: "approved" | "rejected" | "pending" + user: t_simple_user +} + +export type t_event = { + actor: t_actor + created_at: string | null + id: string + org?: t_actor | undefined + payload: { + action?: string | undefined + comment?: t_issue_comment | undefined + issue?: t_issue | undefined + pages?: + | { + action?: string | undefined + html_url?: string | undefined + page_name?: string | undefined + sha?: string | undefined + summary?: (string | null) | undefined + title?: string | undefined + }[] + | undefined + } + public: boolean + repo: { + id: number + name: string + url: string + } + type: string | null +} + +export type t_feed = { + _links: { + current_user?: t_link_with_type | undefined + current_user_actor?: t_link_with_type | undefined + current_user_organization?: t_link_with_type | undefined + current_user_organizations?: t_link_with_type[] | undefined + current_user_public?: t_link_with_type | undefined + repository_discussions?: t_link_with_type | undefined + repository_discussions_category?: t_link_with_type | undefined + security_advisories?: t_link_with_type | undefined + timeline: t_link_with_type + user: t_link_with_type + } + current_user_actor_url?: string | undefined + current_user_organization_url?: string | undefined + current_user_organization_urls?: string[] | undefined + current_user_public_url?: string | undefined + current_user_url?: string | undefined + repository_discussions_category_url?: string | undefined + repository_discussions_url?: string | undefined + security_advisories_url?: string | undefined + timeline_url: string + user_url: string +} + +export type t_file_commit = { + commit: { + author?: + | { + date?: string | undefined + email?: string | undefined + name?: string | undefined + } + | undefined + committer?: + | { + date?: string | undefined + email?: string | undefined + name?: string | undefined + } + | undefined + html_url?: string | undefined + message?: string | undefined + node_id?: string | undefined + parents?: + | { + html_url?: string | undefined + sha?: string | undefined + url?: string | undefined + }[] + | undefined + sha?: string | undefined + tree?: + | { + sha?: string | undefined + url?: string | undefined + } + | undefined + url?: string | undefined + verification?: + | { + payload?: (string | null) | undefined + reason?: string | undefined + signature?: (string | null) | undefined + verified?: boolean | undefined + verified_at?: (string | null) | undefined + } + | undefined + } + content: { + _links?: + | { + git?: string | undefined + html?: string | undefined + self?: string | undefined + } + | undefined + download_url?: string | undefined + git_url?: string | undefined + html_url?: string | undefined + name?: string | undefined + path?: string | undefined + sha?: string | undefined + size?: number | undefined + type?: string | undefined + url?: string | undefined + } | null +} + +export type t_full_repository = { + allow_auto_merge?: boolean | undefined + allow_forking?: boolean | undefined + allow_merge_commit?: boolean | undefined + allow_rebase_merge?: boolean | undefined + allow_squash_merge?: boolean | undefined + allow_update_branch?: boolean | undefined + anonymous_access_enabled?: boolean | undefined + archive_url: string + archived: boolean + assignees_url: string + blobs_url: string + branches_url: string + clone_url: string + code_of_conduct?: t_code_of_conduct_simple | undefined + collaborators_url: string + comments_url: string + commits_url: string + compare_url: string + contents_url: string + contributors_url: string + created_at: string + custom_properties?: + | { + [key: string]: unknown | undefined + } + | undefined + default_branch: string + delete_branch_on_merge?: boolean | undefined + deployments_url: string + description: string | null + disabled: boolean + downloads_url: string + events_url: string + fork: boolean + forks: number + forks_count: number + forks_url: string + full_name: string + git_commits_url: string + git_refs_url: string + git_tags_url: string + git_url: string + has_discussions: boolean + has_downloads?: boolean | undefined + has_issues: boolean + has_pages: boolean + has_projects: boolean + has_wiki: boolean + homepage: string | null + hooks_url: string + html_url: string + id: number + is_template?: boolean | undefined + issue_comment_url: string + issue_events_url: string + issues_url: string + keys_url: string + labels_url: string + language: string | null + languages_url: string + license: t_nullable_license_simple + master_branch?: string | undefined + merge_commit_message?: ("PR_BODY" | "PR_TITLE" | "BLANK") | undefined + merge_commit_title?: ("PR_TITLE" | "MERGE_MESSAGE") | undefined + merges_url: string + milestones_url: string + mirror_url: string | null + name: string + network_count: number + node_id: string + notifications_url: string + open_issues: number + open_issues_count: number + organization?: t_nullable_simple_user | undefined + owner: t_simple_user + parent?: t_repository | undefined + permissions?: + | { + admin: boolean + maintain?: boolean | undefined + pull: boolean + push: boolean + triage?: boolean | undefined + } + | undefined + private: boolean + pulls_url: string + pushed_at: string + releases_url: string + security_and_analysis?: t_security_and_analysis | undefined + size: number + source?: t_repository | undefined + squash_merge_commit_message?: + | ("PR_BODY" | "COMMIT_MESSAGES" | "BLANK") + | undefined + squash_merge_commit_title?: ("PR_TITLE" | "COMMIT_OR_PR_TITLE") | undefined + ssh_url: string + stargazers_count: number + stargazers_url: string + statuses_url: string + subscribers_count: number + subscribers_url: string + subscription_url: string + svn_url: string + tags_url: string + teams_url: string + temp_clone_token?: (string | null) | undefined + template_repository?: t_nullable_repository | undefined + topics?: string[] | undefined + trees_url: string + updated_at: string + url: string + use_squash_pr_title_as_default?: boolean | undefined + visibility?: string | undefined + watchers: number + watchers_count: number + web_commit_signoff_required?: boolean | undefined +} + +export type t_gist_comment = { + author_association: t_author_association + body: string + created_at: string + id: number + node_id: string + updated_at: string + url: string + user: t_nullable_simple_user +} + +export type t_gist_commit = { + change_status: { + additions?: number | undefined + deletions?: number | undefined + total?: number | undefined + } + committed_at: string + url: string + user: t_nullable_simple_user + version: string +} + +export type t_gist_history = { + change_status?: + | { + additions?: number | undefined + deletions?: number | undefined + total?: number | undefined + } + | undefined + committed_at?: string | undefined + url?: string | undefined + user?: t_nullable_simple_user | undefined + version?: string | undefined +} + +export type t_gist_simple = { + comments?: number | undefined + comments_enabled?: boolean | undefined + comments_url?: string | undefined + commits_url?: string | undefined + created_at?: string | undefined + description?: (string | null) | undefined + files?: + | { + [key: string]: + | ({ + content?: string | undefined + encoding?: string | undefined + filename?: string | undefined + language?: string | undefined + raw_url?: string | undefined + size?: number | undefined + truncated?: boolean | undefined + type?: string | undefined + } | null) + | undefined + } + | undefined + fork_of?: + | ({ + comments: number + comments_enabled?: boolean | undefined + comments_url: string + commits_url: string + created_at: string + description: string | null + files: { + [key: string]: + | { + filename?: string | undefined + language?: string | undefined + raw_url?: string | undefined + size?: number | undefined + type?: string | undefined + } + | undefined + } + forks?: unknown[] | undefined + forks_url: string + git_pull_url: string + git_push_url: string + history?: unknown[] | undefined + html_url: string + id: string + node_id: string + owner?: t_nullable_simple_user | undefined + public: boolean + truncated?: boolean | undefined + updated_at: string + url: string + user: t_nullable_simple_user + } | null) + | undefined + forks?: + | ( + | { + created_at?: string | undefined + id?: string | undefined + updated_at?: string | undefined + url?: string | undefined + user?: t_public_user | undefined + }[] + | null + ) + | undefined + forks_url?: string | undefined + git_pull_url?: string | undefined + git_push_url?: string | undefined + history?: (t_gist_history[] | null) | undefined + html_url?: string | undefined + id?: string | undefined + node_id?: string | undefined + owner?: t_simple_user | undefined + public?: boolean | undefined + truncated?: boolean | undefined + updated_at?: string | undefined + url?: string | undefined + user?: (string | null) | undefined +} + +export type t_git_commit = { + author: { + date: string + email: string + name: string + } + committer: { + date: string + email: string + name: string + } + html_url: string + message: string + node_id: string + parents: { + html_url: string + sha: string + url: string + }[] + sha: string + tree: { + sha: string + url: string + } + url: string + verification: { + payload: string | null + reason: string + signature: string | null + verified: boolean + verified_at: string | null + } +} + +export type t_git_ref = { + node_id: string + object: { + sha: string + type: string + url: string + } + ref: string + url: string +} + +export type t_git_tag = { + message: string + node_id: string + object: { + sha: string + type: string + url: string + } + sha: string + tag: string + tagger: { + date: string + email: string + name: string + } + url: string + verification?: t_verification | undefined +} + +export type t_git_tree = { + sha: string + tree: { + mode: string + path: string + sha: string + size?: number | undefined + type: string + url?: string | undefined + }[] + truncated: boolean + url?: string | undefined +} + +export type t_gitignore_template = { + name: string + source: string +} + +export type t_global_advisory = { + readonly credits: + | { + type: t_security_advisory_credit_types + user: t_simple_user + }[] + | null + readonly cve_id: string | null + cvss: { + readonly score: number | null + vector_string: string | null + } | null + cvss_severities?: t_cvss_severities | undefined + cwes: + | { + cwe_id: string + readonly name: string + }[] + | null + description: string | null + epss?: t_security_advisory_epss | undefined + readonly ghsa_id: string + readonly github_reviewed_at: string | null + readonly html_url: string + readonly identifiers: + | { + type: "CVE" | "GHSA" + value: string + }[] + | null + readonly nvd_published_at: string | null + readonly published_at: string + references: string[] | null + readonly repository_advisory_url: string | null + severity: "critical" | "high" | "medium" | "low" | "unknown" + source_code_location: string | null + summary: string + readonly type: "reviewed" | "unreviewed" | "malware" + readonly updated_at: string + readonly url: string + vulnerabilities: t_vulnerability[] | null + readonly withdrawn_at: string | null +} + +export type t_gpg_key = { + can_certify: boolean + can_encrypt_comms: boolean + can_encrypt_storage: boolean + can_sign: boolean + created_at: string + emails: { + email?: string | undefined + verified?: boolean | undefined + }[] + expires_at: string | null + id: number + key_id: string + name?: (string | null) | undefined + primary_key_id: number | null + public_key: string + raw_key: string | null + revoked: boolean + subkeys: { + can_certify?: boolean | undefined + can_encrypt_comms?: boolean | undefined + can_encrypt_storage?: boolean | undefined + can_sign?: boolean | undefined + created_at?: string | undefined + emails?: + | { + email?: string | undefined + verified?: boolean | undefined + }[] + | undefined + expires_at?: (string | null) | undefined + id?: number | undefined + key_id?: string | undefined + primary_key_id?: number | undefined + public_key?: string | undefined + raw_key?: (string | null) | undefined + revoked?: boolean | undefined + subkeys?: unknown[] | undefined + }[] +} + +export type t_hook = { + active: boolean + config: t_webhook_config + created_at: string + deliveries_url?: string | undefined + events: string[] + id: number + last_response: t_hook_response + name: string + ping_url: string + test_url: string + type: string + updated_at: string + url: string +} + +export type t_hook_delivery = { + action: string | null + delivered_at: string + duration: number + event: string + guid: string + id: number + installation_id: number | null + redelivery: boolean + repository_id: number | null + request: { + headers: { + [key: string]: unknown | undefined + } | null + payload: { + [key: string]: unknown | undefined + } | null + } + response: { + headers: { + [key: string]: unknown | undefined + } | null + payload: string | null + } + status: string + status_code: number + throttled_at?: (string | null) | undefined + url?: string | undefined +} + +export type t_hook_delivery_item = { + action: string | null + delivered_at: string + duration: number + event: string + guid: string + id: number + installation_id: number | null + redelivery: boolean + repository_id: number | null + status: string + status_code: number + throttled_at?: (string | null) | undefined +} + +export type t_hook_response = { + code: number | null + message: string | null + status: string | null +} + +export type t_hovercard = { + contexts: { + message: string + octicon: string + }[] +} + +export type t_import = { + authors_count?: (number | null) | undefined + authors_url: string + commit_count?: (number | null) | undefined + error_message?: (string | null) | undefined + failed_step?: (string | null) | undefined + has_large_files?: boolean | undefined + html_url: string + import_percent?: (number | null) | undefined + large_files_count?: number | undefined + large_files_size?: number | undefined + message?: string | undefined + project_choices?: + | { + human_name?: string | undefined + tfvc_project?: string | undefined + vcs?: string | undefined + }[] + | undefined + push_percent?: (number | null) | undefined + repository_url: string + status: + | "auth" + | "error" + | "none" + | "detecting" + | "choose" + | "auth_failed" + | "importing" + | "mapping" + | "waiting_to_push" + | "pushing" + | "complete" + | "setup" + | "unknown" + | "detection_found_multiple" + | "detection_found_nothing" + | "detection_needs_auth" + status_text?: (string | null) | undefined + svc_root?: string | undefined + svn_root?: string | undefined + tfvc_project?: string | undefined + url: string + use_lfs?: boolean | undefined + vcs: string | null + vcs_url: string +} + +export type t_installation = { + access_tokens_url: string + account: t_simple_user | t_enterprise | null + app_id: number + app_slug: string + contact_email?: (string | null) | undefined + created_at: string + events: string[] + has_multiple_single_files?: boolean | undefined + html_url: string + id: number + permissions: t_app_permissions + repositories_url: string + repository_selection: "all" | "selected" + single_file_name: string | null + single_file_paths?: string[] | undefined + suspended_at: string | null + suspended_by: t_nullable_simple_user + target_id: number + target_type: string + updated_at: string +} + +export type t_installation_token = { + expires_at: string + has_multiple_single_files?: boolean | undefined + permissions?: t_app_permissions | undefined + repositories?: t_repository[] | undefined + repository_selection?: ("all" | "selected") | undefined + single_file?: string | undefined + single_file_paths?: string[] | undefined + token: string +} + +export type t_integration = { + client_id?: string | undefined + client_secret?: string | undefined + created_at: string + description: string | null + events: string[] + external_url: string + html_url: string + id: number + installations_count?: number | undefined + name: string + node_id: string + owner: t_simple_user | t_enterprise + pem?: string | undefined + permissions: { + checks?: string | undefined + contents?: string | undefined + deployments?: string | undefined + issues?: string | undefined + metadata?: string | undefined + [key: string]: string | undefined + } + slug?: string | undefined + updated_at: string + webhook_secret?: (string | null) | undefined +} | null + +export type t_integration_installation_request = { + account: t_simple_user | t_enterprise + created_at: string + id: number + node_id?: string | undefined + requester: t_simple_user +} + +export type t_interaction_expiry = + | "one_day" + | "three_days" + | "one_week" + | "one_month" + | "six_months" + +export type t_interaction_group = + | "existing_users" + | "contributors_only" + | "collaborators_only" + +export type t_interaction_limit_response = { + expires_at: string + limit: t_interaction_group + origin: string +} + +export type t_issue = { + active_lock_reason?: (string | null) | undefined + assignee: t_nullable_simple_user + assignees?: (t_simple_user[] | null) | undefined + author_association: t_author_association + body?: (string | null) | undefined + body_html?: string | undefined + body_text?: string | undefined + closed_at: string | null + closed_by?: t_nullable_simple_user | undefined + comments: number + comments_url: string + created_at: string + draft?: boolean | undefined + events_url: string + html_url: string + id: number + labels: ( + | string + | { + color?: (string | null) | undefined + default?: boolean | undefined + description?: (string | null) | undefined + id?: number | undefined + name?: string | undefined + node_id?: string | undefined + url?: string | undefined + } + )[] + labels_url: string + locked: boolean + milestone: t_nullable_milestone + node_id: string + number: number + performed_via_github_app?: t_nullable_integration | undefined + pull_request?: + | { + diff_url: string | null + html_url: string | null + merged_at?: (string | null) | undefined + patch_url: string | null + url: string | null + } + | undefined + reactions?: t_reaction_rollup | undefined + repository?: t_repository | undefined + repository_url: string + state: string + state_reason?: ("completed" | "reopened" | "not_planned" | null) | undefined + sub_issues_summary?: t_sub_issues_summary | undefined + timeline_url?: string | undefined + title: string + type?: t_issue_type | undefined + updated_at: string + url: string + user: t_nullable_simple_user +} + +export type t_issue_comment = { + author_association: t_author_association + body?: string | undefined + body_html?: string | undefined + body_text?: string | undefined + created_at: string + html_url: string + id: number + issue_url: string + node_id: string + performed_via_github_app?: t_nullable_integration | undefined + reactions?: t_reaction_rollup | undefined + updated_at: string + url: string + user: t_nullable_simple_user +} + +export type t_issue_event = { + actor: t_nullable_simple_user + assignee?: t_nullable_simple_user | undefined + assigner?: t_nullable_simple_user | undefined + author_association?: t_author_association | undefined + commit_id: string | null + commit_url: string | null + created_at: string + dismissed_review?: t_issue_event_dismissed_review | undefined + event: string + id: number + issue?: t_nullable_issue | undefined + label?: t_issue_event_label | undefined + lock_reason?: (string | null) | undefined + milestone?: t_issue_event_milestone | undefined + node_id: string + performed_via_github_app?: t_nullable_integration | undefined + project_card?: t_issue_event_project_card | undefined + rename?: t_issue_event_rename | undefined + requested_reviewer?: t_nullable_simple_user | undefined + requested_team?: t_team | undefined + review_requester?: t_nullable_simple_user | undefined + url: string +} + +export type t_issue_event_dismissed_review = { + dismissal_commit_id?: (string | null) | undefined + dismissal_message: string | null + review_id: number + state: string +} + +export type t_issue_event_for_issue = + | t_labeled_issue_event + | t_unlabeled_issue_event + | t_assigned_issue_event + | t_unassigned_issue_event + | t_milestoned_issue_event + | t_demilestoned_issue_event + | t_renamed_issue_event + | t_review_requested_issue_event + | t_review_request_removed_issue_event + | t_review_dismissed_issue_event + | t_locked_issue_event + | t_added_to_project_issue_event + | t_moved_column_in_project_issue_event + | t_removed_from_project_issue_event + | t_converted_note_to_issue_issue_event + +export type t_issue_event_label = { + color: string | null + name: string | null +} + +export type t_issue_event_milestone = { + title: string +} + +export type t_issue_event_project_card = { + column_name: string + id: number + previous_column_name?: string | undefined + project_id: number + project_url: string + url: string +} + +export type t_issue_event_rename = { + from: string + to: string +} + +export type t_issue_search_result_item = { + active_lock_reason?: (string | null) | undefined + assignee: t_nullable_simple_user + assignees?: (t_simple_user[] | null) | undefined + author_association: t_author_association + body?: string | undefined + body_html?: string | undefined + body_text?: string | undefined + closed_at: string | null + comments: number + comments_url: string + created_at: string + draft?: boolean | undefined + events_url: string + html_url: string + id: number + labels: { + color?: string | undefined + default?: boolean | undefined + description?: (string | null) | undefined + id?: number | undefined + name?: string | undefined + node_id?: string | undefined + url?: string | undefined + }[] + labels_url: string + locked: boolean + milestone: t_nullable_milestone + node_id: string + number: number + performed_via_github_app?: t_nullable_integration | undefined + pull_request?: + | { + diff_url: string | null + html_url: string | null + merged_at?: (string | null) | undefined + patch_url: string | null + url: string | null + } + | undefined + reactions?: t_reaction_rollup | undefined + repository?: t_repository | undefined + repository_url: string + score: number + state: string + state_reason?: (string | null) | undefined + sub_issues_summary?: + | { + completed: number + percent_completed: number + total: number + } + | undefined + text_matches?: t_search_result_text_matches | undefined + timeline_url?: string | undefined + title: string + type?: t_issue_type | undefined + updated_at: string + url: string + user: t_nullable_simple_user +} + +export type t_issue_type = { + color?: + | ( + | "gray" + | "blue" + | "green" + | "yellow" + | "orange" + | "red" + | "pink" + | "purple" + | null + ) + | undefined + created_at?: string | undefined + description: string | null + id: number + is_enabled?: boolean | undefined + name: string + node_id: string + updated_at?: string | undefined +} | null + +export type t_job = { + check_run_url: string + completed_at: string | null + conclusion: + | "success" + | "failure" + | "neutral" + | "cancelled" + | "skipped" + | "timed_out" + | "action_required" + | null + created_at: string + head_branch: string | null + head_sha: string + html_url: string | null + id: number + labels: string[] + name: string + node_id: string + run_attempt?: number | undefined + run_id: number + run_url: string + runner_group_id: number | null + runner_group_name: string | null + runner_id: number | null + runner_name: string | null + started_at: string + status: + | "queued" + | "in_progress" + | "completed" + | "waiting" + | "requested" + | "pending" + steps?: + | { + completed_at?: (string | null) | undefined + conclusion: string | null + name: string + number: number + started_at?: (string | null) | undefined + status: "queued" | "in_progress" | "completed" + }[] + | undefined + url: string + workflow_name: string | null +} + +export type t_key = { + created_at: string + id: number + key: string + read_only: boolean + title: string + url: string + verified: boolean +} + +export type t_key_simple = { + id: number + key: string +} + +export type t_label = { + color: string + default: boolean + description: string | null + id: number + name: string + node_id: string + url: string +} + +export type t_label_search_result_item = { + color: string + default: boolean + description: string | null + id: number + name: string + node_id: string + score: number + text_matches?: t_search_result_text_matches | undefined + url: string +} + +export type t_labeled_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + label: { + color: string + name: string + } + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_language = { + [key: string]: number | undefined +} + +export type t_license = { + body: string + conditions: string[] + description: string + featured: boolean + html_url: string + implementation: string + key: string + limitations: string[] + name: string + node_id: string + permissions: string[] + spdx_id: string | null + url: string | null +} + +export type t_license_content = { + _links: { + git: string | null + html: string | null + self: string + } + content: string + download_url: string | null + encoding: string + git_url: string | null + html_url: string | null + license: t_nullable_license_simple + name: string + path: string + sha: string + size: number + type: string + url: string +} + +export type t_license_simple = { + html_url?: string | undefined + key: string + name: string + node_id: string + spdx_id: string | null + url: string | null +} + +export type t_link = { + href: string +} + +export type t_link_with_type = { + href: string + type: string +} + +export type t_locked_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + lock_reason: string | null + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_manifest = { + file?: + | { + source_location?: string | undefined + } + | undefined + metadata?: t_metadata | undefined + name: string + resolved?: + | { + [key: string]: t_dependency | undefined + } + | undefined +} + +export type t_marketplace_account = { + email?: (string | null) | undefined + id: number + login: string + node_id?: string | undefined + organization_billing_email?: (string | null) | undefined + type: string + url: string +} + +export type t_marketplace_listing_plan = { + accounts_url: string + bullets: string[] + description: string + has_free_trial: boolean + id: number + monthly_price_in_cents: number + name: string + number: number + price_model: "FREE" | "FLAT_RATE" | "PER_UNIT" + state: string + unit_name: string | null + url: string + yearly_price_in_cents: number +} + +export type t_marketplace_purchase = { + email?: (string | null) | undefined + id: number + login: string + marketplace_pending_change?: + | ({ + effective_date?: string | undefined + id?: number | undefined + is_installed?: boolean | undefined + plan?: t_marketplace_listing_plan | undefined + unit_count?: (number | null) | undefined + } | null) + | undefined + marketplace_purchase: { + billing_cycle?: string | undefined + free_trial_ends_on?: (string | null) | undefined + is_installed?: boolean | undefined + next_billing_date?: (string | null) | undefined + on_free_trial?: boolean | undefined + plan?: t_marketplace_listing_plan | undefined + unit_count?: (number | null) | undefined + updated_at?: string | undefined + } + organization_billing_email?: string | undefined + type: string + url: string +} + +export type t_merged_upstream = { + base_branch?: string | undefined + merge_type?: ("merge" | "fast-forward" | "none") | undefined + message?: string | undefined +} + +export type t_metadata = { + [key: string]: (string | number | boolean | null) | undefined +} + +export type t_migration = { + archive_url?: string | undefined + created_at: string + exclude?: string[] | undefined + exclude_attachments: boolean + exclude_git_data: boolean + exclude_metadata: boolean + exclude_owner_projects: boolean + exclude_releases: boolean + guid: string + id: number + lock_repositories: boolean + node_id: string + org_metadata_only: boolean + owner: t_nullable_simple_user + repositories: t_repository[] + state: string + updated_at: string + url: string +} + +export type t_milestone = { + closed_at: string | null + closed_issues: number + created_at: string + creator: t_nullable_simple_user + description: string | null + due_on: string | null + html_url: string + id: number + labels_url: string + node_id: string + number: number + open_issues: number + state: "open" | "closed" + title: string + updated_at: string + url: string +} + +export type t_milestoned_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + milestone: { + title: string + } + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_minimal_repository = { + allow_forking?: boolean | undefined + archive_url: string + archived?: boolean | undefined + assignees_url: string + blobs_url: string + branches_url: string + clone_url?: string | undefined + code_of_conduct?: t_code_of_conduct | undefined + collaborators_url: string + comments_url: string + commits_url: string + compare_url: string + contents_url: string + contributors_url: string + created_at?: (string | null) | undefined + default_branch?: string | undefined + delete_branch_on_merge?: boolean | undefined + deployments_url: string + description: string | null + disabled?: boolean | undefined + downloads_url: string + events_url: string + fork: boolean + forks?: number | undefined + forks_count?: number | undefined + forks_url: string + full_name: string + git_commits_url: string + git_refs_url: string + git_tags_url: string + git_url?: string | undefined + has_discussions?: boolean | undefined + has_downloads?: boolean | undefined + has_issues?: boolean | undefined + has_pages?: boolean | undefined + has_projects?: boolean | undefined + has_wiki?: boolean | undefined + homepage?: (string | null) | undefined + hooks_url: string + html_url: string + id: number + is_template?: boolean | undefined + issue_comment_url: string + issue_events_url: string + issues_url: string + keys_url: string + labels_url: string + language?: (string | null) | undefined + languages_url: string + license?: + | ({ + key?: string | undefined + name?: string | undefined + node_id?: string | undefined + spdx_id?: string | undefined + url?: string | undefined + } | null) + | undefined + merges_url: string + milestones_url: string + mirror_url?: (string | null) | undefined + name: string + network_count?: number | undefined + node_id: string + notifications_url: string + open_issues?: number | undefined + open_issues_count?: number | undefined + owner: t_simple_user + permissions?: + | { + admin?: boolean | undefined + maintain?: boolean | undefined + pull?: boolean | undefined + push?: boolean | undefined + triage?: boolean | undefined + } + | undefined + private: boolean + pulls_url: string + pushed_at?: (string | null) | undefined + releases_url: string + role_name?: string | undefined + security_and_analysis?: t_security_and_analysis | undefined + size?: number | undefined + ssh_url?: string | undefined + stargazers_count?: number | undefined + stargazers_url: string + statuses_url: string + subscribers_count?: number | undefined + subscribers_url: string + subscription_url: string + svn_url?: string | undefined + tags_url: string + teams_url: string + temp_clone_token?: string | undefined + topics?: string[] | undefined + trees_url: string + updated_at?: (string | null) | undefined + url: string + visibility?: string | undefined + watchers?: number | undefined + watchers_count?: number | undefined + web_commit_signoff_required?: boolean | undefined +} + +export type t_moved_column_in_project_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + project_card?: + | { + column_name: string + id: number + previous_column_name?: string | undefined + project_id: number + project_url: string + url: string + } + | undefined + url: string +} + +export type t_network_configuration = { + compute_service?: ("none" | "actions" | "codespaces") | undefined + created_on: string | null + id: string + name: string + network_settings_ids?: string[] | undefined +} + +export type t_network_settings = { + id: string + name: string + network_configuration_id?: string | undefined + region: string + subnet_id: string +} + +export type t_nullable_actions_hosted_runner_pool_image = { + display_name: string + id: string + size_gb: number + source: "github" | "partner" | "custom" +} | null + +export type t_nullable_alert_updated_at = string | null + +export type t_nullable_code_of_conduct_simple = { + html_url: string | null + key: string + name: string + url: string +} | null + +export type t_nullable_codespace_machine = { + cpus: number + display_name: string + memory_in_bytes: number + name: string + operating_system: string + prebuild_availability: "none" | "ready" | "in_progress" | null + storage_in_bytes: number +} | null + +export type t_nullable_collaborator = { + avatar_url: string + email?: (string | null) | undefined + events_url: string + followers_url: string + following_url: string + gists_url: string + gravatar_id: string | null + html_url: string + id: number + login: string + name?: (string | null) | undefined + node_id: string + organizations_url: string + permissions?: + | { + admin: boolean + maintain?: boolean | undefined + pull: boolean + push: boolean + triage?: boolean | undefined + } + | undefined + received_events_url: string + repos_url: string + role_name: string + site_admin: boolean + starred_url: string + subscriptions_url: string + type: string + url: string + user_view_type?: string | undefined +} | null + +export type t_nullable_community_health_file = { + html_url: string + url: string +} | null + +export type t_nullable_git_user = { + date?: string | undefined + email?: string | undefined + name?: string | undefined +} | null + +export type t_nullable_integration = { + client_id?: string | undefined + client_secret?: string | undefined + created_at: string + description: string | null + events: string[] + external_url: string + html_url: string + id: number + installations_count?: number | undefined + name: string + node_id: string + owner: t_simple_user | t_enterprise + pem?: string | undefined + permissions: { + checks?: string | undefined + contents?: string | undefined + deployments?: string | undefined + issues?: string | undefined + metadata?: string | undefined + [key: string]: string | undefined + } + slug?: string | undefined + updated_at: string + webhook_secret?: (string | null) | undefined +} | null + +export type t_nullable_issue = { + active_lock_reason?: (string | null) | undefined + assignee: t_nullable_simple_user + assignees?: (t_simple_user[] | null) | undefined + author_association: t_author_association + body?: (string | null) | undefined + body_html?: string | undefined + body_text?: string | undefined + closed_at: string | null + closed_by?: t_nullable_simple_user | undefined + comments: number + comments_url: string + created_at: string + draft?: boolean | undefined + events_url: string + html_url: string + id: number + labels: ( + | string + | { + color?: (string | null) | undefined + default?: boolean | undefined + description?: (string | null) | undefined + id?: number | undefined + name?: string | undefined + node_id?: string | undefined + url?: string | undefined + } + )[] + labels_url: string + locked: boolean + milestone: t_nullable_milestone + node_id: string + number: number + performed_via_github_app?: t_nullable_integration | undefined + pull_request?: + | { + diff_url: string | null + html_url: string | null + merged_at?: (string | null) | undefined + patch_url: string | null + url: string | null + } + | undefined + reactions?: t_reaction_rollup | undefined + repository?: t_repository | undefined + repository_url: string + state: string + state_reason?: ("completed" | "reopened" | "not_planned" | null) | undefined + sub_issues_summary?: t_sub_issues_summary | undefined + timeline_url?: string | undefined + title: string + type?: t_issue_type | undefined + updated_at: string + url: string + user: t_nullable_simple_user +} | null + +export type t_nullable_license_simple = { + html_url?: string | undefined + key: string + name: string + node_id: string + spdx_id: string | null + url: string | null +} | null + +export type t_nullable_milestone = { + closed_at: string | null + closed_issues: number + created_at: string + creator: t_nullable_simple_user + description: string | null + due_on: string | null + html_url: string + id: number + labels_url: string + node_id: string + number: number + open_issues: number + state: "open" | "closed" + title: string + updated_at: string + url: string +} | null + +export type t_nullable_minimal_repository = { + allow_forking?: boolean | undefined + archive_url: string + archived?: boolean | undefined + assignees_url: string + blobs_url: string + branches_url: string + clone_url?: string | undefined + code_of_conduct?: t_code_of_conduct | undefined + collaborators_url: string + comments_url: string + commits_url: string + compare_url: string + contents_url: string + contributors_url: string + created_at?: (string | null) | undefined + default_branch?: string | undefined + delete_branch_on_merge?: boolean | undefined + deployments_url: string + description: string | null + disabled?: boolean | undefined + downloads_url: string + events_url: string + fork: boolean + forks?: number | undefined + forks_count?: number | undefined + forks_url: string + full_name: string + git_commits_url: string + git_refs_url: string + git_tags_url: string + git_url?: string | undefined + has_discussions?: boolean | undefined + has_downloads?: boolean | undefined + has_issues?: boolean | undefined + has_pages?: boolean | undefined + has_projects?: boolean | undefined + has_wiki?: boolean | undefined + homepage?: (string | null) | undefined + hooks_url: string + html_url: string + id: number + is_template?: boolean | undefined + issue_comment_url: string + issue_events_url: string + issues_url: string + keys_url: string + labels_url: string + language?: (string | null) | undefined + languages_url: string + license?: + | ({ + key?: string | undefined + name?: string | undefined + node_id?: string | undefined + spdx_id?: string | undefined + url?: string | undefined + } | null) + | undefined + merges_url: string + milestones_url: string + mirror_url?: (string | null) | undefined + name: string + network_count?: number | undefined + node_id: string + notifications_url: string + open_issues?: number | undefined + open_issues_count?: number | undefined + owner: t_simple_user + permissions?: + | { + admin?: boolean | undefined + maintain?: boolean | undefined + pull?: boolean | undefined + push?: boolean | undefined + triage?: boolean | undefined + } + | undefined + private: boolean + pulls_url: string + pushed_at?: (string | null) | undefined + releases_url: string + role_name?: string | undefined + security_and_analysis?: t_security_and_analysis | undefined + size?: number | undefined + ssh_url?: string | undefined + stargazers_count?: number | undefined + stargazers_url: string + statuses_url: string + subscribers_count?: number | undefined + subscribers_url: string + subscription_url: string + svn_url?: string | undefined + tags_url: string + teams_url: string + temp_clone_token?: string | undefined + topics?: string[] | undefined + trees_url: string + updated_at?: (string | null) | undefined + url: string + visibility?: string | undefined + watchers?: number | undefined + watchers_count?: number | undefined + web_commit_signoff_required?: boolean | undefined +} | null + +export type t_nullable_organization_simple = { + avatar_url: string + description: string | null + events_url: string + hooks_url: string + id: number + issues_url: string + login: string + members_url: string + node_id: string + public_members_url: string + repos_url: string + url: string +} | null + +export type t_nullable_repository = { + allow_auto_merge?: boolean | undefined + allow_forking?: boolean | undefined + allow_merge_commit?: boolean | undefined + allow_rebase_merge?: boolean | undefined + allow_squash_merge?: boolean | undefined + allow_update_branch?: boolean | undefined + anonymous_access_enabled?: boolean | undefined + archive_url: string + archived: boolean + assignees_url: string + blobs_url: string + branches_url: string + clone_url: string + collaborators_url: string + comments_url: string + commits_url: string + compare_url: string + contents_url: string + contributors_url: string + created_at: string | null + default_branch: string + delete_branch_on_merge?: boolean | undefined + deployments_url: string + description: string | null + disabled: boolean + downloads_url: string + events_url: string + fork: boolean + forks: number + forks_count: number + forks_url: string + full_name: string + git_commits_url: string + git_refs_url: string + git_tags_url: string + git_url: string + has_discussions?: boolean | undefined + has_downloads: boolean + has_issues: boolean + has_pages: boolean + has_projects: boolean + has_wiki: boolean + homepage: string | null + hooks_url: string + html_url: string + id: number + is_template?: boolean | undefined + issue_comment_url: string + issue_events_url: string + issues_url: string + keys_url: string + labels_url: string + language: string | null + languages_url: string + license: t_nullable_license_simple + master_branch?: string | undefined + merge_commit_message?: ("PR_BODY" | "PR_TITLE" | "BLANK") | undefined + merge_commit_title?: ("PR_TITLE" | "MERGE_MESSAGE") | undefined + merges_url: string + milestones_url: string + mirror_url: string | null + name: string + node_id: string + notifications_url: string + open_issues: number + open_issues_count: number + owner: t_simple_user + permissions?: + | { + admin: boolean + maintain?: boolean | undefined + pull: boolean + push: boolean + triage?: boolean | undefined + } + | undefined + private: boolean + pulls_url: string + pushed_at: string | null + releases_url: string + size: number + squash_merge_commit_message?: + | ("PR_BODY" | "COMMIT_MESSAGES" | "BLANK") + | undefined + squash_merge_commit_title?: ("PR_TITLE" | "COMMIT_OR_PR_TITLE") | undefined + ssh_url: string + stargazers_count: number + stargazers_url: string + starred_at?: string | undefined + statuses_url: string + subscribers_url: string + subscription_url: string + svn_url: string + tags_url: string + teams_url: string + temp_clone_token?: string | undefined + topics?: string[] | undefined + trees_url: string + updated_at: string | null + url: string + use_squash_pr_title_as_default?: boolean | undefined + visibility?: string | undefined + watchers: number + watchers_count: number + web_commit_signoff_required?: boolean | undefined +} | null + +export type t_nullable_scoped_installation = { + account: t_simple_user + has_multiple_single_files?: boolean | undefined + permissions: t_app_permissions + repositories_url: string + repository_selection: "all" | "selected" + single_file_name: string | null + single_file_paths?: string[] | undefined +} | null + +export type t_nullable_simple_commit = { + author: { + email: string + name: string + } | null + committer: { + email: string + name: string + } | null + id: string + message: string + timestamp: string + tree_id: string +} | null + +export type t_nullable_simple_user = { + avatar_url: string + email?: (string | null) | undefined + events_url: string + followers_url: string + following_url: string + gists_url: string + gravatar_id: string | null + html_url: string + id: number + login: string + name?: (string | null) | undefined + node_id: string + organizations_url: string + received_events_url: string + repos_url: string + site_admin: boolean + starred_at?: string | undefined + starred_url: string + subscriptions_url: string + type: string + url: string + user_view_type?: string | undefined +} | null + +export type t_nullable_team_simple = { + description: string | null + html_url: string + id: number + ldap_dn?: string | undefined + members_url: string + name: string + node_id: string + notification_setting?: string | undefined + permission: string + privacy?: string | undefined + repositories_url: string + slug: string + url: string +} | null + +export type t_oidc_custom_sub = { + include_claim_keys: string[] +} + +export type t_oidc_custom_sub_repo = { + include_claim_keys?: string[] | undefined + use_default: boolean +} + +export type t_org_hook = { + active: boolean + config: { + content_type?: string | undefined + insecure_ssl?: string | undefined + secret?: string | undefined + url?: string | undefined + } + created_at: string + deliveries_url?: string | undefined + events: string[] + id: number + name: string + ping_url: string + type: string + updated_at: string + url: string +} + +export type t_org_membership = { + organization: t_organization_simple + organization_url: string + permissions?: + | { + can_create_repository: boolean + } + | undefined + role: "admin" | "member" | "billing_manager" + state: "active" | "pending" + url: string + user: t_nullable_simple_user +} + +export type t_org_private_registry_configuration = { + created_at: string + name: string + registry_type: "maven_repository" + updated_at: string + username?: (string | null) | undefined + visibility: "all" | "private" | "selected" +} + +export type t_org_private_registry_configuration_with_selected_repositories = { + created_at: string + name: string + registry_type: "maven_repository" + selected_repository_ids?: number[] | undefined + updated_at: string + username?: string | undefined + visibility: "all" | "private" | "selected" +} + +export type t_org_repo_custom_property_values = { + properties: t_custom_property_value[] + repository_full_name: string + repository_id: number + repository_name: string +} + +export type t_org_ruleset_conditions = + | (t_repository_ruleset_conditions & + t_repository_ruleset_conditions_repository_name_target) + | (t_repository_ruleset_conditions & + t_repository_ruleset_conditions_repository_id_target) + | (t_repository_ruleset_conditions & + t_repository_ruleset_conditions_repository_property_target) + +export type t_organization_actions_secret = { + created_at: string + name: string + selected_repositories_url?: string | undefined + updated_at: string + visibility: "all" | "private" | "selected" +} + +export type t_organization_actions_variable = { + created_at: string + name: string + selected_repositories_url?: string | undefined + updated_at: string + value: string + visibility: "all" | "private" | "selected" +} + +export type t_organization_dependabot_secret = { + created_at: string + name: string + selected_repositories_url?: string | undefined + updated_at: string + visibility: "all" | "private" | "selected" +} + +export type t_organization_full = { + advanced_security_enabled_for_new_repositories?: boolean | undefined + archived_at: string | null + avatar_url: string + billing_email?: (string | null) | undefined + blog?: string | undefined + collaborators?: (number | null) | undefined + company?: string | undefined + created_at: string + default_repository_permission?: (string | null) | undefined + dependabot_alerts_enabled_for_new_repositories?: boolean | undefined + dependabot_security_updates_enabled_for_new_repositories?: boolean | undefined + dependency_graph_enabled_for_new_repositories?: boolean | undefined + deploy_keys_enabled_for_repositories?: boolean | undefined + description: string | null + disk_usage?: (number | null) | undefined + email?: string | undefined + events_url: string + followers: number + following: number + has_organization_projects: boolean + has_repository_projects: boolean + hooks_url: string + html_url: string + id: number + is_verified?: boolean | undefined + issues_url: string + location?: string | undefined + login: string + members_allowed_repository_creation_type?: string | undefined + members_can_create_internal_repositories?: boolean | undefined + members_can_create_pages?: boolean | undefined + members_can_create_private_pages?: boolean | undefined + members_can_create_private_repositories?: boolean | undefined + members_can_create_public_pages?: boolean | undefined + members_can_create_public_repositories?: boolean | undefined + members_can_create_repositories?: (boolean | null) | undefined + members_can_fork_private_repositories?: (boolean | null) | undefined + members_url: string + name?: string | undefined + node_id: string + owned_private_repos?: number | undefined + plan?: + | { + filled_seats?: number | undefined + name: string + private_repos: number + seats?: number | undefined + space: number + } + | undefined + private_gists?: (number | null) | undefined + public_gists: number + public_members_url: string + public_repos: number + repos_url: string + secret_scanning_enabled_for_new_repositories?: boolean | undefined + secret_scanning_push_protection_custom_link?: (string | null) | undefined + secret_scanning_push_protection_custom_link_enabled?: boolean | undefined + secret_scanning_push_protection_enabled_for_new_repositories?: + | boolean + | undefined + total_private_repos?: number | undefined + twitter_username?: (string | null) | undefined + two_factor_requirement_enabled?: (boolean | null) | undefined + type: string + updated_at: string + url: string + web_commit_signoff_required?: boolean | undefined +} + +export type t_organization_invitation = { + created_at: string + email: string | null + failed_at?: (string | null) | undefined + failed_reason?: (string | null) | undefined + id: number + invitation_source?: string | undefined + invitation_teams_url: string + inviter: t_simple_user + login: string | null + node_id: string + role: string + team_count: number +} + +export type t_organization_programmatic_access_grant = { + access_granted_at: string + id: number + owner: t_simple_user + permissions: { + organization?: + | { + [key: string]: string | undefined + } + | undefined + other?: + | { + [key: string]: string | undefined + } + | undefined + repository?: + | { + [key: string]: string | undefined + } + | undefined + } + repositories_url: string + repository_selection: "none" | "all" | "subset" + token_expired: boolean + token_expires_at: string | null + token_id: number + token_last_used_at: string | null + token_name: string +} + +export type t_organization_programmatic_access_grant_request = { + created_at: string + id: number + owner: t_simple_user + permissions: { + organization?: + | { + [key: string]: string | undefined + } + | undefined + other?: + | { + [key: string]: string | undefined + } + | undefined + repository?: + | { + [key: string]: string | undefined + } + | undefined + } + reason: string | null + repositories_url: string + repository_selection: "none" | "all" | "subset" + token_expired: boolean + token_expires_at: string | null + token_id: number + token_last_used_at: string | null + token_name: string +} + +export type t_organization_role = { + base_role?: + | ("read" | "triage" | "write" | "maintain" | "admin" | null) + | undefined + created_at: string + description?: (string | null) | undefined + id: number + name: string + organization: t_nullable_simple_user + permissions: string[] + source?: ("Organization" | "Enterprise" | "Predefined" | null) | undefined + updated_at: string +} + +export type t_organization_secret_scanning_alert = { + created_at?: t_alert_created_at | undefined + html_url?: t_alert_html_url | undefined + is_base64_encoded?: (boolean | null) | undefined + locations_url?: string | undefined + multi_repo?: (boolean | null) | undefined + number?: t_alert_number | undefined + publicly_leaked?: (boolean | null) | undefined + push_protection_bypass_request_comment?: (string | null) | undefined + push_protection_bypass_request_html_url?: (string | null) | undefined + push_protection_bypass_request_reviewer?: t_nullable_simple_user | undefined + push_protection_bypass_request_reviewer_comment?: (string | null) | undefined + push_protection_bypassed?: (boolean | null) | undefined + push_protection_bypassed_at?: (string | null) | undefined + push_protection_bypassed_by?: t_nullable_simple_user | undefined + repository?: t_simple_repository | undefined + resolution?: t_secret_scanning_alert_resolution | undefined + resolution_comment?: (string | null) | undefined + resolved_at?: (string | null) | undefined + resolved_by?: t_nullable_simple_user | undefined + secret?: string | undefined + secret_type?: string | undefined + secret_type_display_name?: string | undefined + state?: t_secret_scanning_alert_state | undefined + updated_at?: t_nullable_alert_updated_at | undefined + url?: t_alert_url | undefined + validity?: ("active" | "inactive" | "unknown") | undefined +} + +export type t_organization_simple = { + avatar_url: string + description: string | null + events_url: string + hooks_url: string + id: number + issues_url: string + login: string + members_url: string + node_id: string + public_members_url: string + repos_url: string + url: string +} + +export type t_package = { + created_at: string + html_url: string + id: number + name: string + owner?: t_nullable_simple_user | undefined + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + repository?: t_nullable_minimal_repository | undefined + updated_at: string + url: string + version_count: number + visibility: "private" | "public" +} + +export type t_package_version = { + created_at: string + deleted_at?: string | undefined + description?: string | undefined + html_url?: string | undefined + id: number + license?: string | undefined + metadata?: + | { + container?: + | { + tags: string[] + } + | undefined + docker?: + | { + tag?: string[] | undefined + } + | undefined + package_type: + | "npm" + | "maven" + | "rubygems" + | "docker" + | "nuget" + | "container" + } + | undefined + name: string + package_html_url: string + updated_at: string + url: string +} + +export type t_packages_billing_usage = { + included_gigabytes_bandwidth: number + total_gigabytes_bandwidth_used: number + total_paid_gigabytes_bandwidth_used: number +} + +export type t_page = { + build_type?: ("legacy" | "workflow" | null) | undefined + cname: string | null + custom_404: boolean + html_url?: string | undefined + https_certificate?: t_pages_https_certificate | undefined + https_enforced?: boolean | undefined + pending_domain_unverified_at?: (string | null) | undefined + protected_domain_state?: + | ("pending" | "verified" | "unverified" | null) + | undefined + public: boolean + source?: t_pages_source_hash | undefined + status: "built" | "building" | "errored" | null + url: string +} + +export type t_page_build = { + commit: string + created_at: string + duration: number + error: { + message: string | null + } + pusher: t_nullable_simple_user + status: string + updated_at: string + url: string +} + +export type t_page_build_status = { + status: string + url: string +} + +export type t_page_deployment = { + id: number | string + page_url: string + preview_url?: string | undefined + status_url: string +} + +export type t_pages_deployment_status = { + status?: + | ( + | "deployment_in_progress" + | "syncing_files" + | "finished_file_sync" + | "updating_pages" + | "purging_cdn" + | "deployment_cancelled" + | "deployment_failed" + | "deployment_content_failed" + | "deployment_attempt_error" + | "deployment_lost" + | "succeed" + ) + | undefined +} + +export type t_pages_health_check = { + alt_domain?: + | ({ + caa_error?: (string | null) | undefined + dns_resolves?: boolean | undefined + enforces_https?: boolean | undefined + has_cname_record?: (boolean | null) | undefined + has_mx_records_present?: (boolean | null) | undefined + host?: string | undefined + https_error?: (string | null) | undefined + is_a_record?: (boolean | null) | undefined + is_apex_domain?: boolean | undefined + is_cloudflare_ip?: (boolean | null) | undefined + is_cname_to_fastly?: (boolean | null) | undefined + is_cname_to_github_user_domain?: (boolean | null) | undefined + is_cname_to_pages_dot_github_dot_com?: (boolean | null) | undefined + is_fastly_ip?: (boolean | null) | undefined + is_https_eligible?: (boolean | null) | undefined + is_non_github_pages_ip_present?: (boolean | null) | undefined + is_old_ip_address?: (boolean | null) | undefined + is_pages_domain?: boolean | undefined + is_pointed_to_github_pages_ip?: (boolean | null) | undefined + is_proxied?: (boolean | null) | undefined + is_served_by_pages?: (boolean | null) | undefined + is_valid?: boolean | undefined + is_valid_domain?: boolean | undefined + nameservers?: string | undefined + reason?: (string | null) | undefined + responds_to_https?: boolean | undefined + should_be_a_record?: (boolean | null) | undefined + uri?: string | undefined + } | null) + | undefined + domain?: + | { + caa_error?: (string | null) | undefined + dns_resolves?: boolean | undefined + enforces_https?: boolean | undefined + has_cname_record?: (boolean | null) | undefined + has_mx_records_present?: (boolean | null) | undefined + host?: string | undefined + https_error?: (string | null) | undefined + is_a_record?: (boolean | null) | undefined + is_apex_domain?: boolean | undefined + is_cloudflare_ip?: (boolean | null) | undefined + is_cname_to_fastly?: (boolean | null) | undefined + is_cname_to_github_user_domain?: (boolean | null) | undefined + is_cname_to_pages_dot_github_dot_com?: (boolean | null) | undefined + is_fastly_ip?: (boolean | null) | undefined + is_https_eligible?: (boolean | null) | undefined + is_non_github_pages_ip_present?: (boolean | null) | undefined + is_old_ip_address?: (boolean | null) | undefined + is_pages_domain?: boolean | undefined + is_pointed_to_github_pages_ip?: (boolean | null) | undefined + is_proxied?: (boolean | null) | undefined + is_served_by_pages?: (boolean | null) | undefined + is_valid?: boolean | undefined + is_valid_domain?: boolean | undefined + nameservers?: string | undefined + reason?: (string | null) | undefined + responds_to_https?: boolean | undefined + should_be_a_record?: (boolean | null) | undefined + uri?: string | undefined + } + | undefined +} + +export type t_pages_https_certificate = { + description: string + domains: string[] + expires_at?: string | undefined + state: + | "new" + | "authorization_created" + | "authorization_pending" + | "authorized" + | "authorization_revoked" + | "issued" + | "uploaded" + | "approved" + | "errored" + | "bad_authz" + | "destroy_pending" + | "dns_changed" +} + +export type t_pages_source_hash = { + branch: string + path: string +} + +export type t_participation_stats = { + all: number[] + owner: number[] +} + +export type t_pending_deployment = { + current_user_can_approve: boolean + environment: { + html_url?: string | undefined + id?: number | undefined + name?: string | undefined + node_id?: string | undefined + url?: string | undefined + } + reviewers: { + reviewer?: (t_simple_user | t_team) | undefined + type?: t_deployment_reviewer_type | undefined + }[] + wait_timer: number + wait_timer_started_at: string | null +} + +export type t_porter_author = { + email: string + id: number + import_url: string + name: string + remote_id: string + remote_name: string + url: string +} + +export type t_porter_large_file = { + oid: string + path: string + ref_name: string + size: number +} + +export type t_prevent_self_review = boolean + +export type t_private_user = { + avatar_url: string + bio: string | null + blog: string | null + business_plus?: boolean | undefined + collaborators: number + company: string | null + created_at: string + disk_usage: number + email: string | null + events_url: string + followers: number + followers_url: string + following: number + following_url: string + gists_url: string + gravatar_id: string | null + hireable: boolean | null + html_url: string + id: number + ldap_dn?: string | undefined + location: string | null + login: string + name: string | null + node_id: string + notification_email?: (string | null) | undefined + organizations_url: string + owned_private_repos: number + plan?: + | { + collaborators: number + name: string + private_repos: number + space: number + } + | undefined + private_gists: number + public_gists: number + public_repos: number + received_events_url: string + repos_url: string + site_admin: boolean + starred_url: string + subscriptions_url: string + total_private_repos: number + twitter_username?: (string | null) | undefined + two_factor_authentication: boolean + type: string + updated_at: string + url: string + user_view_type?: string | undefined +} + +export type t_project = { + body: string | null + columns_url: string + created_at: string + creator: t_nullable_simple_user + html_url: string + id: number + name: string + node_id: string + number: number + organization_permission?: ("read" | "write" | "admin" | "none") | undefined + owner_url: string + private?: boolean | undefined + state: string + updated_at: string + url: string +} + +export type t_project_card = { + archived?: boolean | undefined + column_name?: string | undefined + column_url: string + content_url?: string | undefined + created_at: string + creator: t_nullable_simple_user + id: number + node_id: string + note: string | null + project_id?: string | undefined + project_url: string + updated_at: string + url: string +} + +export type t_project_collaborator_permission = { + permission: string + user: t_nullable_simple_user +} + +export type t_project_column = { + cards_url: string + created_at: string + id: number + name: string + node_id: string + project_url: string + updated_at: string + url: string +} + +export type t_protected_branch = { + allow_deletions?: + | { + enabled: boolean + } + | undefined + allow_force_pushes?: + | { + enabled: boolean + } + | undefined + allow_fork_syncing?: + | { + enabled?: boolean | undefined + } + | undefined + block_creations?: + | { + enabled: boolean + } + | undefined + enforce_admins?: + | { + enabled: boolean + url: string + } + | undefined + lock_branch?: + | { + enabled?: boolean | undefined + } + | undefined + required_conversation_resolution?: + | { + enabled?: boolean | undefined + } + | undefined + required_linear_history?: + | { + enabled: boolean + } + | undefined + required_pull_request_reviews?: + | { + bypass_pull_request_allowances?: + | { + apps?: t_integration[] | undefined + teams: t_team[] + users: t_simple_user[] + } + | undefined + dismiss_stale_reviews?: boolean | undefined + dismissal_restrictions?: + | { + apps?: t_integration[] | undefined + teams: t_team[] + teams_url: string + url: string + users: t_simple_user[] + users_url: string + } + | undefined + require_code_owner_reviews?: boolean | undefined + require_last_push_approval?: boolean | undefined + required_approving_review_count?: number | undefined + url: string + } + | undefined + required_signatures?: + | { + enabled: boolean + url: string + } + | undefined + required_status_checks?: t_status_check_policy | undefined + restrictions?: t_branch_restriction_policy | undefined + url: string +} + +export type t_protected_branch_admin_enforced = { + enabled: boolean + url: string +} + +export type t_protected_branch_pull_request_review = { + bypass_pull_request_allowances?: + | { + apps?: t_integration[] | undefined + teams?: t_team[] | undefined + users?: t_simple_user[] | undefined + } + | undefined + dismiss_stale_reviews: boolean + dismissal_restrictions?: + | { + apps?: t_integration[] | undefined + teams?: t_team[] | undefined + teams_url?: string | undefined + url?: string | undefined + users?: t_simple_user[] | undefined + users_url?: string | undefined + } + | undefined + require_code_owner_reviews: boolean + require_last_push_approval?: boolean | undefined + required_approving_review_count?: number | undefined + url?: string | undefined +} + +export type t_protected_branch_required_status_check = { + checks: { + app_id: number | null + context: string + }[] + contexts: string[] + contexts_url?: string | undefined + enforcement_level?: string | undefined + strict?: boolean | undefined + url?: string | undefined +} + +export type t_public_ip = { + enabled?: boolean | undefined + length?: number | undefined + prefix?: string | undefined +} + +export type t_public_user = { + avatar_url: string + bio: string | null + blog: string | null + collaborators?: number | undefined + company: string | null + created_at: string + disk_usage?: number | undefined + email: string | null + events_url: string + followers: number + followers_url: string + following: number + following_url: string + gists_url: string + gravatar_id: string | null + hireable: boolean | null + html_url: string + id: number + location: string | null + login: string + name: string | null + node_id: string + notification_email?: (string | null) | undefined + organizations_url: string + owned_private_repos?: number | undefined + plan?: + | { + collaborators: number + name: string + private_repos: number + space: number + } + | undefined + private_gists?: number | undefined + public_gists: number + public_repos: number + received_events_url: string + repos_url: string + site_admin: boolean + starred_url: string + subscriptions_url: string + total_private_repos?: number | undefined + twitter_username?: (string | null) | undefined + type: string + updated_at: string + url: string + user_view_type?: string | undefined +} + +export type t_pull_request = { + _links: { + comments: t_link + commits: t_link + html: t_link + issue: t_link + review_comment: t_link + review_comments: t_link + self: t_link + statuses: t_link + } + active_lock_reason?: (string | null) | undefined + additions: number + assignee: t_nullable_simple_user + assignees?: (t_simple_user[] | null) | undefined + author_association: t_author_association + auto_merge: t_auto_merge + base: { + label: string + ref: string + repo: t_repository + sha: string + user: t_simple_user + } + body: string | null + changed_files: number + closed_at: string | null + comments: number + comments_url: string + commits: number + commits_url: string + created_at: string + deletions: number + diff_url: string + draft?: boolean | undefined + head: { + label: string + ref: string + repo: t_repository + sha: string + user: t_simple_user + } + html_url: string + id: number + issue_url: string + labels: { + color: string + default: boolean + description: string | null + id: number + name: string + node_id: string + url: string + }[] + locked: boolean + maintainer_can_modify: boolean + merge_commit_sha: string | null + mergeable: boolean | null + mergeable_state: string + merged: boolean + merged_at: string | null + merged_by: t_nullable_simple_user + milestone: t_nullable_milestone + node_id: string + number: number + patch_url: string + rebaseable?: (boolean | null) | undefined + requested_reviewers?: (t_simple_user[] | null) | undefined + requested_teams?: (t_team_simple[] | null) | undefined + review_comment_url: string + review_comments: number + review_comments_url: string + state: "open" | "closed" + statuses_url: string + title: string + updated_at: string + url: string + user: t_simple_user +} + +export type t_pull_request_merge_result = { + merged: boolean + message: string + sha: string +} + +export type t_pull_request_minimal = { + base: { + ref: string + repo: { + id: number + name: string + url: string + } + sha: string + } + head: { + ref: string + repo: { + id: number + name: string + url: string + } + sha: string + } + id: number + number: number + url: string +} + +export type t_pull_request_review = { + _links: { + html: { + href: string + } + pull_request: { + href: string + } + } + author_association: t_author_association + body: string + body_html?: string | undefined + body_text?: string | undefined + commit_id: string | null + html_url: string + id: number + node_id: string + pull_request_url: string + state: string + submitted_at?: string | undefined + user: t_nullable_simple_user +} + +export type t_pull_request_review_comment = { + _links: { + html: { + href: string + } + pull_request: { + href: string + } + self: { + href: string + } + } + author_association: t_author_association + body: string + body_html?: string | undefined + body_text?: string | undefined + commit_id: string + created_at: string + diff_hunk: string + html_url: string + id: number + in_reply_to_id?: number | undefined + line?: number | undefined + node_id: string + original_commit_id: string + original_line?: number | undefined + original_position?: number | undefined + original_start_line?: (number | null) | undefined + path: string + position?: number | undefined + pull_request_review_id: number | null + pull_request_url: string + reactions?: t_reaction_rollup | undefined + side?: ("LEFT" | "RIGHT") | undefined + start_line?: (number | null) | undefined + start_side?: ("LEFT" | "RIGHT" | null) | undefined + subject_type?: ("line" | "file") | undefined + updated_at: string + url: string + user: t_simple_user +} + +export type t_pull_request_review_request = { + teams: t_team[] + users: t_simple_user[] +} + +export type t_pull_request_simple = { + _links: { + comments: t_link + commits: t_link + html: t_link + issue: t_link + review_comment: t_link + review_comments: t_link + self: t_link + statuses: t_link + } + active_lock_reason?: (string | null) | undefined + assignee: t_nullable_simple_user + assignees?: (t_simple_user[] | null) | undefined + author_association: t_author_association + auto_merge: t_auto_merge + base: { + label: string + ref: string + repo: t_repository + sha: string + user: t_nullable_simple_user + } + body: string | null + closed_at: string | null + comments_url: string + commits_url: string + created_at: string + diff_url: string + draft?: boolean | undefined + head: { + label: string + ref: string + repo: t_repository + sha: string + user: t_nullable_simple_user + } + html_url: string + id: number + issue_url: string + labels: { + color: string + default: boolean + description: string + id: number + name: string + node_id: string + url: string + }[] + locked: boolean + merge_commit_sha: string | null + merged_at: string | null + milestone: t_nullable_milestone + node_id: string + number: number + patch_url: string + requested_reviewers?: (t_simple_user[] | null) | undefined + requested_teams?: (t_team[] | null) | undefined + review_comment_url: string + review_comments_url: string + state: string + statuses_url: string + title: string + updated_at: string + url: string + user: t_nullable_simple_user +} + +export type t_rate_limit = { + limit: number + remaining: number + reset: number + used: number +} + +export type t_rate_limit_overview = { + rate: t_rate_limit + resources: { + actions_runner_registration?: t_rate_limit | undefined + code_scanning_autofix?: t_rate_limit | undefined + code_scanning_upload?: t_rate_limit | undefined + code_search?: t_rate_limit | undefined + core: t_rate_limit + dependency_snapshots?: t_rate_limit | undefined + graphql?: t_rate_limit | undefined + integration_manifest?: t_rate_limit | undefined + scim?: t_rate_limit | undefined + search: t_rate_limit + source_import?: t_rate_limit | undefined + } +} + +export type t_reaction = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + created_at: string + id: number + node_id: string + user: t_nullable_simple_user +} + +export type t_reaction_rollup = { + "+1": number + "-1": number + confused: number + eyes: number + heart: number + hooray: number + laugh: number + rocket: number + total_count: number + url: string +} + +export type t_referenced_workflow = { + path: string + ref?: string | undefined + sha: string +} + +export type t_referrer_traffic = { + count: number + referrer: string + uniques: number +} + +export type t_release = { + assets: t_release_asset[] + assets_url: string + author: t_simple_user + body?: (string | null) | undefined + body_html?: string | undefined + body_text?: string | undefined + created_at: string + discussion_url?: string | undefined + draft: boolean + html_url: string + id: number + mentions_count?: number | undefined + name: string | null + node_id: string + prerelease: boolean + published_at: string | null + reactions?: t_reaction_rollup | undefined + tag_name: string + tarball_url: string | null + target_commitish: string + upload_url: string + url: string + zipball_url: string | null +} + +export type t_release_asset = { + browser_download_url: string + content_type: string + created_at: string + download_count: number + id: number + label: string | null + name: string + node_id: string + size: number + state: "uploaded" | "open" + updated_at: string + uploader: t_nullable_simple_user + url: string +} + +export type t_release_notes_content = { + body: string + name: string +} + +export type t_removed_from_project_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + project_card?: + | { + column_name: string + id: number + previous_column_name?: string | undefined + project_id: number + project_url: string + url: string + } + | undefined + url: string +} + +export type t_renamed_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + rename: { + from: string + to: string + } + url: string +} + +export type t_repo_codespaces_secret = { + created_at: string + name: string + updated_at: string +} + +export type t_repo_search_result_item = { + allow_auto_merge?: boolean | undefined + allow_forking?: boolean | undefined + allow_merge_commit?: boolean | undefined + allow_rebase_merge?: boolean | undefined + allow_squash_merge?: boolean | undefined + archive_url: string + archived: boolean + assignees_url: string + blobs_url: string + branches_url: string + clone_url: string + collaborators_url: string + comments_url: string + commits_url: string + compare_url: string + contents_url: string + contributors_url: string + created_at: string + default_branch: string + delete_branch_on_merge?: boolean | undefined + deployments_url: string + description: string | null + disabled: boolean + downloads_url: string + events_url: string + fork: boolean + forks: number + forks_count: number + forks_url: string + full_name: string + git_commits_url: string + git_refs_url: string + git_tags_url: string + git_url: string + has_discussions?: boolean | undefined + has_downloads: boolean + has_issues: boolean + has_pages: boolean + has_projects: boolean + has_wiki: boolean + homepage: string | null + hooks_url: string + html_url: string + id: number + is_template?: boolean | undefined + issue_comment_url: string + issue_events_url: string + issues_url: string + keys_url: string + labels_url: string + language: string | null + languages_url: string + license: t_nullable_license_simple + master_branch?: string | undefined + merges_url: string + milestones_url: string + mirror_url: string | null + name: string + node_id: string + notifications_url: string + open_issues: number + open_issues_count: number + owner: t_nullable_simple_user + permissions?: + | { + admin: boolean + maintain?: boolean | undefined + pull: boolean + push: boolean + triage?: boolean | undefined + } + | undefined + private: boolean + pulls_url: string + pushed_at: string + releases_url: string + score: number + size: number + ssh_url: string + stargazers_count: number + stargazers_url: string + statuses_url: string + subscribers_url: string + subscription_url: string + svn_url: string + tags_url: string + teams_url: string + temp_clone_token?: string | undefined + text_matches?: t_search_result_text_matches | undefined + topics?: string[] | undefined + trees_url: string + updated_at: string + url: string + visibility?: string | undefined + watchers: number + watchers_count: number + web_commit_signoff_required?: boolean | undefined +} + +export type t_repository = { + allow_auto_merge?: boolean | undefined + allow_forking?: boolean | undefined + allow_merge_commit?: boolean | undefined + allow_rebase_merge?: boolean | undefined + allow_squash_merge?: boolean | undefined + allow_update_branch?: boolean | undefined + anonymous_access_enabled?: boolean | undefined + archive_url: string + archived: boolean + assignees_url: string + blobs_url: string + branches_url: string + clone_url: string + collaborators_url: string + comments_url: string + commits_url: string + compare_url: string + contents_url: string + contributors_url: string + created_at: string | null + default_branch: string + delete_branch_on_merge?: boolean | undefined + deployments_url: string + description: string | null + disabled: boolean + downloads_url: string + events_url: string + fork: boolean + forks: number + forks_count: number + forks_url: string + full_name: string + git_commits_url: string + git_refs_url: string + git_tags_url: string + git_url: string + has_discussions?: boolean | undefined + has_downloads: boolean + has_issues: boolean + has_pages: boolean + has_projects: boolean + has_wiki: boolean + homepage: string | null + hooks_url: string + html_url: string + id: number + is_template?: boolean | undefined + issue_comment_url: string + issue_events_url: string + issues_url: string + keys_url: string + labels_url: string + language: string | null + languages_url: string + license: t_nullable_license_simple + master_branch?: string | undefined + merge_commit_message?: ("PR_BODY" | "PR_TITLE" | "BLANK") | undefined + merge_commit_title?: ("PR_TITLE" | "MERGE_MESSAGE") | undefined + merges_url: string + milestones_url: string + mirror_url: string | null + name: string + node_id: string + notifications_url: string + open_issues: number + open_issues_count: number + owner: t_simple_user + permissions?: + | { + admin: boolean + maintain?: boolean | undefined + pull: boolean + push: boolean + triage?: boolean | undefined + } + | undefined + private: boolean + pulls_url: string + pushed_at: string | null + releases_url: string + size: number + squash_merge_commit_message?: + | ("PR_BODY" | "COMMIT_MESSAGES" | "BLANK") + | undefined + squash_merge_commit_title?: ("PR_TITLE" | "COMMIT_OR_PR_TITLE") | undefined + ssh_url: string + stargazers_count: number + stargazers_url: string + starred_at?: string | undefined + statuses_url: string + subscribers_url: string + subscription_url: string + svn_url: string + tags_url: string + teams_url: string + temp_clone_token?: string | undefined + topics?: string[] | undefined + trees_url: string + updated_at: string | null + url: string + use_squash_pr_title_as_default?: boolean | undefined + visibility?: string | undefined + watchers: number + watchers_count: number + web_commit_signoff_required?: boolean | undefined +} + +export type t_repository_advisory = { + readonly author: t_simple_user | null + readonly closed_at: string | null + collaborating_teams: t_team[] | null + collaborating_users: t_simple_user[] | null + readonly created_at: string | null + credits: + | { + login?: string | undefined + type?: t_security_advisory_credit_types | undefined + }[] + | null + readonly credits_detailed: t_repository_advisory_credit[] | null + cve_id: string | null + cvss: { + readonly score: number | null + vector_string: string | null + } | null + cvss_severities?: t_cvss_severities | undefined + cwe_ids: string[] | null + readonly cwes: + | { + cwe_id: string + readonly name: string + }[] + | null + description: string | null + readonly ghsa_id: string + readonly html_url: string + readonly identifiers: { + type: "CVE" | "GHSA" + value: string + }[] + readonly private_fork: t_simple_repository | null + readonly published_at: string | null + readonly publisher: t_simple_user | null + severity: "critical" | "high" | "medium" | "low" | null + state: "published" | "closed" | "withdrawn" | "draft" | "triage" + readonly submission: { + readonly accepted: boolean + } | null + summary: string + readonly updated_at: string | null + readonly url: string + vulnerabilities: t_repository_advisory_vulnerability[] | null + readonly withdrawn_at: string | null +} + +export type t_repository_advisory_credit = { + state: "accepted" | "declined" | "pending" + type: t_security_advisory_credit_types + user: t_simple_user +} + +export type t_repository_advisory_vulnerability = { + package: { + ecosystem: t_security_advisory_ecosystems + name: string | null + } | null + patched_versions: string | null + vulnerable_functions: string[] | null + vulnerable_version_range: string | null +} + +export type t_repository_collaborator_permission = { + permission: string + role_name: string + user: t_nullable_collaborator +} + +export type t_repository_invitation = { + created_at: string + expired?: boolean | undefined + html_url: string + id: number + invitee: t_nullable_simple_user + inviter: t_nullable_simple_user + node_id: string + permissions: "read" | "write" | "admin" | "triage" | "maintain" + repository: t_minimal_repository + url: string +} + +export type t_repository_rule = + | t_repository_rule_creation + | t_repository_rule_update + | t_repository_rule_deletion + | t_repository_rule_required_linear_history + | t_repository_rule_merge_queue + | t_repository_rule_required_deployments + | t_repository_rule_required_signatures + | t_repository_rule_pull_request + | t_repository_rule_required_status_checks + | t_repository_rule_non_fast_forward + | t_repository_rule_commit_message_pattern + | t_repository_rule_commit_author_email_pattern + | t_repository_rule_committer_email_pattern + | t_repository_rule_branch_name_pattern + | t_repository_rule_tag_name_pattern + | t_repository_rule_file_path_restriction + | t_repository_rule_max_file_path_length + | t_repository_rule_file_extension_restriction + | t_repository_rule_max_file_size + | t_repository_rule_workflows + | t_repository_rule_code_scanning + +export type t_repository_rule_branch_name_pattern = { + parameters?: + | { + name?: string | undefined + negate?: boolean | undefined + operator: "starts_with" | "ends_with" | "contains" | "regex" + pattern: string + } + | undefined + type: "branch_name_pattern" +} + +export type t_repository_rule_code_scanning = { + parameters?: + | { + code_scanning_tools: t_repository_rule_params_code_scanning_tool[] + } + | undefined + type: "code_scanning" +} + +export type t_repository_rule_commit_author_email_pattern = { + parameters?: + | { + name?: string | undefined + negate?: boolean | undefined + operator: "starts_with" | "ends_with" | "contains" | "regex" + pattern: string + } + | undefined + type: "commit_author_email_pattern" +} + +export type t_repository_rule_commit_message_pattern = { + parameters?: + | { + name?: string | undefined + negate?: boolean | undefined + operator: "starts_with" | "ends_with" | "contains" | "regex" + pattern: string + } + | undefined + type: "commit_message_pattern" +} + +export type t_repository_rule_committer_email_pattern = { + parameters?: + | { + name?: string | undefined + negate?: boolean | undefined + operator: "starts_with" | "ends_with" | "contains" | "regex" + pattern: string + } + | undefined + type: "committer_email_pattern" +} + +export type t_repository_rule_creation = { + type: "creation" +} + +export type t_repository_rule_deletion = { + type: "deletion" +} + +export type t_repository_rule_detailed = + | (t_repository_rule_creation & t_repository_rule_ruleset_info) + | (t_repository_rule_update & t_repository_rule_ruleset_info) + | (t_repository_rule_deletion & t_repository_rule_ruleset_info) + | (t_repository_rule_required_linear_history & t_repository_rule_ruleset_info) + | (t_repository_rule_merge_queue & t_repository_rule_ruleset_info) + | (t_repository_rule_required_deployments & t_repository_rule_ruleset_info) + | (t_repository_rule_required_signatures & t_repository_rule_ruleset_info) + | (t_repository_rule_pull_request & t_repository_rule_ruleset_info) + | (t_repository_rule_required_status_checks & t_repository_rule_ruleset_info) + | (t_repository_rule_non_fast_forward & t_repository_rule_ruleset_info) + | (t_repository_rule_commit_message_pattern & t_repository_rule_ruleset_info) + | (t_repository_rule_commit_author_email_pattern & + t_repository_rule_ruleset_info) + | (t_repository_rule_committer_email_pattern & t_repository_rule_ruleset_info) + | (t_repository_rule_branch_name_pattern & t_repository_rule_ruleset_info) + | (t_repository_rule_tag_name_pattern & t_repository_rule_ruleset_info) + | (t_repository_rule_file_path_restriction & t_repository_rule_ruleset_info) + | (t_repository_rule_max_file_path_length & t_repository_rule_ruleset_info) + | (t_repository_rule_file_extension_restriction & + t_repository_rule_ruleset_info) + | (t_repository_rule_max_file_size & t_repository_rule_ruleset_info) + | (t_repository_rule_workflows & t_repository_rule_ruleset_info) + | (t_repository_rule_code_scanning & t_repository_rule_ruleset_info) + +export type t_repository_rule_enforcement = "disabled" | "active" | "evaluate" + +export type t_repository_rule_file_extension_restriction = { + parameters?: + | { + restricted_file_extensions: string[] + } + | undefined + type: "file_extension_restriction" +} + +export type t_repository_rule_file_path_restriction = { + parameters?: + | { + restricted_file_paths: string[] + } + | undefined + type: "file_path_restriction" +} + +export type t_repository_rule_max_file_path_length = { + parameters?: + | { + max_file_path_length: number + } + | undefined + type: "max_file_path_length" +} + +export type t_repository_rule_max_file_size = { + parameters?: + | { + max_file_size: number + } + | undefined + type: "max_file_size" +} + +export type t_repository_rule_merge_queue = { + parameters?: + | { + check_response_timeout_minutes: number + grouping_strategy: "ALLGREEN" | "HEADGREEN" + max_entries_to_build: number + max_entries_to_merge: number + merge_method: "MERGE" | "SQUASH" | "REBASE" + min_entries_to_merge: number + min_entries_to_merge_wait_minutes: number + } + | undefined + type: "merge_queue" +} + +export type t_repository_rule_non_fast_forward = { + type: "non_fast_forward" +} + +export type t_repository_rule_params_code_scanning_tool = { + alerts_threshold: "none" | "errors" | "errors_and_warnings" | "all" + security_alerts_threshold: + | "none" + | "critical" + | "high_or_higher" + | "medium_or_higher" + | "all" + tool: string +} + +export type t_repository_rule_params_status_check_configuration = { + context: string + integration_id?: number | undefined +} + +export type t_repository_rule_params_workflow_file_reference = { + path: string + ref?: string | undefined + repository_id: number + sha?: string | undefined +} + +export type t_repository_rule_pull_request = { + parameters?: + | { + allowed_merge_methods?: ("merge" | "squash" | "rebase")[] | undefined + automatic_copilot_code_review_enabled?: boolean | undefined + dismiss_stale_reviews_on_push: boolean + require_code_owner_review: boolean + require_last_push_approval: boolean + required_approving_review_count: number + required_review_thread_resolution: boolean + } + | undefined + type: "pull_request" +} + +export type t_repository_rule_required_deployments = { + parameters?: + | { + required_deployment_environments: string[] + } + | undefined + type: "required_deployments" +} + +export type t_repository_rule_required_linear_history = { + type: "required_linear_history" +} + +export type t_repository_rule_required_signatures = { + type: "required_signatures" +} + +export type t_repository_rule_required_status_checks = { + parameters?: + | { + do_not_enforce_on_create?: boolean | undefined + required_status_checks: t_repository_rule_params_status_check_configuration[] + strict_required_status_checks_policy: boolean + } + | undefined + type: "required_status_checks" +} + +export type t_repository_rule_ruleset_info = { + ruleset_id?: number | undefined + ruleset_source?: string | undefined + ruleset_source_type?: ("Repository" | "Organization") | undefined +} + +export type t_repository_rule_tag_name_pattern = { + parameters?: + | { + name?: string | undefined + negate?: boolean | undefined + operator: "starts_with" | "ends_with" | "contains" | "regex" + pattern: string + } + | undefined + type: "tag_name_pattern" +} + +export type t_repository_rule_update = { + parameters?: + | { + update_allows_fetch_and_merge: boolean + } + | undefined + type: "update" +} + +export type t_repository_rule_violation_error = { + documentation_url?: string | undefined + message?: string | undefined + metadata?: + | { + secret_scanning?: + | { + bypass_placeholders?: + | { + placeholder_id?: + | t_secret_scanning_push_protection_bypass_placeholder_id + | undefined + token_type?: string | undefined + }[] + | undefined + } + | undefined + } + | undefined + status?: string | undefined +} + +export type t_repository_rule_workflows = { + parameters?: + | { + do_not_enforce_on_create?: boolean | undefined + workflows: t_repository_rule_params_workflow_file_reference[] + } + | undefined + type: "workflows" +} + +export type t_repository_ruleset = { + _links?: + | { + html?: + | ({ + href?: string | undefined + } | null) + | undefined + self?: + | { + href?: string | undefined + } + | undefined + } + | undefined + bypass_actors?: t_repository_ruleset_bypass_actor[] | undefined + conditions?: + | (t_repository_ruleset_conditions | t_org_ruleset_conditions | null) + | undefined + created_at?: string | undefined + current_user_can_bypass?: + | ("always" | "pull_requests_only" | "never") + | undefined + enforcement: t_repository_rule_enforcement + id: number + name: string + node_id?: string | undefined + rules?: t_repository_rule[] | undefined + source: string + source_type?: ("Repository" | "Organization" | "Enterprise") | undefined + target?: ("branch" | "tag" | "push" | "repository") | undefined + updated_at?: string | undefined +} + +export type t_repository_ruleset_bypass_actor = { + actor_id?: (number | null) | undefined + actor_type: + | "Integration" + | "OrganizationAdmin" + | "RepositoryRole" + | "Team" + | "DeployKey" + bypass_mode?: ("always" | "pull_request") | undefined +} + +export type t_repository_ruleset_conditions = { + ref_name?: + | { + exclude?: string[] | undefined + include?: string[] | undefined + } + | undefined +} + +export type t_repository_ruleset_conditions_repository_id_target = { + repository_id: { + repository_ids?: number[] | undefined + } +} + +export type t_repository_ruleset_conditions_repository_name_target = { + repository_name: { + exclude?: string[] | undefined + include?: string[] | undefined + protected?: boolean | undefined + } +} + +export type t_repository_ruleset_conditions_repository_property_spec = { + name: string + property_values: string[] + source?: ("custom" | "system") | undefined +} + +export type t_repository_ruleset_conditions_repository_property_target = { + repository_property: { + exclude?: + | t_repository_ruleset_conditions_repository_property_spec[] + | undefined + include?: + | t_repository_ruleset_conditions_repository_property_spec[] + | undefined + } +} + +export type t_repository_subscription = { + created_at: string + ignored: boolean + reason: string | null + repository_url: string + subscribed: boolean + url: string +} + +export type t_review_comment = { + _links: { + html: t_link + pull_request: t_link + self: t_link + } + author_association: t_author_association + body: string + body_html?: string | undefined + body_text?: string | undefined + commit_id: string + created_at: string + diff_hunk: string + html_url: string + id: number + in_reply_to_id?: number | undefined + line?: number | undefined + node_id: string + original_commit_id: string + original_line?: number | undefined + original_position: number + original_start_line?: (number | null) | undefined + path: string + position: number | null + pull_request_review_id: number | null + pull_request_url: string + reactions?: t_reaction_rollup | undefined + side?: ("LEFT" | "RIGHT") | undefined + start_line?: (number | null) | undefined + start_side?: ("LEFT" | "RIGHT" | null) | undefined + updated_at: string + url: string + user: t_nullable_simple_user +} + +export type t_review_custom_gates_comment_required = { + comment: string + environment_name: string +} + +export type t_review_custom_gates_state_required = { + comment?: string | undefined + environment_name: string + state: "approved" | "rejected" +} + +export type t_review_dismissed_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + dismissed_review: { + dismissal_commit_id?: string | undefined + dismissal_message: string | null + review_id: number + state: string + } + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_review_request_removed_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + requested_reviewer?: t_simple_user | undefined + requested_team?: t_team | undefined + review_requester: t_simple_user + url: string +} + +export type t_review_requested_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + requested_reviewer?: t_simple_user | undefined + requested_team?: t_team | undefined + review_requester: t_simple_user + url: string +} + +export type t_root = { + authorizations_url: string + code_search_url: string + commit_search_url: string + current_user_authorizations_html_url: string + current_user_repositories_url: string + current_user_url: string + emails_url: string + emojis_url: string + events_url: string + feeds_url: string + followers_url: string + following_url: string + gists_url: string + hub_url?: string | undefined + issue_search_url: string + issues_url: string + keys_url: string + label_search_url: string + notifications_url: string + organization_repositories_url: string + organization_teams_url: string + organization_url: string + public_gists_url: string + rate_limit_url: string + repository_search_url: string + repository_url: string + starred_gists_url: string + starred_url: string + topic_search_url?: string | undefined + user_organizations_url: string + user_repositories_url: string + user_search_url: string + user_url: string +} + +export type t_rule_suite = { + actor_id?: (number | null) | undefined + actor_name?: (string | null) | undefined + after_sha?: string | undefined + before_sha?: string | undefined + evaluation_result?: ("pass" | "fail" | "bypass" | null) | undefined + id?: number | undefined + pushed_at?: string | undefined + ref?: string | undefined + repository_id?: number | undefined + repository_name?: string | undefined + result?: ("pass" | "fail" | "bypass") | undefined + rule_evaluations?: + | { + details?: (string | null) | undefined + enforcement?: ("active" | "evaluate" | "deleted ruleset") | undefined + result?: ("pass" | "fail") | undefined + rule_source?: + | { + id?: (number | null) | undefined + name?: (string | null) | undefined + type?: string | undefined + } + | undefined + rule_type?: string | undefined + }[] + | undefined +} + +export type t_rule_suites = { + actor_id?: number | undefined + actor_name?: string | undefined + after_sha?: string | undefined + before_sha?: string | undefined + evaluation_result?: ("pass" | "fail" | "bypass") | undefined + id?: number | undefined + pushed_at?: string | undefined + ref?: string | undefined + repository_id?: number | undefined + repository_name?: string | undefined + result?: ("pass" | "fail" | "bypass") | undefined +}[] + +export type t_ruleset_version = { + actor: { + id?: number | undefined + type?: string | undefined + } + updated_at: string + version_id: number +} + +export type t_ruleset_version_with_state = t_ruleset_version & { + state: EmptyObject +} + +export type t_runner = { + busy: boolean + ephemeral?: boolean | undefined + id: number + labels: t_runner_label[] + name: string + os: string + runner_group_id?: number | undefined + status: string +} + +export type t_runner_application = { + architecture: string + download_url: string + filename: string + os: string + sha256_checksum?: string | undefined + temp_download_token?: string | undefined +} + +export type t_runner_groups_org = { + allows_public_repositories: boolean + default: boolean + hosted_runners_url?: string | undefined + id: number + inherited: boolean + inherited_allows_public_repositories?: boolean | undefined + name: string + network_configuration_id?: string | undefined + restricted_to_workflows?: boolean | undefined + runners_url: string + selected_repositories_url?: string | undefined + selected_workflows?: string[] | undefined + visibility: string + workflow_restrictions_read_only?: boolean | undefined +} + +export type t_runner_label = { + id?: number | undefined + name: string + type?: ("read-only" | "custom") | undefined +} + +export type t_scim_error = { + detail?: (string | null) | undefined + documentation_url?: (string | null) | undefined + message?: (string | null) | undefined + schemas?: string[] | undefined + scimType?: (string | null) | undefined + status?: number | undefined +} + +export type t_search_result_text_matches = { + fragment?: string | undefined + matches?: + | { + indices?: number[] | undefined + text?: string | undefined + }[] + | undefined + object_type?: (string | null) | undefined + object_url?: string | undefined + property?: string | undefined +}[] + +export type t_secret_scanning_alert = { + created_at?: t_alert_created_at | undefined + html_url?: t_alert_html_url | undefined + is_base64_encoded?: (boolean | null) | undefined + locations_url?: string | undefined + multi_repo?: (boolean | null) | undefined + number?: t_alert_number | undefined + publicly_leaked?: (boolean | null) | undefined + push_protection_bypass_request_comment?: (string | null) | undefined + push_protection_bypass_request_html_url?: (string | null) | undefined + push_protection_bypass_request_reviewer?: t_nullable_simple_user | undefined + push_protection_bypass_request_reviewer_comment?: (string | null) | undefined + push_protection_bypassed?: (boolean | null) | undefined + push_protection_bypassed_at?: (string | null) | undefined + push_protection_bypassed_by?: t_nullable_simple_user | undefined + resolution?: t_secret_scanning_alert_resolution | undefined + resolution_comment?: (string | null) | undefined + resolved_at?: (string | null) | undefined + resolved_by?: t_nullable_simple_user | undefined + secret?: string | undefined + secret_type?: string | undefined + secret_type_display_name?: string | undefined + state?: t_secret_scanning_alert_state | undefined + updated_at?: t_nullable_alert_updated_at | undefined + url?: t_alert_url | undefined + validity?: ("active" | "inactive" | "unknown") | undefined +} + +export type t_secret_scanning_alert_resolution = + | "false_positive" + | "wont_fix" + | "revoked" + | "used_in_tests" + | null + +export type t_secret_scanning_alert_resolution_comment = string | null + +export type t_secret_scanning_alert_state = "open" | "resolved" + +export type t_secret_scanning_location = { + details?: + | ( + | t_secret_scanning_location_commit + | t_secret_scanning_location_wiki_commit + | t_secret_scanning_location_issue_title + | t_secret_scanning_location_issue_body + | t_secret_scanning_location_issue_comment + | t_secret_scanning_location_discussion_title + | t_secret_scanning_location_discussion_body + | t_secret_scanning_location_discussion_comment + | t_secret_scanning_location_pull_request_title + | t_secret_scanning_location_pull_request_body + | t_secret_scanning_location_pull_request_comment + | t_secret_scanning_location_pull_request_review + | t_secret_scanning_location_pull_request_review_comment + ) + | undefined + type?: + | ( + | "commit" + | "wiki_commit" + | "issue_title" + | "issue_body" + | "issue_comment" + | "discussion_title" + | "discussion_body" + | "discussion_comment" + | "pull_request_title" + | "pull_request_body" + | "pull_request_comment" + | "pull_request_review" + | "pull_request_review_comment" + ) + | undefined +} + +export type t_secret_scanning_location_commit = { + blob_sha: string + blob_url: string + commit_sha: string + commit_url: string + end_column: number + end_line: number + path: string + start_column: number + start_line: number +} + +export type t_secret_scanning_location_discussion_body = { + discussion_body_url: string +} + +export type t_secret_scanning_location_discussion_comment = { + discussion_comment_url: string +} + +export type t_secret_scanning_location_discussion_title = { + discussion_title_url: string +} + +export type t_secret_scanning_location_issue_body = { + issue_body_url: string +} + +export type t_secret_scanning_location_issue_comment = { + issue_comment_url: string +} + +export type t_secret_scanning_location_issue_title = { + issue_title_url: string +} + +export type t_secret_scanning_location_pull_request_body = { + pull_request_body_url: string +} + +export type t_secret_scanning_location_pull_request_comment = { + pull_request_comment_url: string +} + +export type t_secret_scanning_location_pull_request_review = { + pull_request_review_url: string +} + +export type t_secret_scanning_location_pull_request_review_comment = { + pull_request_review_comment_url: string +} + +export type t_secret_scanning_location_pull_request_title = { + pull_request_title_url: string +} + +export type t_secret_scanning_location_wiki_commit = { + blob_sha: string + commit_sha: string + commit_url: string + end_column: number + end_line: number + page_url: string + path: string + start_column: number + start_line: number +} + +export type t_secret_scanning_push_protection_bypass = { + expire_at?: (string | null) | undefined + reason?: t_secret_scanning_push_protection_bypass_reason | undefined + token_type?: string | undefined +} + +export type t_secret_scanning_push_protection_bypass_placeholder_id = string + +export type t_secret_scanning_push_protection_bypass_reason = + | "false_positive" + | "used_in_tests" + | "will_fix_later" + +export type t_secret_scanning_scan = { + completed_at?: (string | null) | undefined + started_at?: (string | null) | undefined + status?: string | undefined + type?: string | undefined +} + +export type t_secret_scanning_scan_history = { + backfill_scans?: t_secret_scanning_scan[] | undefined + custom_pattern_backfill_scans?: + | (t_secret_scanning_scan & { + pattern_name?: string | undefined + pattern_scope?: string | undefined + })[] + | undefined + incremental_scans?: t_secret_scanning_scan[] | undefined + pattern_update_scans?: t_secret_scanning_scan[] | undefined +} + +export type t_security_advisory_credit_types = + | "analyst" + | "finder" + | "reporter" + | "coordinator" + | "remediation_developer" + | "remediation_reviewer" + | "remediation_verifier" + | "tool" + | "sponsor" + | "other" + +export type t_security_advisory_ecosystems = + | "rubygems" + | "npm" + | "pip" + | "maven" + | "nuget" + | "composer" + | "go" + | "rust" + | "erlang" + | "actions" + | "pub" + | "other" + | "swift" + +export type t_security_advisory_epss = { + percentage?: number | undefined + percentile?: number | undefined +} | null + +export type t_security_and_analysis = { + advanced_security?: + | { + status?: ("enabled" | "disabled") | undefined + } + | undefined + code_security?: + | { + status?: ("enabled" | "disabled") | undefined + } + | undefined + dependabot_security_updates?: + | { + status?: ("enabled" | "disabled") | undefined + } + | undefined + secret_scanning?: + | { + status?: ("enabled" | "disabled") | undefined + } + | undefined + secret_scanning_ai_detection?: + | { + status?: ("enabled" | "disabled") | undefined + } + | undefined + secret_scanning_non_provider_patterns?: + | { + status?: ("enabled" | "disabled") | undefined + } + | undefined + secret_scanning_push_protection?: + | { + status?: ("enabled" | "disabled") | undefined + } + | undefined +} | null + +export type t_selected_actions = { + github_owned_allowed?: boolean | undefined + patterns_allowed?: string[] | undefined + verified_allowed?: boolean | undefined +} + +export type t_selected_actions_url = string + +export type t_short_blob = { + sha: string + url: string +} + +export type t_short_branch = { + commit: { + sha: string + url: string + } + name: string + protected: boolean + protection?: t_branch_protection | undefined + protection_url?: string | undefined +} + +export type t_simple_classroom = { + archived: boolean + id: number + name: string + url: string +} + +export type t_simple_classroom_assignment = { + accepted: number + classroom: t_simple_classroom + deadline: string | null + editor: string + feedback_pull_requests_enabled: boolean + id: number + invitations_enabled: boolean + invite_link: string + language: string + max_members?: (number | null) | undefined + max_teams?: (number | null) | undefined + passing: number + public_repo: boolean + slug: string + students_are_repo_admins: boolean + submitted: number + title: string + type: "individual" | "group" +} + +export type t_simple_classroom_organization = { + avatar_url: string + html_url: string + id: number + login: string + name: string | null + node_id: string +} + +export type t_simple_classroom_repository = { + default_branch: string + full_name: string + html_url: string + id: number + node_id: string + private: boolean +} + +export type t_simple_classroom_user = { + avatar_url: string + html_url: string + id: number + login: string +} + +export type t_simple_commit = { + author: { + email: string + name: string + } | null + committer: { + email: string + name: string + } | null + id: string + message: string + timestamp: string + tree_id: string +} + +export type t_simple_commit_status = { + avatar_url: string | null + context: string + created_at: string + description: string | null + id: number + node_id: string + required?: (boolean | null) | undefined + state: string + target_url: string | null + updated_at: string + url: string +} + +export type t_simple_repository = { + archive_url: string + assignees_url: string + blobs_url: string + branches_url: string + collaborators_url: string + comments_url: string + commits_url: string + compare_url: string + contents_url: string + contributors_url: string + deployments_url: string + description: string | null + downloads_url: string + events_url: string + fork: boolean + forks_url: string + full_name: string + git_commits_url: string + git_refs_url: string + git_tags_url: string + hooks_url: string + html_url: string + id: number + issue_comment_url: string + issue_events_url: string + issues_url: string + keys_url: string + labels_url: string + languages_url: string + merges_url: string + milestones_url: string + name: string + node_id: string + notifications_url: string + owner: t_simple_user + private: boolean + pulls_url: string + releases_url: string + stargazers_url: string + statuses_url: string + subscribers_url: string + subscription_url: string + tags_url: string + teams_url: string + trees_url: string + url: string +} + +export type t_simple_user = { + avatar_url: string + email?: (string | null) | undefined + events_url: string + followers_url: string + following_url: string + gists_url: string + gravatar_id: string | null + html_url: string + id: number + login: string + name?: (string | null) | undefined + node_id: string + organizations_url: string + received_events_url: string + repos_url: string + site_admin: boolean + starred_at?: string | undefined + starred_url: string + subscriptions_url: string + type: string + url: string + user_view_type?: string | undefined +} + +export type t_social_account = { + provider: string + url: string +} + +export type t_ssh_signing_key = { + created_at: string + id: number + key: string + title: string +} + +export type t_stargazer = { + starred_at: string + user: t_nullable_simple_user +} + +export type t_starred_repository = { + repo: t_repository + starred_at: string +} + +export type t_state_change_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + state_reason?: (string | null) | undefined + url: string +} + +export type t_status = { + avatar_url: string | null + context: string + created_at: string + creator: t_nullable_simple_user + description: string | null + id: number + node_id: string + state: string + target_url: string | null + updated_at: string + url: string +} + +export type t_status_check_policy = { + checks: { + app_id: number | null + context: string + }[] + contexts: string[] + contexts_url: string + strict: boolean + url: string +} + +export type t_sub_issues_summary = { + completed: number + percent_completed: number + total: number +} + +export type t_tag = { + commit: { + sha: string + url: string + } + name: string + node_id: string + tarball_url: string + zipball_url: string +} + +export type t_tag_protection = { + created_at?: string | undefined + enabled?: boolean | undefined + id?: number | undefined + pattern: string + updated_at?: string | undefined +} + +export type t_team = { + description: string | null + html_url: string + id: number + members_url: string + name: string + node_id: string + notification_setting?: string | undefined + parent: t_nullable_team_simple + permission: string + permissions?: + | { + admin: boolean + maintain: boolean + pull: boolean + push: boolean + triage: boolean + } + | undefined + privacy?: string | undefined + repositories_url: string + slug: string + url: string +} + +export type t_team_discussion = { + author: t_nullable_simple_user + body: string + body_html: string + body_version: string + comments_count: number + comments_url: string + created_at: string + html_url: string + last_edited_at: string | null + node_id: string + number: number + pinned: boolean + private: boolean + reactions?: t_reaction_rollup | undefined + team_url: string + title: string + updated_at: string + url: string +} + +export type t_team_discussion_comment = { + author: t_nullable_simple_user + body: string + body_html: string + body_version: string + created_at: string + discussion_url: string + html_url: string + last_edited_at: string | null + node_id: string + number: number + reactions?: t_reaction_rollup | undefined + updated_at: string + url: string +} + +export type t_team_full = { + created_at: string + description: string | null + html_url: string + id: number + ldap_dn?: string | undefined + members_count: number + members_url: string + name: string + node_id: string + notification_setting?: + | ("notifications_enabled" | "notifications_disabled") + | undefined + organization: t_team_organization + parent?: t_nullable_team_simple | undefined + permission: string + privacy?: ("closed" | "secret") | undefined + repos_count: number + repositories_url: string + slug: string + updated_at: string + url: string +} + +export type t_team_membership = { + role: "member" | "maintainer" + state: "active" | "pending" + url: string +} + +export type t_team_organization = { + archived_at: string | null + avatar_url: string + billing_email?: (string | null) | undefined + blog?: string | undefined + collaborators?: (number | null) | undefined + company?: string | undefined + created_at: string + default_repository_permission?: (string | null) | undefined + description: string | null + disk_usage?: (number | null) | undefined + email?: string | undefined + events_url: string + followers: number + following: number + has_organization_projects: boolean + has_repository_projects: boolean + hooks_url: string + html_url: string + id: number + is_verified?: boolean | undefined + issues_url: string + location?: string | undefined + login: string + members_allowed_repository_creation_type?: string | undefined + members_can_create_internal_repositories?: boolean | undefined + members_can_create_pages?: boolean | undefined + members_can_create_private_pages?: boolean | undefined + members_can_create_private_repositories?: boolean | undefined + members_can_create_public_pages?: boolean | undefined + members_can_create_public_repositories?: boolean | undefined + members_can_create_repositories?: (boolean | null) | undefined + members_can_fork_private_repositories?: (boolean | null) | undefined + members_url: string + name?: string | undefined + node_id: string + owned_private_repos?: number | undefined + plan?: + | { + filled_seats?: number | undefined + name: string + private_repos: number + seats?: number | undefined + space: number + } + | undefined + private_gists?: (number | null) | undefined + public_gists: number + public_members_url: string + public_repos: number + repos_url: string + total_private_repos?: number | undefined + twitter_username?: (string | null) | undefined + two_factor_requirement_enabled?: (boolean | null) | undefined + type: string + updated_at: string + url: string + web_commit_signoff_required?: boolean | undefined +} + +export type t_team_project = { + body: string | null + columns_url: string + created_at: string + creator: t_simple_user + html_url: string + id: number + name: string + node_id: string + number: number + organization_permission?: string | undefined + owner_url: string + permissions: { + admin: boolean + read: boolean + write: boolean + } + private?: boolean | undefined + state: string + updated_at: string + url: string +} + +export type t_team_repository = { + allow_auto_merge?: boolean | undefined + allow_forking?: boolean | undefined + allow_merge_commit?: boolean | undefined + allow_rebase_merge?: boolean | undefined + allow_squash_merge?: boolean | undefined + archive_url: string + archived: boolean + assignees_url: string + blobs_url: string + branches_url: string + clone_url: string + collaborators_url: string + comments_url: string + commits_url: string + compare_url: string + contents_url: string + contributors_url: string + created_at: string | null + default_branch: string + delete_branch_on_merge?: boolean | undefined + deployments_url: string + description: string | null + disabled: boolean + downloads_url: string + events_url: string + fork: boolean + forks: number + forks_count: number + forks_url: string + full_name: string + git_commits_url: string + git_refs_url: string + git_tags_url: string + git_url: string + has_downloads: boolean + has_issues: boolean + has_pages: boolean + has_projects: boolean + has_wiki: boolean + homepage: string | null + hooks_url: string + html_url: string + id: number + is_template?: boolean | undefined + issue_comment_url: string + issue_events_url: string + issues_url: string + keys_url: string + labels_url: string + language: string | null + languages_url: string + license: t_nullable_license_simple + master_branch?: string | undefined + merges_url: string + milestones_url: string + mirror_url: string | null + name: string + network_count?: number | undefined + node_id: string + notifications_url: string + open_issues: number + open_issues_count: number + owner: t_nullable_simple_user + permissions?: + | { + admin: boolean + maintain?: boolean | undefined + pull: boolean + push: boolean + triage?: boolean | undefined + } + | undefined + private: boolean + pulls_url: string + pushed_at: string | null + releases_url: string + role_name?: string | undefined + size: number + ssh_url: string + stargazers_count: number + stargazers_url: string + statuses_url: string + subscribers_count?: number | undefined + subscribers_url: string + subscription_url: string + svn_url: string + tags_url: string + teams_url: string + temp_clone_token?: string | undefined + topics?: string[] | undefined + trees_url: string + updated_at: string | null + url: string + visibility?: string | undefined + watchers: number + watchers_count: number + web_commit_signoff_required?: boolean | undefined +} + +export type t_team_role_assignment = { + assignment?: ("direct" | "indirect" | "mixed") | undefined + description: string | null + html_url: string + id: number + members_url: string + name: string + node_id: string + notification_setting?: string | undefined + parent: t_nullable_team_simple + permission: string + permissions?: + | { + admin: boolean + maintain: boolean + pull: boolean + push: boolean + triage: boolean + } + | undefined + privacy?: string | undefined + repositories_url: string + slug: string + url: string +} + +export type t_team_simple = { + description: string | null + html_url: string + id: number + ldap_dn?: string | undefined + members_url: string + name: string + node_id: string + notification_setting?: string | undefined + permission: string + privacy?: string | undefined + repositories_url: string + slug: string + url: string +} + +export type t_thread = { + id: string + last_read_at: string | null + reason: string + repository: t_minimal_repository + subject: { + latest_comment_url: string + title: string + type: string + url: string + } + subscription_url: string + unread: boolean + updated_at: string + url: string +} + +export type t_thread_subscription = { + created_at: string | null + ignored: boolean + reason: string | null + repository_url?: string | undefined + subscribed: boolean + thread_url?: string | undefined + url: string +} + +export type t_timeline_assigned_issue_event = { + actor: t_simple_user + assignee: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_timeline_comment_event = { + actor: t_simple_user + author_association: t_author_association + body?: string | undefined + body_html?: string | undefined + body_text?: string | undefined + created_at: string + event: string + html_url: string + id: number + issue_url: string + node_id: string + performed_via_github_app?: t_nullable_integration | undefined + reactions?: t_reaction_rollup | undefined + updated_at: string + url: string + user: t_simple_user +} + +export type t_timeline_commit_commented_event = { + comments?: t_commit_comment[] | undefined + commit_id?: string | undefined + event?: string | undefined + node_id?: string | undefined +} + +export type t_timeline_committed_event = { + author: { + date: string + email: string + name: string + } + committer: { + date: string + email: string + name: string + } + event?: string | undefined + html_url: string + message: string + node_id: string + parents: { + html_url: string + sha: string + url: string + }[] + sha: string + tree: { + sha: string + url: string + } + url: string + verification: { + payload: string | null + reason: string + signature: string | null + verified: boolean + verified_at: string | null + } +} + +export type t_timeline_cross_referenced_event = { + actor?: t_simple_user | undefined + created_at: string + event: string + source: { + issue?: t_issue | undefined + type?: string | undefined + } + updated_at: string +} + +export type t_timeline_issue_events = + | t_labeled_issue_event + | t_unlabeled_issue_event + | t_milestoned_issue_event + | t_demilestoned_issue_event + | t_renamed_issue_event + | t_review_requested_issue_event + | t_review_request_removed_issue_event + | t_review_dismissed_issue_event + | t_locked_issue_event + | t_added_to_project_issue_event + | t_moved_column_in_project_issue_event + | t_removed_from_project_issue_event + | t_converted_note_to_issue_issue_event + | t_timeline_comment_event + | t_timeline_cross_referenced_event + | t_timeline_committed_event + | t_timeline_reviewed_event + | t_timeline_line_commented_event + | t_timeline_commit_commented_event + | t_timeline_assigned_issue_event + | t_timeline_unassigned_issue_event + | t_state_change_issue_event + +export type t_timeline_line_commented_event = { + comments?: t_pull_request_review_comment[] | undefined + event?: string | undefined + node_id?: string | undefined +} + +export type t_timeline_reviewed_event = { + _links: { + html: { + href: string + } + pull_request: { + href: string + } + } + author_association: t_author_association + body: string | null + body_html?: string | undefined + body_text?: string | undefined + commit_id: string + event: string + html_url: string + id: number + node_id: string + pull_request_url: string + state: string + submitted_at?: string | undefined + user: t_simple_user +} + +export type t_timeline_unassigned_issue_event = { + actor: t_simple_user + assignee: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_topic = { + names: string[] +} + +export type t_topic_search_result_item = { + aliases?: + | ( + | { + topic_relation?: + | { + id?: number | undefined + name?: string | undefined + relation_type?: string | undefined + topic_id?: number | undefined + } + | undefined + }[] + | null + ) + | undefined + created_at: string + created_by: string | null + curated: boolean + description: string | null + display_name: string | null + featured: boolean + logo_url?: (string | null) | undefined + name: string + related?: + | ( + | { + topic_relation?: + | { + id?: number | undefined + name?: string | undefined + relation_type?: string | undefined + topic_id?: number | undefined + } + | undefined + }[] + | null + ) + | undefined + released: string | null + repository_count?: (number | null) | undefined + score: number + short_description: string | null + text_matches?: t_search_result_text_matches | undefined + updated_at: string +} + +export type t_traffic = { + count: number + timestamp: string + uniques: number +} + +export type t_unassigned_issue_event = { + actor: t_simple_user + assignee: t_simple_user + assigner: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_unlabeled_issue_event = { + actor: t_simple_user + commit_id: string | null + commit_url: string | null + created_at: string + event: string + id: number + label: { + color: string + name: string + } + node_id: string + performed_via_github_app: t_nullable_integration + url: string +} + +export type t_user_marketplace_purchase = { + account: t_marketplace_account + billing_cycle: string + free_trial_ends_on: string | null + next_billing_date: string | null + on_free_trial: boolean + plan: t_marketplace_listing_plan + unit_count: number | null + updated_at: string | null +} + +export type t_user_role_assignment = { + assignment?: ("direct" | "indirect" | "mixed") | undefined + avatar_url: string + email?: (string | null) | undefined + events_url: string + followers_url: string + following_url: string + gists_url: string + gravatar_id: string | null + html_url: string + id: number + inherited_from?: t_team_simple[] | undefined + login: string + name?: (string | null) | undefined + node_id: string + organizations_url: string + received_events_url: string + repos_url: string + site_admin: boolean + starred_at?: string | undefined + starred_url: string + subscriptions_url: string + type: string + url: string + user_view_type?: string | undefined +} + +export type t_user_search_result_item = { + avatar_url: string + bio?: (string | null) | undefined + blog?: (string | null) | undefined + company?: (string | null) | undefined + created_at?: string | undefined + email?: (string | null) | undefined + events_url: string + followers?: number | undefined + followers_url: string + following?: number | undefined + following_url: string + gists_url: string + gravatar_id: string | null + hireable?: (boolean | null) | undefined + html_url: string + id: number + location?: (string | null) | undefined + login: string + name?: (string | null) | undefined + node_id: string + organizations_url: string + public_gists?: number | undefined + public_repos?: number | undefined + received_events_url: string + repos_url: string + score: number + site_admin: boolean + starred_url: string + subscriptions_url: string + suspended_at?: (string | null) | undefined + text_matches?: t_search_result_text_matches | undefined + type: string + updated_at?: string | undefined + url: string + user_view_type?: string | undefined +} + +export type t_validation_error = { + documentation_url: string + errors?: + | { + code: string + field?: string | undefined + index?: number | undefined + message?: string | undefined + resource?: string | undefined + value?: (string | null | number | string[]) | undefined + }[] + | undefined + message: string +} + +export type t_validation_error_simple = { + documentation_url: string + errors?: string[] | undefined + message: string +} + +export type t_verification = { + payload: string | null + reason: string + signature: string | null + verified: boolean + verified_at: string | null +} + +export type t_view_traffic = { + count: number + uniques: number + views: t_traffic[] +} + +export type t_vulnerability = { + first_patched_version: string | null + package: { + ecosystem: t_security_advisory_ecosystems + name: string | null + } | null + readonly vulnerable_functions: string[] | null + vulnerable_version_range: string | null +} + +export type t_wait_timer = number + +export type t_webhook_config = { + content_type?: t_webhook_config_content_type | undefined + insecure_ssl?: t_webhook_config_insecure_ssl | undefined + secret?: t_webhook_config_secret | undefined + url?: t_webhook_config_url | undefined +} + +export type t_webhook_config_content_type = string + +export type t_webhook_config_insecure_ssl = string | number + +export type t_webhook_config_secret = string + +export type t_webhook_config_url = string + +export type t_workflow = { + badge_url: string + created_at: string + deleted_at?: string | undefined + html_url: string + id: number + name: string + node_id: string + path: string + state: + | "active" + | "deleted" + | "disabled_fork" + | "disabled_inactivity" + | "disabled_manually" + updated_at: string + url: string +} + +export type t_workflow_run = { + actor?: t_simple_user | undefined + artifacts_url: string + cancel_url: string + check_suite_id?: number | undefined + check_suite_node_id?: string | undefined + check_suite_url: string + conclusion: string | null + created_at: string + display_title: string + event: string + head_branch: string | null + head_commit: t_nullable_simple_commit + head_repository: t_minimal_repository + head_repository_id?: number | undefined + head_sha: string + html_url: string + id: number + jobs_url: string + logs_url: string + name?: (string | null) | undefined + node_id: string + path: string + previous_attempt_url?: (string | null) | undefined + pull_requests: t_pull_request_minimal[] | null + referenced_workflows?: (t_referenced_workflow[] | null) | undefined + repository: t_minimal_repository + rerun_url: string + run_attempt?: number | undefined + run_number: number + run_started_at?: string | undefined + status: string | null + triggering_actor?: t_simple_user | undefined + updated_at: string + url: string + workflow_id: number + workflow_url: string +} + +export type t_workflow_run_usage = { + billable: { + MACOS?: + | { + job_runs?: + | { + duration_ms: number + job_id: number + }[] + | undefined + jobs: number + total_ms: number + } + | undefined + UBUNTU?: + | { + job_runs?: + | { + duration_ms: number + job_id: number + }[] + | undefined + jobs: number + total_ms: number + } + | undefined + WINDOWS?: + | { + job_runs?: + | { + duration_ms: number + job_id: number + }[] + | undefined + jobs: number + total_ms: number + } + | undefined + } + run_duration_ms?: number | undefined +} + +export type t_workflow_usage = { + billable: { + MACOS?: + | { + total_ms?: number | undefined + } + | undefined + UBUNTU?: + | { + total_ms?: number | undefined + } + | undefined + WINDOWS?: + | { + total_ms?: number | undefined + } + | undefined + } +} + +export type t_ActionsAddCustomLabelsToSelfHostedRunnerForOrgParamSchema = { + org: string + runner_id: number +} + +export type t_ActionsAddCustomLabelsToSelfHostedRunnerForOrgRequestBodySchema = + { + labels: string[] + } + +export type t_ActionsAddCustomLabelsToSelfHostedRunnerForRepoParamSchema = { + owner: string + repo: string + runner_id: number +} + +export type t_ActionsAddCustomLabelsToSelfHostedRunnerForRepoRequestBodySchema = + { + labels: string[] + } + +export type t_ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgParamSchema = { + org: string + repository_id: number + runner_group_id: number +} + +export type t_ActionsAddSelectedRepoToOrgSecretParamSchema = { + org: string + repository_id: number + secret_name: string +} + +export type t_ActionsAddSelectedRepoToOrgVariableParamSchema = { + name: string + org: string + repository_id: number +} + +export type t_ActionsAddSelfHostedRunnerToGroupForOrgParamSchema = { + org: string + runner_group_id: number + runner_id: number +} + +export type t_ActionsApproveWorkflowRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsCancelWorkflowRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsCreateEnvironmentVariableParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ActionsCreateEnvironmentVariableRequestBodySchema = { + name: string + value: string +} + +export type t_ActionsCreateHostedRunnerForOrgParamSchema = { + org: string +} + +export type t_ActionsCreateHostedRunnerForOrgRequestBodySchema = { + enable_static_ip?: boolean | undefined + image: { + id?: string | undefined + source?: ("github" | "partner" | "custom") | undefined + } + maximum_runners?: number | undefined + name: string + runner_group_id: number + size: string +} + +export type t_ActionsCreateOrUpdateEnvironmentSecretParamSchema = { + environment_name: string + owner: string + repo: string + secret_name: string +} + +export type t_ActionsCreateOrUpdateEnvironmentSecretRequestBodySchema = { + encrypted_value: string + key_id: string +} + +export type t_ActionsCreateOrUpdateOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_ActionsCreateOrUpdateOrgSecretRequestBodySchema = { + encrypted_value: string + key_id: string + selected_repository_ids?: number[] | undefined + visibility: "all" | "private" | "selected" +} + +export type t_ActionsCreateOrUpdateRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_ActionsCreateOrUpdateRepoSecretRequestBodySchema = { + encrypted_value: string + key_id: string +} + +export type t_ActionsCreateOrgVariableParamSchema = { + org: string +} + +export type t_ActionsCreateOrgVariableRequestBodySchema = { + name: string + selected_repository_ids?: number[] | undefined + value: string + visibility: "all" | "private" | "selected" +} + +export type t_ActionsCreateRegistrationTokenForOrgParamSchema = { + org: string +} + +export type t_ActionsCreateRegistrationTokenForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsCreateRemoveTokenForOrgParamSchema = { + org: string +} + +export type t_ActionsCreateRemoveTokenForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsCreateRepoVariableParamSchema = { + owner: string + repo: string +} + +export type t_ActionsCreateRepoVariableRequestBodySchema = { + name: string + value: string +} + +export type t_ActionsCreateSelfHostedRunnerGroupForOrgParamSchema = { + org: string +} + +export type t_ActionsCreateSelfHostedRunnerGroupForOrgRequestBodySchema = { + allows_public_repositories?: boolean | undefined + name: string + network_configuration_id?: string | undefined + restricted_to_workflows?: boolean | undefined + runners?: number[] | undefined + selected_repository_ids?: number[] | undefined + selected_workflows?: string[] | undefined + visibility?: ("selected" | "all" | "private") | undefined +} + +export type t_ActionsCreateWorkflowDispatchParamSchema = { + owner: string + repo: string + workflow_id: number | string +} + +export type t_ActionsCreateWorkflowDispatchRequestBodySchema = { + inputs?: + | { + [key: string]: unknown | undefined + } + | undefined + ref: string +} + +export type t_ActionsDeleteActionsCacheByIdParamSchema = { + cache_id: number + owner: string + repo: string +} + +export type t_ActionsDeleteActionsCacheByKeyParamSchema = { + owner: string + repo: string +} + +export type t_ActionsDeleteActionsCacheByKeyQuerySchema = { + key: string + ref?: string | undefined +} + +export type t_ActionsDeleteArtifactParamSchema = { + artifact_id: number + owner: string + repo: string +} + +export type t_ActionsDeleteEnvironmentSecretParamSchema = { + environment_name: string + owner: string + repo: string + secret_name: string +} + +export type t_ActionsDeleteEnvironmentVariableParamSchema = { + environment_name: string + name: string + owner: string + repo: string +} + +export type t_ActionsDeleteHostedRunnerForOrgParamSchema = { + hosted_runner_id: number + org: string +} + +export type t_ActionsDeleteOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_ActionsDeleteOrgVariableParamSchema = { + name: string + org: string +} + +export type t_ActionsDeleteRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_ActionsDeleteRepoVariableParamSchema = { + name: string + owner: string + repo: string +} + +export type t_ActionsDeleteSelfHostedRunnerFromOrgParamSchema = { + org: string + runner_id: number +} + +export type t_ActionsDeleteSelfHostedRunnerFromRepoParamSchema = { + owner: string + repo: string + runner_id: number +} + +export type t_ActionsDeleteSelfHostedRunnerGroupFromOrgParamSchema = { + org: string + runner_group_id: number +} + +export type t_ActionsDeleteWorkflowRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsDeleteWorkflowRunLogsParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsDisableSelectedRepositoryGithubActionsOrganizationParamSchema = + { + org: string + repository_id: number + } + +export type t_ActionsDisableWorkflowParamSchema = { + owner: string + repo: string + workflow_id: number | string +} + +export type t_ActionsDownloadArtifactParamSchema = { + archive_format: string + artifact_id: number + owner: string + repo: string +} + +export type t_ActionsDownloadJobLogsForWorkflowRunParamSchema = { + job_id: number + owner: string + repo: string +} + +export type t_ActionsDownloadWorkflowRunAttemptLogsParamSchema = { + attempt_number: number + owner: string + repo: string + run_id: number +} + +export type t_ActionsDownloadWorkflowRunLogsParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsEnableSelectedRepositoryGithubActionsOrganizationParamSchema = + { + org: string + repository_id: number + } + +export type t_ActionsEnableWorkflowParamSchema = { + owner: string + repo: string + workflow_id: number | string +} + +export type t_ActionsForceCancelWorkflowRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsGenerateRunnerJitconfigForOrgParamSchema = { + org: string +} + +export type t_ActionsGenerateRunnerJitconfigForOrgRequestBodySchema = { + labels: string[] + name: string + runner_group_id: number + work_folder?: string | undefined +} + +export type t_ActionsGenerateRunnerJitconfigForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsGenerateRunnerJitconfigForRepoRequestBodySchema = { + labels: string[] + name: string + runner_group_id: number + work_folder?: string | undefined +} + +export type t_ActionsGetActionsCacheListParamSchema = { + owner: string + repo: string +} + +export type t_ActionsGetActionsCacheListQuerySchema = { + direction?: ("asc" | "desc") | undefined + key?: string | undefined + page?: number | undefined + per_page?: number | undefined + ref?: string | undefined + sort?: ("created_at" | "last_accessed_at" | "size_in_bytes") | undefined +} + +export type t_ActionsGetActionsCacheUsageParamSchema = { + owner: string + repo: string +} + +export type t_ActionsGetActionsCacheUsageByRepoForOrgParamSchema = { + org: string +} + +export type t_ActionsGetActionsCacheUsageByRepoForOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsGetActionsCacheUsageForOrgParamSchema = { + org: string +} + +export type t_ActionsGetAllowedActionsOrganizationParamSchema = { + org: string +} + +export type t_ActionsGetAllowedActionsRepositoryParamSchema = { + owner: string + repo: string +} + +export type t_ActionsGetArtifactParamSchema = { + artifact_id: number + owner: string + repo: string +} + +export type t_ActionsGetCustomOidcSubClaimForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsGetEnvironmentPublicKeyParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ActionsGetEnvironmentSecretParamSchema = { + environment_name: string + owner: string + repo: string + secret_name: string +} + +export type t_ActionsGetEnvironmentVariableParamSchema = { + environment_name: string + name: string + owner: string + repo: string +} + +export type t_ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema = + { + org: string + } + +export type t_ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema = + { + owner: string + repo: string + } + +export type t_ActionsGetGithubActionsPermissionsOrganizationParamSchema = { + org: string +} + +export type t_ActionsGetGithubActionsPermissionsRepositoryParamSchema = { + owner: string + repo: string +} + +export type t_ActionsGetHostedRunnerForOrgParamSchema = { + hosted_runner_id: number + org: string +} + +export type t_ActionsGetHostedRunnersGithubOwnedImagesForOrgParamSchema = { + org: string +} + +export type t_ActionsGetHostedRunnersLimitsForOrgParamSchema = { + org: string +} + +export type t_ActionsGetHostedRunnersMachineSpecsForOrgParamSchema = { + org: string +} + +export type t_ActionsGetHostedRunnersPartnerImagesForOrgParamSchema = { + org: string +} + +export type t_ActionsGetHostedRunnersPlatformsForOrgParamSchema = { + org: string +} + +export type t_ActionsGetJobForWorkflowRunParamSchema = { + job_id: number + owner: string + repo: string +} + +export type t_ActionsGetOrgPublicKeyParamSchema = { + org: string +} + +export type t_ActionsGetOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_ActionsGetOrgVariableParamSchema = { + name: string + org: string +} + +export type t_ActionsGetPendingDeploymentsForRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsGetRepoPublicKeyParamSchema = { + owner: string + repo: string +} + +export type t_ActionsGetRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_ActionsGetRepoVariableParamSchema = { + name: string + owner: string + repo: string +} + +export type t_ActionsGetReviewsForRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsGetSelfHostedRunnerForOrgParamSchema = { + org: string + runner_id: number +} + +export type t_ActionsGetSelfHostedRunnerForRepoParamSchema = { + owner: string + repo: string + runner_id: number +} + +export type t_ActionsGetSelfHostedRunnerGroupForOrgParamSchema = { + org: string + runner_group_id: number +} + +export type t_ActionsGetWorkflowParamSchema = { + owner: string + repo: string + workflow_id: number | string +} + +export type t_ActionsGetWorkflowAccessToRepositoryParamSchema = { + owner: string + repo: string +} + +export type t_ActionsGetWorkflowRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsGetWorkflowRunQuerySchema = { + exclude_pull_requests?: boolean | undefined +} + +export type t_ActionsGetWorkflowRunAttemptParamSchema = { + attempt_number: number + owner: string + repo: string + run_id: number +} + +export type t_ActionsGetWorkflowRunAttemptQuerySchema = { + exclude_pull_requests?: boolean | undefined +} + +export type t_ActionsGetWorkflowRunUsageParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsGetWorkflowUsageParamSchema = { + owner: string + repo: string + workflow_id: number | string +} + +export type t_ActionsListArtifactsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListArtifactsForRepoQuerySchema = { + name?: string | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListEnvironmentSecretsParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ActionsListEnvironmentSecretsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListEnvironmentVariablesParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ActionsListEnvironmentVariablesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListGithubHostedRunnersInGroupForOrgParamSchema = { + org: string + runner_group_id: number +} + +export type t_ActionsListGithubHostedRunnersInGroupForOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListHostedRunnersForOrgParamSchema = { + org: string +} + +export type t_ActionsListHostedRunnersForOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListJobsForWorkflowRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsListJobsForWorkflowRunQuerySchema = { + filter?: ("latest" | "all") | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListJobsForWorkflowRunAttemptParamSchema = { + attempt_number: number + owner: string + repo: string + run_id: number +} + +export type t_ActionsListJobsForWorkflowRunAttemptQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListLabelsForSelfHostedRunnerForOrgParamSchema = { + org: string + runner_id: number +} + +export type t_ActionsListLabelsForSelfHostedRunnerForRepoParamSchema = { + owner: string + repo: string + runner_id: number +} + +export type t_ActionsListOrgSecretsParamSchema = { + org: string +} + +export type t_ActionsListOrgSecretsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListOrgVariablesParamSchema = { + org: string +} + +export type t_ActionsListOrgVariablesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParamSchema = { + org: string + runner_group_id: number +} + +export type t_ActionsListRepoAccessToSelfHostedRunnerGroupInOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListRepoOrganizationSecretsParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListRepoOrganizationSecretsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListRepoOrganizationVariablesParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListRepoOrganizationVariablesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListRepoSecretsParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListRepoSecretsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListRepoVariablesParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListRepoVariablesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListRepoWorkflowsParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListRepoWorkflowsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListRunnerApplicationsForOrgParamSchema = { + org: string +} + +export type t_ActionsListRunnerApplicationsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListSelectedReposForOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_ActionsListSelectedReposForOrgSecretQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListSelectedReposForOrgVariableParamSchema = { + name: string + org: string +} + +export type t_ActionsListSelectedReposForOrgVariableQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema = + { + org: string + } + +export type t_ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationQuerySchema = + { + page?: number | undefined + per_page?: number | undefined + } + +export type t_ActionsListSelfHostedRunnerGroupsForOrgParamSchema = { + org: string +} + +export type t_ActionsListSelfHostedRunnerGroupsForOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined + visible_to_repository?: string | undefined +} + +export type t_ActionsListSelfHostedRunnersForOrgParamSchema = { + org: string +} + +export type t_ActionsListSelfHostedRunnersForOrgQuerySchema = { + name?: string | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListSelfHostedRunnersForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListSelfHostedRunnersForRepoQuerySchema = { + name?: string | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListSelfHostedRunnersInGroupForOrgParamSchema = { + org: string + runner_group_id: number +} + +export type t_ActionsListSelfHostedRunnersInGroupForOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListWorkflowRunArtifactsParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsListWorkflowRunArtifactsQuerySchema = { + name?: string | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActionsListWorkflowRunsParamSchema = { + owner: string + repo: string + workflow_id: number | string +} + +export type t_ActionsListWorkflowRunsQuerySchema = { + actor?: string | undefined + branch?: string | undefined + check_suite_id?: number | undefined + created?: string | undefined + event?: string | undefined + exclude_pull_requests?: boolean | undefined + head_sha?: string | undefined + page?: number | undefined + per_page?: number | undefined + status?: + | ( + | "completed" + | "action_required" + | "cancelled" + | "failure" + | "neutral" + | "skipped" + | "stale" + | "success" + | "timed_out" + | "in_progress" + | "queued" + | "requested" + | "waiting" + | "pending" + ) + | undefined +} + +export type t_ActionsListWorkflowRunsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsListWorkflowRunsForRepoQuerySchema = { + actor?: string | undefined + branch?: string | undefined + check_suite_id?: number | undefined + created?: string | undefined + event?: string | undefined + exclude_pull_requests?: boolean | undefined + head_sha?: string | undefined + page?: number | undefined + per_page?: number | undefined + status?: + | ( + | "completed" + | "action_required" + | "cancelled" + | "failure" + | "neutral" + | "skipped" + | "stale" + | "success" + | "timed_out" + | "in_progress" + | "queued" + | "requested" + | "waiting" + | "pending" + ) + | undefined +} + +export type t_ActionsReRunJobForWorkflowRunParamSchema = { + job_id: number + owner: string + repo: string +} + +export type t_ActionsReRunJobForWorkflowRunRequestBodySchema = { + enable_debug_logging?: boolean | undefined +} | null + +export type t_ActionsReRunWorkflowParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsReRunWorkflowRequestBodySchema = { + enable_debug_logging?: boolean | undefined +} | null + +export type t_ActionsReRunWorkflowFailedJobsParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsReRunWorkflowFailedJobsRequestBodySchema = { + enable_debug_logging?: boolean | undefined +} | null + +export type t_ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgParamSchema = + { + org: string + runner_id: number + } + +export type t_ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoParamSchema = + { + owner: string + repo: string + runner_id: number + } + +export type t_ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgParamSchema = { + name: string + org: string + runner_id: number +} + +export type t_ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoParamSchema = { + name: string + owner: string + repo: string + runner_id: number +} + +export type t_ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgParamSchema = { + org: string + repository_id: number + runner_group_id: number +} + +export type t_ActionsRemoveSelectedRepoFromOrgSecretParamSchema = { + org: string + repository_id: number + secret_name: string +} + +export type t_ActionsRemoveSelectedRepoFromOrgVariableParamSchema = { + name: string + org: string + repository_id: number +} + +export type t_ActionsRemoveSelfHostedRunnerFromGroupForOrgParamSchema = { + org: string + runner_group_id: number + runner_id: number +} + +export type t_ActionsReviewCustomGatesForRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsReviewCustomGatesForRunRequestBodySchema = + | t_review_custom_gates_comment_required + | t_review_custom_gates_state_required + +export type t_ActionsReviewPendingDeploymentsForRunParamSchema = { + owner: string + repo: string + run_id: number +} + +export type t_ActionsReviewPendingDeploymentsForRunRequestBodySchema = { + comment: string + environment_ids: number[] + state: "approved" | "rejected" +} + +export type t_ActionsSetAllowedActionsOrganizationParamSchema = { + org: string +} + +export type t_ActionsSetAllowedActionsOrganizationRequestBodySchema = { + github_owned_allowed?: boolean | undefined + patterns_allowed?: string[] | undefined + verified_allowed?: boolean | undefined +} + +export type t_ActionsSetAllowedActionsRepositoryParamSchema = { + owner: string + repo: string +} + +export type t_ActionsSetAllowedActionsRepositoryRequestBodySchema = { + github_owned_allowed?: boolean | undefined + patterns_allowed?: string[] | undefined + verified_allowed?: boolean | undefined +} + +export type t_ActionsSetCustomLabelsForSelfHostedRunnerForOrgParamSchema = { + org: string + runner_id: number +} + +export type t_ActionsSetCustomLabelsForSelfHostedRunnerForOrgRequestBodySchema = + { + labels: string[] + } + +export type t_ActionsSetCustomLabelsForSelfHostedRunnerForRepoParamSchema = { + owner: string + repo: string + runner_id: number +} + +export type t_ActionsSetCustomLabelsForSelfHostedRunnerForRepoRequestBodySchema = + { + labels: string[] + } + +export type t_ActionsSetCustomOidcSubClaimForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActionsSetCustomOidcSubClaimForRepoRequestBodySchema = { + include_claim_keys?: string[] | undefined + use_default: boolean +} + +export type t_ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationParamSchema = + { + org: string + } + +export type t_ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationRequestBodySchema = + { + can_approve_pull_request_reviews?: + | t_actions_can_approve_pull_request_reviews + | undefined + default_workflow_permissions?: + | t_actions_default_workflow_permissions + | undefined + } + +export type t_ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryParamSchema = + { + owner: string + repo: string + } + +export type t_ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryRequestBodySchema = + { + can_approve_pull_request_reviews?: + | t_actions_can_approve_pull_request_reviews + | undefined + default_workflow_permissions?: + | t_actions_default_workflow_permissions + | undefined + } + +export type t_ActionsSetGithubActionsPermissionsOrganizationParamSchema = { + org: string +} + +export type t_ActionsSetGithubActionsPermissionsOrganizationRequestBodySchema = + { + allowed_actions?: t_allowed_actions | undefined + enabled_repositories: t_enabled_repositories + } + +export type t_ActionsSetGithubActionsPermissionsRepositoryParamSchema = { + owner: string + repo: string +} + +export type t_ActionsSetGithubActionsPermissionsRepositoryRequestBodySchema = { + allowed_actions?: t_allowed_actions | undefined + enabled: t_actions_enabled +} + +export type t_ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgParamSchema = { + org: string + runner_group_id: number +} + +export type t_ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgRequestBodySchema = + { + selected_repository_ids: number[] + } + +export type t_ActionsSetSelectedReposForOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_ActionsSetSelectedReposForOrgSecretRequestBodySchema = { + selected_repository_ids: number[] +} + +export type t_ActionsSetSelectedReposForOrgVariableParamSchema = { + name: string + org: string +} + +export type t_ActionsSetSelectedReposForOrgVariableRequestBodySchema = { + selected_repository_ids: number[] +} + +export type t_ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationParamSchema = + { + org: string + } + +export type t_ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationRequestBodySchema = + { + selected_repository_ids: number[] + } + +export type t_ActionsSetSelfHostedRunnersInGroupForOrgParamSchema = { + org: string + runner_group_id: number +} + +export type t_ActionsSetSelfHostedRunnersInGroupForOrgRequestBodySchema = { + runners: number[] +} + +export type t_ActionsSetWorkflowAccessToRepositoryParamSchema = { + owner: string + repo: string +} + +export type t_ActionsSetWorkflowAccessToRepositoryRequestBodySchema = { + access_level: "none" | "user" | "organization" +} + +export type t_ActionsUpdateEnvironmentVariableParamSchema = { + environment_name: string + name: string + owner: string + repo: string +} + +export type t_ActionsUpdateEnvironmentVariableRequestBodySchema = { + name?: string | undefined + value?: string | undefined +} + +export type t_ActionsUpdateHostedRunnerForOrgParamSchema = { + hosted_runner_id: number + org: string +} + +export type t_ActionsUpdateHostedRunnerForOrgRequestBodySchema = { + enable_static_ip?: boolean | undefined + maximum_runners?: number | undefined + name?: string | undefined + runner_group_id?: number | undefined +} + +export type t_ActionsUpdateOrgVariableParamSchema = { + name: string + org: string +} + +export type t_ActionsUpdateOrgVariableRequestBodySchema = { + name?: string | undefined + selected_repository_ids?: number[] | undefined + value?: string | undefined + visibility?: ("all" | "private" | "selected") | undefined +} + +export type t_ActionsUpdateRepoVariableParamSchema = { + name: string + owner: string + repo: string +} + +export type t_ActionsUpdateRepoVariableRequestBodySchema = { + name?: string | undefined + value?: string | undefined +} + +export type t_ActionsUpdateSelfHostedRunnerGroupForOrgParamSchema = { + org: string + runner_group_id: number +} + +export type t_ActionsUpdateSelfHostedRunnerGroupForOrgRequestBodySchema = { + allows_public_repositories?: boolean | undefined + name: string + network_configuration_id?: (string | null) | undefined + restricted_to_workflows?: boolean | undefined + selected_workflows?: string[] | undefined + visibility?: ("selected" | "all" | "private") | undefined +} + +export type t_ActivityCheckRepoIsStarredByAuthenticatedUserParamSchema = { + owner: string + repo: string +} + +export type t_ActivityDeleteRepoSubscriptionParamSchema = { + owner: string + repo: string +} + +export type t_ActivityDeleteThreadSubscriptionParamSchema = { + thread_id: number +} + +export type t_ActivityGetRepoSubscriptionParamSchema = { + owner: string + repo: string +} + +export type t_ActivityGetThreadParamSchema = { + thread_id: number +} + +export type t_ActivityGetThreadSubscriptionForAuthenticatedUserParamSchema = { + thread_id: number +} + +export type t_ActivityListEventsForAuthenticatedUserParamSchema = { + username: string +} + +export type t_ActivityListEventsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListNotificationsForAuthenticatedUserQuerySchema = { + all?: boolean | undefined + before?: string | undefined + page?: number | undefined + participating?: boolean | undefined + per_page?: number | undefined + since?: string | undefined +} + +export type t_ActivityListOrgEventsForAuthenticatedUserParamSchema = { + org: string + username: string +} + +export type t_ActivityListOrgEventsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListPublicEventsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListPublicEventsForRepoNetworkParamSchema = { + owner: string + repo: string +} + +export type t_ActivityListPublicEventsForRepoNetworkQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListPublicEventsForUserParamSchema = { + username: string +} + +export type t_ActivityListPublicEventsForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListPublicOrgEventsParamSchema = { + org: string +} + +export type t_ActivityListPublicOrgEventsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListReceivedEventsForUserParamSchema = { + username: string +} + +export type t_ActivityListReceivedEventsForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListReceivedPublicEventsForUserParamSchema = { + username: string +} + +export type t_ActivityListReceivedPublicEventsForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListRepoEventsParamSchema = { + owner: string + repo: string +} + +export type t_ActivityListRepoEventsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListRepoNotificationsForAuthenticatedUserParamSchema = { + owner: string + repo: string +} + +export type t_ActivityListRepoNotificationsForAuthenticatedUserQuerySchema = { + all?: boolean | undefined + before?: string | undefined + page?: number | undefined + participating?: boolean | undefined + per_page?: number | undefined + since?: string | undefined +} + +export type t_ActivityListReposStarredByAuthenticatedUserQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("created" | "updated") | undefined +} + +export type t_ActivityListReposStarredByUserParamSchema = { + username: string +} + +export type t_ActivityListReposStarredByUserQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("created" | "updated") | undefined +} + +export type t_ActivityListReposWatchedByUserParamSchema = { + username: string +} + +export type t_ActivityListReposWatchedByUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListStargazersForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActivityListStargazersForRepoQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListWatchedReposForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityListWatchersForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ActivityListWatchersForRepoQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ActivityMarkNotificationsAsReadRequestBodySchema = { + last_read_at?: string | undefined + read?: boolean | undefined +} + +export type t_ActivityMarkRepoNotificationsAsReadParamSchema = { + owner: string + repo: string +} + +export type t_ActivityMarkRepoNotificationsAsReadRequestBodySchema = { + last_read_at?: string | undefined +} + +export type t_ActivityMarkThreadAsDoneParamSchema = { + thread_id: number +} + +export type t_ActivityMarkThreadAsReadParamSchema = { + thread_id: number +} + +export type t_ActivitySetRepoSubscriptionParamSchema = { + owner: string + repo: string +} + +export type t_ActivitySetRepoSubscriptionRequestBodySchema = { + ignored?: boolean | undefined + subscribed?: boolean | undefined +} + +export type t_ActivitySetThreadSubscriptionParamSchema = { + thread_id: number +} + +export type t_ActivitySetThreadSubscriptionRequestBodySchema = { + ignored?: boolean | undefined +} + +export type t_ActivityStarRepoForAuthenticatedUserParamSchema = { + owner: string + repo: string +} + +export type t_ActivityUnstarRepoForAuthenticatedUserParamSchema = { + owner: string + repo: string +} + +export type t_ApiInsightsGetRouteStatsByActorParamSchema = { + actor_id: number + actor_type: + | "installation" + | "classic_pat" + | "fine_grained_pat" + | "oauth_app" + | "github_app_user_to_server" + org: string +} + +export type t_ApiInsightsGetRouteStatsByActorQuerySchema = { + api_route_substring?: string | undefined + direction?: ("asc" | "desc") | undefined + max_timestamp?: string | undefined + min_timestamp: string + page?: number | undefined + per_page?: number | undefined + sort?: + | ( + | "last_rate_limited_timestamp" + | "last_request_timestamp" + | "rate_limited_request_count" + | "http_method" + | "api_route" + | "total_request_count" + )[] + | undefined +} + +export type t_ApiInsightsGetSubjectStatsParamSchema = { + org: string +} + +export type t_ApiInsightsGetSubjectStatsQuerySchema = { + direction?: ("asc" | "desc") | undefined + max_timestamp?: string | undefined + min_timestamp: string + page?: number | undefined + per_page?: number | undefined + sort?: + | ( + | "last_rate_limited_timestamp" + | "last_request_timestamp" + | "rate_limited_request_count" + | "subject_name" + | "total_request_count" + )[] + | undefined + subject_name_substring?: string | undefined +} + +export type t_ApiInsightsGetSummaryStatsParamSchema = { + org: string +} + +export type t_ApiInsightsGetSummaryStatsQuerySchema = { + max_timestamp?: string | undefined + min_timestamp: string +} + +export type t_ApiInsightsGetSummaryStatsByActorParamSchema = { + actor_id: number + actor_type: + | "installation" + | "classic_pat" + | "fine_grained_pat" + | "oauth_app" + | "github_app_user_to_server" + org: string +} + +export type t_ApiInsightsGetSummaryStatsByActorQuerySchema = { + max_timestamp?: string | undefined + min_timestamp: string +} + +export type t_ApiInsightsGetSummaryStatsByUserParamSchema = { + org: string + user_id: string +} + +export type t_ApiInsightsGetSummaryStatsByUserQuerySchema = { + max_timestamp?: string | undefined + min_timestamp: string +} + +export type t_ApiInsightsGetTimeStatsParamSchema = { + org: string +} + +export type t_ApiInsightsGetTimeStatsQuerySchema = { + max_timestamp?: string | undefined + min_timestamp: string + timestamp_increment: string +} + +export type t_ApiInsightsGetTimeStatsByActorParamSchema = { + actor_id: number + actor_type: + | "installation" + | "classic_pat" + | "fine_grained_pat" + | "oauth_app" + | "github_app_user_to_server" + org: string +} + +export type t_ApiInsightsGetTimeStatsByActorQuerySchema = { + max_timestamp?: string | undefined + min_timestamp: string + timestamp_increment: string +} + +export type t_ApiInsightsGetTimeStatsByUserParamSchema = { + org: string + user_id: string +} + +export type t_ApiInsightsGetTimeStatsByUserQuerySchema = { + max_timestamp?: string | undefined + min_timestamp: string + timestamp_increment: string +} + +export type t_ApiInsightsGetUserStatsParamSchema = { + org: string + user_id: string +} + +export type t_ApiInsightsGetUserStatsQuerySchema = { + actor_name_substring?: string | undefined + direction?: ("asc" | "desc") | undefined + max_timestamp?: string | undefined + min_timestamp: string + page?: number | undefined + per_page?: number | undefined + sort?: + | ( + | "last_rate_limited_timestamp" + | "last_request_timestamp" + | "rate_limited_request_count" + | "subject_name" + | "total_request_count" + )[] + | undefined +} + +export type t_AppsAddRepoToInstallationForAuthenticatedUserParamSchema = { + installation_id: number + repository_id: number +} + +export type t_AppsCheckTokenParamSchema = { + client_id: string +} + +export type t_AppsCheckTokenRequestBodySchema = { + access_token: string +} + +export type t_AppsCreateFromManifestParamSchema = { + code: string +} + +export type t_AppsCreateInstallationAccessTokenParamSchema = { + installation_id: number +} + +export type t_AppsCreateInstallationAccessTokenRequestBodySchema = { + permissions?: t_app_permissions | undefined + repositories?: string[] | undefined + repository_ids?: number[] | undefined +} + +export type t_AppsDeleteAuthorizationParamSchema = { + client_id: string +} + +export type t_AppsDeleteAuthorizationRequestBodySchema = { + access_token: string +} + +export type t_AppsDeleteInstallationParamSchema = { + installation_id: number +} + +export type t_AppsDeleteTokenParamSchema = { + client_id: string +} + +export type t_AppsDeleteTokenRequestBodySchema = { + access_token: string +} + +export type t_AppsGetBySlugParamSchema = { + app_slug: string +} + +export type t_AppsGetInstallationParamSchema = { + installation_id: number +} + +export type t_AppsGetOrgInstallationParamSchema = { + org: string +} + +export type t_AppsGetRepoInstallationParamSchema = { + owner: string + repo: string +} + +export type t_AppsGetSubscriptionPlanForAccountParamSchema = { + account_id: number +} + +export type t_AppsGetSubscriptionPlanForAccountStubbedParamSchema = { + account_id: number +} + +export type t_AppsGetUserInstallationParamSchema = { + username: string +} + +export type t_AppsGetWebhookDeliveryParamSchema = { + delivery_id: number +} + +export type t_AppsListAccountsForPlanParamSchema = { + plan_id: number +} + +export type t_AppsListAccountsForPlanQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("created" | "updated") | undefined +} + +export type t_AppsListAccountsForPlanStubbedParamSchema = { + plan_id: number +} + +export type t_AppsListAccountsForPlanStubbedQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("created" | "updated") | undefined +} + +export type t_AppsListInstallationReposForAuthenticatedUserParamSchema = { + installation_id: number +} + +export type t_AppsListInstallationReposForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_AppsListInstallationRequestsForAuthenticatedAppQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_AppsListInstallationsQuerySchema = { + outdated?: string | undefined + page?: number | undefined + per_page?: number | undefined + since?: string | undefined +} + +export type t_AppsListInstallationsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_AppsListPlansQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_AppsListPlansStubbedQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_AppsListReposAccessibleToInstallationQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_AppsListSubscriptionsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_AppsListSubscriptionsForAuthenticatedUserStubbedQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_AppsListWebhookDeliveriesQuerySchema = { + cursor?: string | undefined + per_page?: number | undefined +} + +export type t_AppsRedeliverWebhookDeliveryParamSchema = { + delivery_id: number +} + +export type t_AppsRemoveRepoFromInstallationForAuthenticatedUserParamSchema = { + installation_id: number + repository_id: number +} + +export type t_AppsResetTokenParamSchema = { + client_id: string +} + +export type t_AppsResetTokenRequestBodySchema = { + access_token: string +} + +export type t_AppsScopeTokenParamSchema = { + client_id: string +} + +export type t_AppsScopeTokenRequestBodySchema = { + access_token: string + permissions?: t_app_permissions | undefined + repositories?: string[] | undefined + repository_ids?: number[] | undefined + target?: string | undefined + target_id?: number | undefined +} + +export type t_AppsSuspendInstallationParamSchema = { + installation_id: number +} + +export type t_AppsUnsuspendInstallationParamSchema = { + installation_id: number +} + +export type t_AppsUpdateWebhookConfigForAppRequestBodySchema = { + content_type?: t_webhook_config_content_type | undefined + insecure_ssl?: t_webhook_config_insecure_ssl | undefined + secret?: t_webhook_config_secret | undefined + url?: t_webhook_config_url | undefined +} + +export type t_BillingGetGithubActionsBillingOrgParamSchema = { + org: string +} + +export type t_BillingGetGithubActionsBillingUserParamSchema = { + username: string +} + +export type t_BillingGetGithubBillingUsageReportOrgParamSchema = { + org: string +} + +export type t_BillingGetGithubBillingUsageReportOrgQuerySchema = { + day?: number | undefined + hour?: number | undefined + month?: number | undefined + year?: number | undefined +} + +export type t_BillingGetGithubPackagesBillingOrgParamSchema = { + org: string +} + +export type t_BillingGetGithubPackagesBillingUserParamSchema = { + username: string +} + +export type t_BillingGetSharedStorageBillingOrgParamSchema = { + org: string +} + +export type t_BillingGetSharedStorageBillingUserParamSchema = { + username: string +} + +export type t_CampaignsCreateCampaignParamSchema = { + org: string +} + +export type t_CampaignsCreateCampaignRequestBodySchema = { + code_scanning_alerts: { + alert_numbers: number[] + repository_id: number + }[] + contact_link?: (string | null) | undefined + description: string + ends_at: string + generate_issues?: boolean | undefined + managers?: string[] | undefined + name: string + team_managers?: string[] | undefined +} + +export type t_CampaignsDeleteCampaignParamSchema = { + campaign_number: number + org: string +} + +export type t_CampaignsGetCampaignSummaryParamSchema = { + campaign_number: number + org: string +} + +export type t_CampaignsListOrgCampaignsParamSchema = { + org: string +} + +export type t_CampaignsListOrgCampaignsQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("created" | "updated" | "ends_at" | "published") | undefined + state?: t_campaign_state | undefined +} + +export type t_CampaignsUpdateCampaignParamSchema = { + campaign_number: number + org: string +} + +export type t_CampaignsUpdateCampaignRequestBodySchema = { + contact_link?: (string | null) | undefined + description?: string | undefined + ends_at?: string | undefined + managers?: string[] | undefined + name?: string | undefined + state?: t_campaign_state | undefined + team_managers?: string[] | undefined +} + +export type t_ChecksCreateParamSchema = { + owner: string + repo: string +} + +export type t_ChecksCreateRequestBodySchema = + | { + status: EmptyObject + [key: string]: unknown | undefined + } + | { + status?: EmptyObject | undefined + [key: string]: unknown | undefined + } + +export type t_ChecksCreateSuiteParamSchema = { + owner: string + repo: string +} + +export type t_ChecksCreateSuiteRequestBodySchema = { + head_sha: string +} + +export type t_ChecksGetParamSchema = { + check_run_id: number + owner: string + repo: string +} + +export type t_ChecksGetSuiteParamSchema = { + check_suite_id: number + owner: string + repo: string +} + +export type t_ChecksListAnnotationsParamSchema = { + check_run_id: number + owner: string + repo: string +} + +export type t_ChecksListAnnotationsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ChecksListForRefParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_ChecksListForRefQuerySchema = { + app_id?: number | undefined + check_name?: string | undefined + filter?: ("latest" | "all") | undefined + page?: number | undefined + per_page?: number | undefined + status?: ("queued" | "in_progress" | "completed") | undefined +} + +export type t_ChecksListForSuiteParamSchema = { + check_suite_id: number + owner: string + repo: string +} + +export type t_ChecksListForSuiteQuerySchema = { + check_name?: string | undefined + filter?: ("latest" | "all") | undefined + page?: number | undefined + per_page?: number | undefined + status?: ("queued" | "in_progress" | "completed") | undefined +} + +export type t_ChecksListSuitesForRefParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_ChecksListSuitesForRefQuerySchema = { + app_id?: number | undefined + check_name?: string | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ChecksRerequestRunParamSchema = { + check_run_id: number + owner: string + repo: string +} + +export type t_ChecksRerequestSuiteParamSchema = { + check_suite_id: number + owner: string + repo: string +} + +export type t_ChecksSetSuitesPreferencesParamSchema = { + owner: string + repo: string +} + +export type t_ChecksSetSuitesPreferencesRequestBodySchema = { + auto_trigger_checks?: + | { + app_id: number + setting: boolean + }[] + | undefined +} + +export type t_ChecksUpdateParamSchema = { + check_run_id: number + owner: string + repo: string +} + +export type t_ChecksUpdateRequestBodySchema = { + actions?: + | { + description: string + identifier: string + label: string + }[] + | undefined + completed_at?: string | undefined + conclusion?: + | ( + | "action_required" + | "cancelled" + | "failure" + | "neutral" + | "success" + | "skipped" + | "stale" + | "timed_out" + ) + | undefined + details_url?: string | undefined + external_id?: string | undefined + name?: string | undefined + output?: + | { + annotations?: + | { + annotation_level: "notice" | "warning" | "failure" + end_column?: number | undefined + end_line: number + message: string + path: string + raw_details?: string | undefined + start_column?: number | undefined + start_line: number + title?: string | undefined + }[] + | undefined + images?: + | { + alt: string + caption?: string | undefined + image_url: string + }[] + | undefined + summary: string + text?: string | undefined + title?: string | undefined + } + | undefined + started_at?: string | undefined + status?: + | ( + | "queued" + | "in_progress" + | "completed" + | "waiting" + | "requested" + | "pending" + ) + | undefined +} + +export type t_ClassroomGetAClassroomParamSchema = { + classroom_id: number +} + +export type t_ClassroomGetAnAssignmentParamSchema = { + assignment_id: number +} + +export type t_ClassroomGetAssignmentGradesParamSchema = { + assignment_id: number +} + +export type t_ClassroomListAcceptedAssignmentsForAnAssignmentParamSchema = { + assignment_id: number +} + +export type t_ClassroomListAcceptedAssignmentsForAnAssignmentQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ClassroomListAssignmentsForAClassroomParamSchema = { + classroom_id: number +} + +export type t_ClassroomListAssignmentsForAClassroomQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ClassroomListClassroomsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_CodeScanningCommitAutofixParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_CodeScanningCommitAutofixRequestBodySchema = { + message?: string | undefined + target_ref?: string | undefined +} | null + +export type t_CodeScanningCreateAutofixParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_CodeScanningCreateVariantAnalysisParamSchema = { + owner: string + repo: string +} + +export type t_CodeScanningCreateVariantAnalysisRequestBodySchema = EmptyObject + +export type t_CodeScanningDeleteAnalysisParamSchema = { + analysis_id: number + owner: string + repo: string +} + +export type t_CodeScanningDeleteAnalysisQuerySchema = { + confirm_delete?: (string | null) | undefined +} + +export type t_CodeScanningDeleteCodeqlDatabaseParamSchema = { + language: string + owner: string + repo: string +} + +export type t_CodeScanningGetAlertParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_CodeScanningGetAnalysisParamSchema = { + analysis_id: number + owner: string + repo: string +} + +export type t_CodeScanningGetAutofixParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_CodeScanningGetCodeqlDatabaseParamSchema = { + language: string + owner: string + repo: string +} + +export type t_CodeScanningGetDefaultSetupParamSchema = { + owner: string + repo: string +} + +export type t_CodeScanningGetSarifParamSchema = { + owner: string + repo: string + sarif_id: string +} + +export type t_CodeScanningGetVariantAnalysisParamSchema = { + codeql_variant_analysis_id: number + owner: string + repo: string +} + +export type t_CodeScanningGetVariantAnalysisRepoTaskParamSchema = { + codeql_variant_analysis_id: number + owner: string + repo: string + repo_name: string + repo_owner: string +} + +export type t_CodeScanningListAlertInstancesParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_CodeScanningListAlertInstancesQuerySchema = { + page?: number | undefined + per_page?: number | undefined + pr?: number | undefined + ref?: t_code_scanning_ref | undefined +} + +export type t_CodeScanningListAlertsForOrgParamSchema = { + org: string +} + +export type t_CodeScanningListAlertsForOrgQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + severity?: t_code_scanning_alert_severity | undefined + sort?: ("created" | "updated") | undefined + state?: t_code_scanning_alert_state_query | undefined + tool_guid?: t_code_scanning_analysis_tool_guid | undefined + tool_name?: t_code_scanning_analysis_tool_name | undefined +} + +export type t_CodeScanningListAlertsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_CodeScanningListAlertsForRepoQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + pr?: number | undefined + ref?: t_code_scanning_ref | undefined + severity?: t_code_scanning_alert_severity | undefined + sort?: ("created" | "updated") | undefined + state?: t_code_scanning_alert_state_query | undefined + tool_guid?: t_code_scanning_analysis_tool_guid | undefined + tool_name?: t_code_scanning_analysis_tool_name | undefined +} + +export type t_CodeScanningListCodeqlDatabasesParamSchema = { + owner: string + repo: string +} + +export type t_CodeScanningListRecentAnalysesParamSchema = { + owner: string + repo: string +} + +export type t_CodeScanningListRecentAnalysesQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + pr?: number | undefined + ref?: t_code_scanning_ref | undefined + sarif_id?: t_code_scanning_analysis_sarif_id | undefined + sort?: "created" | undefined + tool_guid?: t_code_scanning_analysis_tool_guid | undefined + tool_name?: t_code_scanning_analysis_tool_name | undefined +} + +export type t_CodeScanningUpdateAlertParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_CodeScanningUpdateAlertRequestBodySchema = { + create_request?: t_code_scanning_alert_create_request | undefined + dismissed_comment?: t_code_scanning_alert_dismissed_comment | undefined + dismissed_reason?: t_code_scanning_alert_dismissed_reason | undefined + state: t_code_scanning_alert_set_state +} + +export type t_CodeScanningUpdateDefaultSetupParamSchema = { + owner: string + repo: string +} + +export type t_CodeScanningUpdateDefaultSetupRequestBodySchema = { + languages?: + | ( + | "actions" + | "c-cpp" + | "csharp" + | "go" + | "java-kotlin" + | "javascript-typescript" + | "python" + | "ruby" + | "swift" + )[] + | undefined + query_suite?: ("default" | "extended") | undefined + runner_label?: (string | null) | undefined + runner_type?: ("standard" | "labeled") | undefined + state?: ("configured" | "not-configured") | undefined +} + +export type t_CodeScanningUploadSarifParamSchema = { + owner: string + repo: string +} + +export type t_CodeScanningUploadSarifRequestBodySchema = { + checkout_uri?: string | undefined + commit_sha: t_code_scanning_analysis_commit_sha + ref: t_code_scanning_ref_full + sarif: t_code_scanning_analysis_sarif_file + started_at?: string | undefined + tool_name?: string | undefined + validate?: boolean | undefined +} + +export type t_CodeSecurityAttachConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityAttachConfigurationRequestBodySchema = { + scope: + | "all" + | "all_without_configurations" + | "public" + | "private_or_internal" + | "selected" + selected_repository_ids?: number[] | undefined +} + +export type t_CodeSecurityAttachEnterpriseConfigurationParamSchema = { + configuration_id: number + enterprise: string +} + +export type t_CodeSecurityAttachEnterpriseConfigurationRequestBodySchema = { + scope: "all" | "all_without_configurations" +} + +export type t_CodeSecurityCreateConfigurationParamSchema = { + org: string +} + +export type t_CodeSecurityCreateConfigurationRequestBodySchema = { + advanced_security?: + | ("enabled" | "disabled" | "code_security" | "secret_protection") + | undefined + code_scanning_default_setup?: ("enabled" | "disabled" | "not_set") | undefined + code_scanning_default_setup_options?: + | t_code_scanning_default_setup_options + | undefined + code_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependabot_alerts?: ("enabled" | "disabled" | "not_set") | undefined + dependabot_security_updates?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph_autosubmit_action?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependency_graph_autosubmit_action_options?: + | { + labeled_runners?: boolean | undefined + } + | undefined + description: string + enforcement?: ("enforced" | "unenforced") | undefined + name: string + private_vulnerability_reporting?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning?: ("enabled" | "disabled" | "not_set") | undefined + secret_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_delegated_bypass?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_delegated_bypass_options?: + | { + reviewers?: + | { + reviewer_id: number + reviewer_type: "TEAM" | "ROLE" + }[] + | undefined + } + | undefined + secret_scanning_generic_secrets?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_non_provider_patterns?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_push_protection?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_validity_checks?: + | ("enabled" | "disabled" | "not_set") + | undefined +} + +export type t_CodeSecurityCreateConfigurationForEnterpriseParamSchema = { + enterprise: string +} + +export type t_CodeSecurityCreateConfigurationForEnterpriseRequestBodySchema = { + advanced_security?: + | ("enabled" | "disabled" | "code_security" | "secret_protection") + | undefined + code_scanning_default_setup?: ("enabled" | "disabled" | "not_set") | undefined + code_scanning_default_setup_options?: + | t_code_scanning_default_setup_options + | undefined + code_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependabot_alerts?: ("enabled" | "disabled" | "not_set") | undefined + dependabot_security_updates?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph_autosubmit_action?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependency_graph_autosubmit_action_options?: + | { + labeled_runners?: boolean | undefined + } + | undefined + description: string + enforcement?: ("enforced" | "unenforced") | undefined + name: string + private_vulnerability_reporting?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning?: ("enabled" | "disabled" | "not_set") | undefined + secret_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_generic_secrets?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_non_provider_patterns?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_push_protection?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_validity_checks?: + | ("enabled" | "disabled" | "not_set") + | undefined +} + +export type t_CodeSecurityDeleteConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityDeleteConfigurationForEnterpriseParamSchema = { + configuration_id: number + enterprise: string +} + +export type t_CodeSecurityDetachConfigurationParamSchema = { + org: string +} + +export type t_CodeSecurityDetachConfigurationRequestBodySchema = { + selected_repository_ids?: number[] | undefined +} + +export type t_CodeSecurityGetConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityGetConfigurationForRepositoryParamSchema = { + owner: string + repo: string +} + +export type t_CodeSecurityGetConfigurationsForEnterpriseParamSchema = { + enterprise: string +} + +export type t_CodeSecurityGetConfigurationsForEnterpriseQuerySchema = { + after?: string | undefined + before?: string | undefined + per_page?: number | undefined +} + +export type t_CodeSecurityGetConfigurationsForOrgParamSchema = { + org: string +} + +export type t_CodeSecurityGetConfigurationsForOrgQuerySchema = { + after?: string | undefined + before?: string | undefined + per_page?: number | undefined + target_type?: ("global" | "all") | undefined +} + +export type t_CodeSecurityGetDefaultConfigurationsParamSchema = { + org: string +} + +export type t_CodeSecurityGetDefaultConfigurationsForEnterpriseParamSchema = { + enterprise: string +} + +export type t_CodeSecurityGetRepositoriesForConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityGetRepositoriesForConfigurationQuerySchema = { + after?: string | undefined + before?: string | undefined + per_page?: number | undefined + status?: string | undefined +} + +export type t_CodeSecurityGetRepositoriesForEnterpriseConfigurationParamSchema = + { + configuration_id: number + enterprise: string + } + +export type t_CodeSecurityGetRepositoriesForEnterpriseConfigurationQuerySchema = + { + after?: string | undefined + before?: string | undefined + per_page?: number | undefined + status?: string | undefined + } + +export type t_CodeSecurityGetSingleConfigurationForEnterpriseParamSchema = { + configuration_id: number + enterprise: string +} + +export type t_CodeSecuritySetConfigurationAsDefaultParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecuritySetConfigurationAsDefaultRequestBodySchema = { + default_for_new_repos?: + | ("all" | "none" | "private_and_internal" | "public") + | undefined +} + +export type t_CodeSecuritySetConfigurationAsDefaultForEnterpriseParamSchema = { + configuration_id: number + enterprise: string +} + +export type t_CodeSecuritySetConfigurationAsDefaultForEnterpriseRequestBodySchema = + { + default_for_new_repos?: + | ("all" | "none" | "private_and_internal" | "public") + | undefined + } + +export type t_CodeSecurityUpdateConfigurationParamSchema = { + configuration_id: number + org: string +} + +export type t_CodeSecurityUpdateConfigurationRequestBodySchema = { + advanced_security?: + | ("enabled" | "disabled" | "code_security" | "secret_protection") + | undefined + code_scanning_default_setup?: ("enabled" | "disabled" | "not_set") | undefined + code_scanning_default_setup_options?: + | t_code_scanning_default_setup_options + | undefined + code_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependabot_alerts?: ("enabled" | "disabled" | "not_set") | undefined + dependabot_security_updates?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph_autosubmit_action?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependency_graph_autosubmit_action_options?: + | { + labeled_runners?: boolean | undefined + } + | undefined + description?: string | undefined + enforcement?: ("enforced" | "unenforced") | undefined + name?: string | undefined + private_vulnerability_reporting?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning?: ("enabled" | "disabled" | "not_set") | undefined + secret_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_delegated_bypass?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_delegated_bypass_options?: + | { + reviewers?: + | { + reviewer_id: number + reviewer_type: "TEAM" | "ROLE" + }[] + | undefined + } + | undefined + secret_scanning_generic_secrets?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_non_provider_patterns?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_push_protection?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_validity_checks?: + | ("enabled" | "disabled" | "not_set") + | undefined +} + +export type t_CodeSecurityUpdateEnterpriseConfigurationParamSchema = { + configuration_id: number + enterprise: string +} + +export type t_CodeSecurityUpdateEnterpriseConfigurationRequestBodySchema = { + advanced_security?: + | ("enabled" | "disabled" | "code_security" | "secret_protection") + | undefined + code_scanning_default_setup?: ("enabled" | "disabled" | "not_set") | undefined + code_scanning_default_setup_options?: + | t_code_scanning_default_setup_options + | undefined + code_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependabot_alerts?: ("enabled" | "disabled" | "not_set") | undefined + dependabot_security_updates?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph?: ("enabled" | "disabled" | "not_set") | undefined + dependency_graph_autosubmit_action?: + | ("enabled" | "disabled" | "not_set") + | undefined + dependency_graph_autosubmit_action_options?: + | { + labeled_runners?: boolean | undefined + } + | undefined + description?: string | undefined + enforcement?: ("enforced" | "unenforced") | undefined + name?: string | undefined + private_vulnerability_reporting?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning?: ("enabled" | "disabled" | "not_set") | undefined + secret_scanning_delegated_alert_dismissal?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_generic_secrets?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_non_provider_patterns?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_push_protection?: + | ("enabled" | "disabled" | "not_set") + | undefined + secret_scanning_validity_checks?: + | ("enabled" | "disabled" | "not_set") + | undefined +} + +export type t_CodesOfConductGetConductCodeParamSchema = { + key: string +} + +export type t_CodespacesAddRepositoryForSecretForAuthenticatedUserParamSchema = + { + repository_id: number + secret_name: string + } + +export type t_CodespacesAddSelectedRepoToOrgSecretParamSchema = { + org: string + repository_id: number + secret_name: string +} + +export type t_CodespacesCheckPermissionsForDevcontainerParamSchema = { + owner: string + repo: string +} + +export type t_CodespacesCheckPermissionsForDevcontainerQuerySchema = { + devcontainer_path: string + ref: string +} + +export type t_CodespacesCodespaceMachinesForAuthenticatedUserParamSchema = { + codespace_name: string +} + +export type t_CodespacesCreateForAuthenticatedUserRequestBodySchema = + | { + client_ip?: string | undefined + devcontainer_path?: string | undefined + display_name?: string | undefined + geo?: ("EuropeWest" | "SoutheastAsia" | "UsEast" | "UsWest") | undefined + idle_timeout_minutes?: number | undefined + location?: string | undefined + machine?: string | undefined + multi_repo_permissions_opt_out?: boolean | undefined + ref?: string | undefined + repository_id: number + retention_period_minutes?: number | undefined + working_directory?: string | undefined + } + | { + devcontainer_path?: string | undefined + geo?: ("EuropeWest" | "SoutheastAsia" | "UsEast" | "UsWest") | undefined + idle_timeout_minutes?: number | undefined + location?: string | undefined + machine?: string | undefined + pull_request: { + pull_request_number: number + repository_id: number + } + working_directory?: string | undefined + } + +export type t_CodespacesCreateOrUpdateOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_CodespacesCreateOrUpdateOrgSecretRequestBodySchema = { + encrypted_value?: string | undefined + key_id?: string | undefined + selected_repository_ids?: number[] | undefined + visibility: "all" | "private" | "selected" +} + +export type t_CodespacesCreateOrUpdateRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_CodespacesCreateOrUpdateRepoSecretRequestBodySchema = { + encrypted_value?: string | undefined + key_id?: string | undefined +} + +export type t_CodespacesCreateOrUpdateSecretForAuthenticatedUserParamSchema = { + secret_name: string +} + +export type t_CodespacesCreateOrUpdateSecretForAuthenticatedUserRequestBodySchema = + { + encrypted_value?: string | undefined + key_id: string + selected_repository_ids?: (number | string)[] | undefined + } + +export type t_CodespacesCreateWithPrForAuthenticatedUserParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_CodespacesCreateWithPrForAuthenticatedUserRequestBodySchema = { + client_ip?: string | undefined + devcontainer_path?: string | undefined + display_name?: string | undefined + geo?: ("EuropeWest" | "SoutheastAsia" | "UsEast" | "UsWest") | undefined + idle_timeout_minutes?: number | undefined + location?: string | undefined + machine?: string | undefined + multi_repo_permissions_opt_out?: boolean | undefined + retention_period_minutes?: number | undefined + working_directory?: string | undefined +} | null + +export type t_CodespacesCreateWithRepoForAuthenticatedUserParamSchema = { + owner: string + repo: string +} + +export type t_CodespacesCreateWithRepoForAuthenticatedUserRequestBodySchema = { + client_ip?: string | undefined + devcontainer_path?: string | undefined + display_name?: string | undefined + geo?: ("EuropeWest" | "SoutheastAsia" | "UsEast" | "UsWest") | undefined + idle_timeout_minutes?: number | undefined + location?: string | undefined + machine?: string | undefined + multi_repo_permissions_opt_out?: boolean | undefined + ref?: string | undefined + retention_period_minutes?: number | undefined + working_directory?: string | undefined +} | null + +export type t_CodespacesDeleteCodespacesAccessUsersParamSchema = { + org: string +} + +export type t_CodespacesDeleteCodespacesAccessUsersRequestBodySchema = { + selected_usernames: string[] +} + +export type t_CodespacesDeleteForAuthenticatedUserParamSchema = { + codespace_name: string +} + +export type t_CodespacesDeleteFromOrganizationParamSchema = { + codespace_name: string + org: string + username: string +} + +export type t_CodespacesDeleteOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_CodespacesDeleteRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_CodespacesDeleteSecretForAuthenticatedUserParamSchema = { + secret_name: string +} + +export type t_CodespacesExportForAuthenticatedUserParamSchema = { + codespace_name: string +} + +export type t_CodespacesGetCodespacesForUserInOrgParamSchema = { + org: string + username: string +} + +export type t_CodespacesGetCodespacesForUserInOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_CodespacesGetExportDetailsForAuthenticatedUserParamSchema = { + codespace_name: string + export_id: string +} + +export type t_CodespacesGetForAuthenticatedUserParamSchema = { + codespace_name: string +} + +export type t_CodespacesGetOrgPublicKeyParamSchema = { + org: string +} + +export type t_CodespacesGetOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_CodespacesGetRepoPublicKeyParamSchema = { + owner: string + repo: string +} + +export type t_CodespacesGetRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_CodespacesGetSecretForAuthenticatedUserParamSchema = { + secret_name: string +} + +export type t_CodespacesListDevcontainersInRepositoryForAuthenticatedUserParamSchema = + { + owner: string + repo: string + } + +export type t_CodespacesListDevcontainersInRepositoryForAuthenticatedUserQuerySchema = + { + page?: number | undefined + per_page?: number | undefined + } + +export type t_CodespacesListForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined + repository_id?: number | undefined +} + +export type t_CodespacesListInOrganizationParamSchema = { + org: string +} + +export type t_CodespacesListInOrganizationQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_CodespacesListInRepositoryForAuthenticatedUserParamSchema = { + owner: string + repo: string +} + +export type t_CodespacesListInRepositoryForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_CodespacesListOrgSecretsParamSchema = { + org: string +} + +export type t_CodespacesListOrgSecretsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_CodespacesListRepoSecretsParamSchema = { + owner: string + repo: string +} + +export type t_CodespacesListRepoSecretsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_CodespacesListRepositoriesForSecretForAuthenticatedUserParamSchema = + { + secret_name: string + } + +export type t_CodespacesListSecretsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_CodespacesListSelectedReposForOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_CodespacesListSelectedReposForOrgSecretQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_CodespacesPreFlightWithRepoForAuthenticatedUserParamSchema = { + owner: string + repo: string +} + +export type t_CodespacesPreFlightWithRepoForAuthenticatedUserQuerySchema = { + client_ip?: string | undefined + ref?: string | undefined +} + +export type t_CodespacesPublishForAuthenticatedUserParamSchema = { + codespace_name: string +} + +export type t_CodespacesPublishForAuthenticatedUserRequestBodySchema = { + name?: string | undefined + private?: boolean | undefined +} + +export type t_CodespacesRemoveRepositoryForSecretForAuthenticatedUserParamSchema = + { + repository_id: number + secret_name: string + } + +export type t_CodespacesRemoveSelectedRepoFromOrgSecretParamSchema = { + org: string + repository_id: number + secret_name: string +} + +export type t_CodespacesRepoMachinesForAuthenticatedUserParamSchema = { + owner: string + repo: string +} + +export type t_CodespacesRepoMachinesForAuthenticatedUserQuerySchema = { + client_ip?: string | undefined + location?: string | undefined + ref?: string | undefined +} + +export type t_CodespacesSetCodespacesAccessParamSchema = { + org: string +} + +export type t_CodespacesSetCodespacesAccessRequestBodySchema = { + selected_usernames?: string[] | undefined + visibility: + | "disabled" + | "selected_members" + | "all_members" + | "all_members_and_outside_collaborators" +} + +export type t_CodespacesSetCodespacesAccessUsersParamSchema = { + org: string +} + +export type t_CodespacesSetCodespacesAccessUsersRequestBodySchema = { + selected_usernames: string[] +} + +export type t_CodespacesSetRepositoriesForSecretForAuthenticatedUserParamSchema = + { + secret_name: string + } + +export type t_CodespacesSetRepositoriesForSecretForAuthenticatedUserRequestBodySchema = + { + selected_repository_ids: number[] + } + +export type t_CodespacesSetSelectedReposForOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_CodespacesSetSelectedReposForOrgSecretRequestBodySchema = { + selected_repository_ids: number[] +} + +export type t_CodespacesStartForAuthenticatedUserParamSchema = { + codespace_name: string +} + +export type t_CodespacesStopForAuthenticatedUserParamSchema = { + codespace_name: string +} + +export type t_CodespacesStopInOrganizationParamSchema = { + codespace_name: string + org: string + username: string +} + +export type t_CodespacesUpdateForAuthenticatedUserParamSchema = { + codespace_name: string +} + +export type t_CodespacesUpdateForAuthenticatedUserRequestBodySchema = { + display_name?: string | undefined + machine?: string | undefined + recent_folders?: string[] | undefined +} + +export type t_CopilotAddCopilotSeatsForTeamsParamSchema = { + org: string +} + +export type t_CopilotAddCopilotSeatsForTeamsRequestBodySchema = { + selected_teams: string[] +} + +export type t_CopilotAddCopilotSeatsForUsersParamSchema = { + org: string +} + +export type t_CopilotAddCopilotSeatsForUsersRequestBodySchema = { + selected_usernames: string[] +} + +export type t_CopilotCancelCopilotSeatAssignmentForTeamsParamSchema = { + org: string +} + +export type t_CopilotCancelCopilotSeatAssignmentForTeamsRequestBodySchema = { + selected_teams: string[] +} + +export type t_CopilotCancelCopilotSeatAssignmentForUsersParamSchema = { + org: string +} + +export type t_CopilotCancelCopilotSeatAssignmentForUsersRequestBodySchema = { + selected_usernames: string[] +} + +export type t_CopilotCopilotMetricsForOrganizationParamSchema = { + org: string +} + +export type t_CopilotCopilotMetricsForOrganizationQuerySchema = { + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + until?: string | undefined +} + +export type t_CopilotCopilotMetricsForTeamParamSchema = { + org: string + team_slug: string +} + +export type t_CopilotCopilotMetricsForTeamQuerySchema = { + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + until?: string | undefined +} + +export type t_CopilotGetCopilotOrganizationDetailsParamSchema = { + org: string +} + +export type t_CopilotGetCopilotSeatDetailsForUserParamSchema = { + org: string + username: string +} + +export type t_CopilotListCopilotSeatsParamSchema = { + org: string +} + +export type t_CopilotListCopilotSeatsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_DependabotAddSelectedRepoToOrgSecretParamSchema = { + org: string + repository_id: number + secret_name: string +} + +export type t_DependabotCreateOrUpdateOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_DependabotCreateOrUpdateOrgSecretRequestBodySchema = { + encrypted_value?: string | undefined + key_id?: string | undefined + selected_repository_ids?: string[] | undefined + visibility: "all" | "private" | "selected" +} + +export type t_DependabotCreateOrUpdateRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_DependabotCreateOrUpdateRepoSecretRequestBodySchema = { + encrypted_value?: string | undefined + key_id?: string | undefined +} + +export type t_DependabotDeleteOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_DependabotDeleteRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_DependabotGetAlertParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_DependabotGetOrgPublicKeyParamSchema = { + org: string +} + +export type t_DependabotGetOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_DependabotGetRepoPublicKeyParamSchema = { + owner: string + repo: string +} + +export type t_DependabotGetRepoSecretParamSchema = { + owner: string + repo: string + secret_name: string +} + +export type t_DependabotListAlertsForEnterpriseParamSchema = { + enterprise: string +} + +export type t_DependabotListAlertsForEnterpriseQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + ecosystem?: string | undefined + epss_percentage?: string | undefined + first?: number | undefined + last?: number | undefined + package?: string | undefined + per_page?: number | undefined + scope?: ("development" | "runtime") | undefined + severity?: string | undefined + sort?: ("created" | "updated" | "epss_percentage") | undefined + state?: string | undefined +} + +export type t_DependabotListAlertsForOrgParamSchema = { + org: string +} + +export type t_DependabotListAlertsForOrgQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + ecosystem?: string | undefined + epss_percentage?: string | undefined + first?: number | undefined + last?: number | undefined + package?: string | undefined + per_page?: number | undefined + scope?: ("development" | "runtime") | undefined + severity?: string | undefined + sort?: ("created" | "updated" | "epss_percentage") | undefined + state?: string | undefined +} + +export type t_DependabotListAlertsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_DependabotListAlertsForRepoQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + ecosystem?: string | undefined + epss_percentage?: string | undefined + first?: number | undefined + last?: number | undefined + manifest?: string | undefined + package?: string | undefined + page?: number | undefined + per_page?: number | undefined + scope?: ("development" | "runtime") | undefined + severity?: string | undefined + sort?: ("created" | "updated" | "epss_percentage") | undefined + state?: string | undefined +} + +export type t_DependabotListOrgSecretsParamSchema = { + org: string +} + +export type t_DependabotListOrgSecretsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_DependabotListRepoSecretsParamSchema = { + owner: string + repo: string +} + +export type t_DependabotListRepoSecretsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_DependabotListSelectedReposForOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_DependabotListSelectedReposForOrgSecretQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_DependabotRemoveSelectedRepoFromOrgSecretParamSchema = { + org: string + repository_id: number + secret_name: string +} + +export type t_DependabotSetSelectedReposForOrgSecretParamSchema = { + org: string + secret_name: string +} + +export type t_DependabotSetSelectedReposForOrgSecretRequestBodySchema = { + selected_repository_ids: number[] +} + +export type t_DependabotUpdateAlertParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_DependabotUpdateAlertRequestBodySchema = { + dismissed_comment?: string | undefined + dismissed_reason?: + | ( + | "fix_started" + | "inaccurate" + | "no_bandwidth" + | "not_used" + | "tolerable_risk" + ) + | undefined + state: "dismissed" | "open" +} + +export type t_DependencyGraphCreateRepositorySnapshotParamSchema = { + owner: string + repo: string +} + +export type t_DependencyGraphCreateRepositorySnapshotRequestBodySchema = { + detector: { + name: string + url: string + version: string + } + job: { + correlator: string + html_url?: string | undefined + id: string + } + manifests?: + | { + [key: string]: t_manifest | undefined + } + | undefined + metadata?: t_metadata | undefined + ref: string + scanned: string + sha: string + version: number +} + +export type t_DependencyGraphDiffRangeParamSchema = { + basehead: string + owner: string + repo: string +} + +export type t_DependencyGraphDiffRangeQuerySchema = { + name?: string | undefined +} + +export type t_DependencyGraphExportSbomParamSchema = { + owner: string + repo: string +} + +export type t_GistsCheckIsStarredParamSchema = { + gist_id: string +} + +export type t_GistsCreateRequestBodySchema = { + description?: string | undefined + files: { + [key: string]: + | { + content: string + } + | undefined + } + public?: (boolean | "true" | "false") | undefined +} + +export type t_GistsCreateCommentParamSchema = { + gist_id: string +} + +export type t_GistsCreateCommentRequestBodySchema = { + body: string +} + +export type t_GistsDeleteParamSchema = { + gist_id: string +} + +export type t_GistsDeleteCommentParamSchema = { + comment_id: number + gist_id: string +} + +export type t_GistsForkParamSchema = { + gist_id: string +} + +export type t_GistsGetParamSchema = { + gist_id: string +} + +export type t_GistsGetCommentParamSchema = { + comment_id: number + gist_id: string +} + +export type t_GistsGetRevisionParamSchema = { + gist_id: string + sha: string +} + +export type t_GistsListQuerySchema = { + page?: number | undefined + per_page?: number | undefined + since?: string | undefined +} + +export type t_GistsListCommentsParamSchema = { + gist_id: string +} + +export type t_GistsListCommentsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_GistsListCommitsParamSchema = { + gist_id: string +} + +export type t_GistsListCommitsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_GistsListForUserParamSchema = { + username: string +} + +export type t_GistsListForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined + since?: string | undefined +} + +export type t_GistsListForksParamSchema = { + gist_id: string +} + +export type t_GistsListForksQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_GistsListPublicQuerySchema = { + page?: number | undefined + per_page?: number | undefined + since?: string | undefined +} + +export type t_GistsListStarredQuerySchema = { + page?: number | undefined + per_page?: number | undefined + since?: string | undefined +} + +export type t_GistsStarParamSchema = { + gist_id: string +} + +export type t_GistsUnstarParamSchema = { + gist_id: string +} + +export type t_GistsUpdateParamSchema = { + gist_id: string +} + +export type t_GistsUpdateRequestBodySchema = { + description?: string | undefined + files?: + | { + [key: string]: + | ({ + content?: string | undefined + filename?: (string | null) | undefined + } | null) + | undefined + } + | undefined +} | null + +export type t_GistsUpdateCommentParamSchema = { + comment_id: number + gist_id: string +} + +export type t_GistsUpdateCommentRequestBodySchema = { + body: string +} + +export type t_GitCreateBlobParamSchema = { + owner: string + repo: string +} + +export type t_GitCreateBlobRequestBodySchema = { + content: string + encoding?: string | undefined +} + +export type t_GitCreateCommitParamSchema = { + owner: string + repo: string +} + +export type t_GitCreateCommitRequestBodySchema = { + author?: + | { + date?: string | undefined + email: string + name: string + } + | undefined + committer?: + | { + date?: string | undefined + email?: string | undefined + name?: string | undefined + } + | undefined + message: string + parents?: string[] | undefined + signature?: string | undefined + tree: string +} + +export type t_GitCreateRefParamSchema = { + owner: string + repo: string +} + +export type t_GitCreateRefRequestBodySchema = { + ref: string + sha: string +} + +export type t_GitCreateTagParamSchema = { + owner: string + repo: string +} + +export type t_GitCreateTagRequestBodySchema = { + message: string + object: string + tag: string + tagger?: + | { + date?: string | undefined + email: string + name: string + } + | undefined + type: "commit" | "tree" | "blob" +} + +export type t_GitCreateTreeParamSchema = { + owner: string + repo: string +} + +export type t_GitCreateTreeRequestBodySchema = { + base_tree?: string | undefined + tree: { + content?: string | undefined + mode?: ("100644" | "100755" | "040000" | "160000" | "120000") | undefined + path?: string | undefined + sha?: (string | null) | undefined + type?: ("blob" | "tree" | "commit") | undefined + }[] +} + +export type t_GitDeleteRefParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_GitGetBlobParamSchema = { + file_sha: string + owner: string + repo: string +} + +export type t_GitGetCommitParamSchema = { + commit_sha: string + owner: string + repo: string +} + +export type t_GitGetRefParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_GitGetTagParamSchema = { + owner: string + repo: string + tag_sha: string +} + +export type t_GitGetTreeParamSchema = { + owner: string + repo: string + tree_sha: string +} + +export type t_GitGetTreeQuerySchema = { + recursive?: string | undefined +} + +export type t_GitListMatchingRefsParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_GitUpdateRefParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_GitUpdateRefRequestBodySchema = { + force?: boolean | undefined + sha: string +} + +export type t_GitignoreGetTemplateParamSchema = { + name: string +} + +export type t_HostedComputeCreateNetworkConfigurationForOrgParamSchema = { + org: string +} + +export type t_HostedComputeCreateNetworkConfigurationForOrgRequestBodySchema = { + compute_service?: ("none" | "actions") | undefined + name: string + network_settings_ids: string[] +} + +export type t_HostedComputeDeleteNetworkConfigurationFromOrgParamSchema = { + network_configuration_id: string + org: string +} + +export type t_HostedComputeGetNetworkConfigurationForOrgParamSchema = { + network_configuration_id: string + org: string +} + +export type t_HostedComputeGetNetworkSettingsForOrgParamSchema = { + network_settings_id: string + org: string +} + +export type t_HostedComputeListNetworkConfigurationsForOrgParamSchema = { + org: string +} + +export type t_HostedComputeListNetworkConfigurationsForOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_HostedComputeUpdateNetworkConfigurationForOrgParamSchema = { + network_configuration_id: string + org: string +} + +export type t_HostedComputeUpdateNetworkConfigurationForOrgRequestBodySchema = { + compute_service?: ("none" | "actions") | undefined + name?: string | undefined + network_settings_ids?: string[] | undefined +} + +export type t_InteractionsGetRestrictionsForOrgParamSchema = { + org: string +} + +export type t_InteractionsGetRestrictionsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_InteractionsRemoveRestrictionsForOrgParamSchema = { + org: string +} + +export type t_InteractionsRemoveRestrictionsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_InteractionsSetRestrictionsForAuthenticatedUserRequestBodySchema = + { + expiry?: t_interaction_expiry | undefined + limit: t_interaction_group + } + +export type t_InteractionsSetRestrictionsForOrgParamSchema = { + org: string +} + +export type t_InteractionsSetRestrictionsForOrgRequestBodySchema = { + expiry?: t_interaction_expiry | undefined + limit: t_interaction_group +} + +export type t_InteractionsSetRestrictionsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_InteractionsSetRestrictionsForRepoRequestBodySchema = { + expiry?: t_interaction_expiry | undefined + limit: t_interaction_group +} + +export type t_IssuesAddAssigneesParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesAddAssigneesRequestBodySchema = { + assignees?: string[] | undefined +} + +export type t_IssuesAddLabelsParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesAddLabelsRequestBodySchema = + | { + labels?: string[] | undefined + } + | string[] + | { + labels?: + | { + name: string + }[] + | undefined + } + | { + name: string + }[] + | string + +export type t_IssuesAddSubIssueParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesAddSubIssueRequestBodySchema = { + replace_parent?: boolean | undefined + sub_issue_id: number +} + +export type t_IssuesCheckUserCanBeAssignedParamSchema = { + assignee: string + owner: string + repo: string +} + +export type t_IssuesCheckUserCanBeAssignedToIssueParamSchema = { + assignee: string + issue_number: number + owner: string + repo: string +} + +export type t_IssuesCreateParamSchema = { + owner: string + repo: string +} + +export type t_IssuesCreateRequestBodySchema = { + assignee?: (string | null) | undefined + assignees?: string[] | undefined + body?: string | undefined + labels?: + | ( + | string + | { + color?: (string | null) | undefined + description?: (string | null) | undefined + id?: number | undefined + name?: string | undefined + } + )[] + | undefined + milestone?: (string | number | null) | undefined + title: string | number + type?: (string | null) | undefined +} + +export type t_IssuesCreateCommentParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesCreateCommentRequestBodySchema = { + body: string +} + +export type t_IssuesCreateLabelParamSchema = { + owner: string + repo: string +} + +export type t_IssuesCreateLabelRequestBodySchema = { + color?: string | undefined + description?: string | undefined + name: string +} + +export type t_IssuesCreateMilestoneParamSchema = { + owner: string + repo: string +} + +export type t_IssuesCreateMilestoneRequestBodySchema = { + description?: string | undefined + due_on?: string | undefined + state?: ("open" | "closed") | undefined + title: string +} + +export type t_IssuesDeleteCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_IssuesDeleteLabelParamSchema = { + name: string + owner: string + repo: string +} + +export type t_IssuesDeleteMilestoneParamSchema = { + milestone_number: number + owner: string + repo: string +} + +export type t_IssuesGetParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesGetCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_IssuesGetEventParamSchema = { + event_id: number + owner: string + repo: string +} + +export type t_IssuesGetLabelParamSchema = { + name: string + owner: string + repo: string +} + +export type t_IssuesGetMilestoneParamSchema = { + milestone_number: number + owner: string + repo: string +} + +export type t_IssuesListQuerySchema = { + collab?: boolean | undefined + direction?: ("asc" | "desc") | undefined + filter?: + | ("assigned" | "created" | "mentioned" | "subscribed" | "repos" | "all") + | undefined + labels?: string | undefined + orgs?: boolean | undefined + owned?: boolean | undefined + page?: number | undefined + per_page?: number | undefined + pulls?: boolean | undefined + since?: string | undefined + sort?: ("created" | "updated" | "comments") | undefined + state?: ("open" | "closed" | "all") | undefined +} + +export type t_IssuesListAssigneesParamSchema = { + owner: string + repo: string +} + +export type t_IssuesListAssigneesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_IssuesListCommentsParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesListCommentsQuerySchema = { + page?: number | undefined + per_page?: number | undefined + since?: string | undefined +} + +export type t_IssuesListCommentsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_IssuesListCommentsForRepoQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + sort?: ("created" | "updated") | undefined +} + +export type t_IssuesListEventsParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesListEventsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_IssuesListEventsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_IssuesListEventsForRepoQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_IssuesListEventsForTimelineParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesListEventsForTimelineQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_IssuesListForAuthenticatedUserQuerySchema = { + direction?: ("asc" | "desc") | undefined + filter?: + | ("assigned" | "created" | "mentioned" | "subscribed" | "repos" | "all") + | undefined + labels?: string | undefined + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + sort?: ("created" | "updated" | "comments") | undefined + state?: ("open" | "closed" | "all") | undefined +} + +export type t_IssuesListForOrgParamSchema = { + org: string +} + +export type t_IssuesListForOrgQuerySchema = { + direction?: ("asc" | "desc") | undefined + filter?: + | ("assigned" | "created" | "mentioned" | "subscribed" | "repos" | "all") + | undefined + labels?: string | undefined + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + sort?: ("created" | "updated" | "comments") | undefined + state?: ("open" | "closed" | "all") | undefined + type?: string | undefined +} + +export type t_IssuesListForRepoParamSchema = { + owner: string + repo: string +} + +export type t_IssuesListForRepoQuerySchema = { + assignee?: string | undefined + creator?: string | undefined + direction?: ("asc" | "desc") | undefined + labels?: string | undefined + mentioned?: string | undefined + milestone?: string | undefined + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + sort?: ("created" | "updated" | "comments") | undefined + state?: ("open" | "closed" | "all") | undefined + type?: string | undefined +} + +export type t_IssuesListLabelsForMilestoneParamSchema = { + milestone_number: number + owner: string + repo: string +} + +export type t_IssuesListLabelsForMilestoneQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_IssuesListLabelsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_IssuesListLabelsForRepoQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_IssuesListLabelsOnIssueParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesListLabelsOnIssueQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_IssuesListMilestonesParamSchema = { + owner: string + repo: string +} + +export type t_IssuesListMilestonesQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("due_on" | "completeness") | undefined + state?: ("open" | "closed" | "all") | undefined +} + +export type t_IssuesListSubIssuesParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesListSubIssuesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_IssuesLockParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesLockRequestBodySchema = { + lock_reason?: ("off-topic" | "too heated" | "resolved" | "spam") | undefined +} | null + +export type t_IssuesRemoveAllLabelsParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesRemoveAssigneesParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesRemoveAssigneesRequestBodySchema = { + assignees?: string[] | undefined +} + +export type t_IssuesRemoveLabelParamSchema = { + issue_number: number + name: string + owner: string + repo: string +} + +export type t_IssuesRemoveSubIssueParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesRemoveSubIssueRequestBodySchema = { + sub_issue_id: number +} + +export type t_IssuesReprioritizeSubIssueParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesReprioritizeSubIssueRequestBodySchema = { + after_id?: number | undefined + before_id?: number | undefined + sub_issue_id: number +} + +export type t_IssuesSetLabelsParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesSetLabelsRequestBodySchema = + | { + labels?: string[] | undefined + } + | string[] + | { + labels?: + | { + name: string + }[] + | undefined + } + | { + name: string + }[] + | string + +export type t_IssuesUnlockParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesUpdateParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_IssuesUpdateRequestBodySchema = { + assignee?: (string | null) | undefined + assignees?: string[] | undefined + body?: (string | null) | undefined + labels?: + | ( + | string + | { + color?: (string | null) | undefined + description?: (string | null) | undefined + id?: number | undefined + name?: string | undefined + } + )[] + | undefined + milestone?: (string | number | null) | undefined + state?: ("open" | "closed") | undefined + state_reason?: ("completed" | "not_planned" | "reopened" | null) | undefined + title?: (string | number | null) | undefined + type?: (string | null) | undefined +} + +export type t_IssuesUpdateCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_IssuesUpdateCommentRequestBodySchema = { + body: string +} + +export type t_IssuesUpdateLabelParamSchema = { + name: string + owner: string + repo: string +} + +export type t_IssuesUpdateLabelRequestBodySchema = { + color?: string | undefined + description?: string | undefined + new_name?: string | undefined +} + +export type t_IssuesUpdateMilestoneParamSchema = { + milestone_number: number + owner: string + repo: string +} + +export type t_IssuesUpdateMilestoneRequestBodySchema = { + description?: string | undefined + due_on?: string | undefined + state?: ("open" | "closed") | undefined + title?: string | undefined +} + +export type t_LicensesGetParamSchema = { + license: string +} + +export type t_LicensesGetAllCommonlyUsedQuerySchema = { + featured?: boolean | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_LicensesGetForRepoParamSchema = { + owner: string + repo: string +} + +export type t_LicensesGetForRepoQuerySchema = { + ref?: t_code_scanning_ref | undefined +} + +export type t_MarkdownRenderRequestBodySchema = { + context?: string | undefined + mode?: ("markdown" | "gfm") | undefined + text: string +} + +export type t_MarkdownRenderRawRequestBodySchema = string + +export type t_MetaGetOctocatQuerySchema = { + s?: string | undefined +} + +export type t_MigrationsCancelImportParamSchema = { + owner: string + repo: string +} + +export type t_MigrationsDeleteArchiveForAuthenticatedUserParamSchema = { + migration_id: number +} + +export type t_MigrationsDeleteArchiveForOrgParamSchema = { + migration_id: number + org: string +} + +export type t_MigrationsDownloadArchiveForOrgParamSchema = { + migration_id: number + org: string +} + +export type t_MigrationsGetArchiveForAuthenticatedUserParamSchema = { + migration_id: number +} + +export type t_MigrationsGetCommitAuthorsParamSchema = { + owner: string + repo: string +} + +export type t_MigrationsGetCommitAuthorsQuerySchema = { + since?: number | undefined +} + +export type t_MigrationsGetImportStatusParamSchema = { + owner: string + repo: string +} + +export type t_MigrationsGetLargeFilesParamSchema = { + owner: string + repo: string +} + +export type t_MigrationsGetStatusForAuthenticatedUserParamSchema = { + migration_id: number +} + +export type t_MigrationsGetStatusForAuthenticatedUserQuerySchema = { + exclude?: string[] | undefined +} + +export type t_MigrationsGetStatusForOrgParamSchema = { + migration_id: number + org: string +} + +export type t_MigrationsGetStatusForOrgQuerySchema = { + exclude?: "repositories"[] | undefined +} + +export type t_MigrationsListForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_MigrationsListForOrgParamSchema = { + org: string +} + +export type t_MigrationsListForOrgQuerySchema = { + exclude?: "repositories"[] | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_MigrationsListReposForAuthenticatedUserParamSchema = { + migration_id: number +} + +export type t_MigrationsListReposForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_MigrationsListReposForOrgParamSchema = { + migration_id: number + org: string +} + +export type t_MigrationsListReposForOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_MigrationsMapCommitAuthorParamSchema = { + author_id: number + owner: string + repo: string +} + +export type t_MigrationsMapCommitAuthorRequestBodySchema = { + email?: string | undefined + name?: string | undefined +} + +export type t_MigrationsSetLfsPreferenceParamSchema = { + owner: string + repo: string +} + +export type t_MigrationsSetLfsPreferenceRequestBodySchema = { + use_lfs: "opt_in" | "opt_out" +} + +export type t_MigrationsStartForAuthenticatedUserRequestBodySchema = { + exclude?: "repositories"[] | undefined + exclude_attachments?: boolean | undefined + exclude_git_data?: boolean | undefined + exclude_metadata?: boolean | undefined + exclude_owner_projects?: boolean | undefined + exclude_releases?: boolean | undefined + lock_repositories?: boolean | undefined + org_metadata_only?: boolean | undefined + repositories: string[] +} + +export type t_MigrationsStartForOrgParamSchema = { + org: string +} + +export type t_MigrationsStartForOrgRequestBodySchema = { + exclude?: "repositories"[] | undefined + exclude_attachments?: boolean | undefined + exclude_git_data?: boolean | undefined + exclude_metadata?: boolean | undefined + exclude_owner_projects?: boolean | undefined + exclude_releases?: boolean | undefined + lock_repositories?: boolean | undefined + org_metadata_only?: boolean | undefined + repositories: string[] +} + +export type t_MigrationsStartImportParamSchema = { + owner: string + repo: string +} + +export type t_MigrationsStartImportRequestBodySchema = { + tfvc_project?: string | undefined + vcs?: ("subversion" | "git" | "mercurial" | "tfvc") | undefined + vcs_password?: string | undefined + vcs_url: string + vcs_username?: string | undefined +} + +export type t_MigrationsUnlockRepoForAuthenticatedUserParamSchema = { + migration_id: number + repo_name: string +} + +export type t_MigrationsUnlockRepoForOrgParamSchema = { + migration_id: number + org: string + repo_name: string +} + +export type t_MigrationsUpdateImportParamSchema = { + owner: string + repo: string +} + +export type t_MigrationsUpdateImportRequestBodySchema = { + tfvc_project?: string | undefined + vcs?: ("subversion" | "tfvc" | "git" | "mercurial") | undefined + vcs_password?: string | undefined + vcs_username?: string | undefined +} | null + +export type t_OidcGetOidcCustomSubTemplateForOrgParamSchema = { + org: string +} + +export type t_OidcUpdateOidcCustomSubTemplateForOrgParamSchema = { + org: string +} + +export type t_OidcUpdateOidcCustomSubTemplateForOrgRequestBodySchema = { + include_claim_keys: string[] +} + +export type t_OrgsAddSecurityManagerTeamParamSchema = { + org: string + team_slug: string +} + +export type t_OrgsAssignTeamToOrgRoleParamSchema = { + org: string + role_id: number + team_slug: string +} + +export type t_OrgsAssignUserToOrgRoleParamSchema = { + org: string + role_id: number + username: string +} + +export type t_OrgsBlockUserParamSchema = { + org: string + username: string +} + +export type t_OrgsCancelInvitationParamSchema = { + invitation_id: number + org: string +} + +export type t_OrgsCheckBlockedUserParamSchema = { + org: string + username: string +} + +export type t_OrgsCheckMembershipForUserParamSchema = { + org: string + username: string +} + +export type t_OrgsCheckPublicMembershipForUserParamSchema = { + org: string + username: string +} + +export type t_OrgsConvertMemberToOutsideCollaboratorParamSchema = { + org: string + username: string +} + +export type t_OrgsConvertMemberToOutsideCollaboratorRequestBodySchema = { + async?: boolean | undefined +} + +export type t_OrgsCreateInvitationParamSchema = { + org: string +} + +export type t_OrgsCreateInvitationRequestBodySchema = { + email?: string | undefined + invitee_id?: number | undefined + role?: + | ("admin" | "direct_member" | "billing_manager" | "reinstate") + | undefined + team_ids?: number[] | undefined +} + +export type t_OrgsCreateIssueTypeParamSchema = { + org: string +} + +export type t_OrgsCreateIssueTypeRequestBodySchema = { + color?: + | ( + | "gray" + | "blue" + | "green" + | "yellow" + | "orange" + | "red" + | "pink" + | "purple" + | null + ) + | undefined + description?: (string | null) | undefined + is_enabled: boolean + name: string +} + +export type t_OrgsCreateOrUpdateCustomPropertiesParamSchema = { + org: string +} + +export type t_OrgsCreateOrUpdateCustomPropertiesRequestBodySchema = { + properties: t_custom_property[] +} + +export type t_OrgsCreateOrUpdateCustomPropertiesValuesForReposParamSchema = { + org: string +} + +export type t_OrgsCreateOrUpdateCustomPropertiesValuesForReposRequestBodySchema = + { + properties: t_custom_property_value[] + repository_names: string[] + } + +export type t_OrgsCreateOrUpdateCustomPropertyParamSchema = { + custom_property_name: string + org: string +} + +export type t_OrgsCreateOrUpdateCustomPropertyRequestBodySchema = { + allowed_values?: (string[] | null) | undefined + default_value?: (string | string[] | null) | undefined + description?: (string | null) | undefined + required?: boolean | undefined + value_type: "string" | "single_select" | "multi_select" | "true_false" + values_editable_by?: ("org_actors" | "org_and_repo_actors" | null) | undefined +} + +export type t_OrgsCreateWebhookParamSchema = { + org: string +} + +export type t_OrgsCreateWebhookRequestBodySchema = { + active?: boolean | undefined + config: { + content_type?: t_webhook_config_content_type | undefined + insecure_ssl?: t_webhook_config_insecure_ssl | undefined + password?: string | undefined + secret?: t_webhook_config_secret | undefined + url: t_webhook_config_url + username?: string | undefined + } + events?: string[] | undefined + name: string +} + +export type t_OrgsDeleteParamSchema = { + org: string +} + +export type t_OrgsDeleteIssueTypeParamSchema = { + issue_type_id: number + org: string +} + +export type t_OrgsDeleteWebhookParamSchema = { + hook_id: number + org: string +} + +export type t_OrgsEnableOrDisableSecurityProductOnAllOrgReposParamSchema = { + enablement: "enable_all" | "disable_all" + org: string + security_product: + | "dependency_graph" + | "dependabot_alerts" + | "dependabot_security_updates" + | "advanced_security" + | "code_scanning_default_setup" + | "secret_scanning" + | "secret_scanning_push_protection" +} + +export type t_OrgsEnableOrDisableSecurityProductOnAllOrgReposRequestBodySchema = + { + query_suite?: ("default" | "extended") | undefined + } + +export type t_OrgsGetParamSchema = { + org: string +} + +export type t_OrgsGetAllCustomPropertiesParamSchema = { + org: string +} + +export type t_OrgsGetCustomPropertyParamSchema = { + custom_property_name: string + org: string +} + +export type t_OrgsGetMembershipForAuthenticatedUserParamSchema = { + org: string +} + +export type t_OrgsGetMembershipForUserParamSchema = { + org: string + username: string +} + +export type t_OrgsGetOrgRoleParamSchema = { + org: string + role_id: number +} + +export type t_OrgsGetOrgRulesetHistoryParamSchema = { + org: string + ruleset_id: number +} + +export type t_OrgsGetOrgRulesetHistoryQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsGetOrgRulesetVersionParamSchema = { + org: string + ruleset_id: number + version_id: number +} + +export type t_OrgsGetWebhookParamSchema = { + hook_id: number + org: string +} + +export type t_OrgsGetWebhookConfigForOrgParamSchema = { + hook_id: number + org: string +} + +export type t_OrgsGetWebhookDeliveryParamSchema = { + delivery_id: number + hook_id: number + org: string +} + +export type t_OrgsListQuerySchema = { + per_page?: number | undefined + since?: number | undefined +} + +export type t_OrgsListAppInstallationsParamSchema = { + org: string +} + +export type t_OrgsListAppInstallationsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListAttestationsParamSchema = { + org: string + subject_digest: string +} + +export type t_OrgsListAttestationsQuerySchema = { + after?: string | undefined + before?: string | undefined + per_page?: number | undefined + predicate_type?: string | undefined +} + +export type t_OrgsListBlockedUsersParamSchema = { + org: string +} + +export type t_OrgsListBlockedUsersQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListCustomPropertiesValuesForReposParamSchema = { + org: string +} + +export type t_OrgsListCustomPropertiesValuesForReposQuerySchema = { + page?: number | undefined + per_page?: number | undefined + repository_query?: string | undefined +} + +export type t_OrgsListFailedInvitationsParamSchema = { + org: string +} + +export type t_OrgsListFailedInvitationsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListForUserParamSchema = { + username: string +} + +export type t_OrgsListForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListInvitationTeamsParamSchema = { + invitation_id: number + org: string +} + +export type t_OrgsListInvitationTeamsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListIssueTypesParamSchema = { + org: string +} + +export type t_OrgsListMembersParamSchema = { + org: string +} + +export type t_OrgsListMembersQuerySchema = { + filter?: ("2fa_disabled" | "all") | undefined + page?: number | undefined + per_page?: number | undefined + role?: ("all" | "admin" | "member") | undefined +} + +export type t_OrgsListMembershipsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined + state?: ("active" | "pending") | undefined +} + +export type t_OrgsListOrgRoleTeamsParamSchema = { + org: string + role_id: number +} + +export type t_OrgsListOrgRoleTeamsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListOrgRoleUsersParamSchema = { + org: string + role_id: number +} + +export type t_OrgsListOrgRoleUsersQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListOrgRolesParamSchema = { + org: string +} + +export type t_OrgsListOutsideCollaboratorsParamSchema = { + org: string +} + +export type t_OrgsListOutsideCollaboratorsQuerySchema = { + filter?: ("2fa_disabled" | "all") | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListPatGrantRepositoriesParamSchema = { + org: string + pat_id: number +} + +export type t_OrgsListPatGrantRepositoriesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListPatGrantRequestRepositoriesParamSchema = { + org: string + pat_request_id: number +} + +export type t_OrgsListPatGrantRequestRepositoriesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListPatGrantRequestsParamSchema = { + org: string +} + +export type t_OrgsListPatGrantRequestsQuerySchema = { + direction?: ("asc" | "desc") | undefined + last_used_after?: string | undefined + last_used_before?: string | undefined + owner?: string[] | undefined + page?: number | undefined + per_page?: number | undefined + permission?: string | undefined + repository?: string | undefined + sort?: "created_at" | undefined + token_id?: string[] | undefined +} + +export type t_OrgsListPatGrantsParamSchema = { + org: string +} + +export type t_OrgsListPatGrantsQuerySchema = { + direction?: ("asc" | "desc") | undefined + last_used_after?: string | undefined + last_used_before?: string | undefined + owner?: string[] | undefined + page?: number | undefined + per_page?: number | undefined + permission?: string | undefined + repository?: string | undefined + sort?: "created_at" | undefined + token_id?: string[] | undefined +} + +export type t_OrgsListPendingInvitationsParamSchema = { + org: string +} + +export type t_OrgsListPendingInvitationsQuerySchema = { + invitation_source?: ("all" | "member" | "scim") | undefined + page?: number | undefined + per_page?: number | undefined + role?: + | ("all" | "admin" | "direct_member" | "billing_manager" | "hiring_manager") + | undefined +} + +export type t_OrgsListPublicMembersParamSchema = { + org: string +} + +export type t_OrgsListPublicMembersQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsListSecurityManagerTeamsParamSchema = { + org: string +} + +export type t_OrgsListWebhookDeliveriesParamSchema = { + hook_id: number + org: string +} + +export type t_OrgsListWebhookDeliveriesQuerySchema = { + cursor?: string | undefined + per_page?: number | undefined +} + +export type t_OrgsListWebhooksParamSchema = { + org: string +} + +export type t_OrgsListWebhooksQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_OrgsPingWebhookParamSchema = { + hook_id: number + org: string +} + +export type t_OrgsRedeliverWebhookDeliveryParamSchema = { + delivery_id: number + hook_id: number + org: string +} + +export type t_OrgsRemoveCustomPropertyParamSchema = { + custom_property_name: string + org: string +} + +export type t_OrgsRemoveMemberParamSchema = { + org: string + username: string +} + +export type t_OrgsRemoveMembershipForUserParamSchema = { + org: string + username: string +} + +export type t_OrgsRemoveOutsideCollaboratorParamSchema = { + org: string + username: string +} + +export type t_OrgsRemovePublicMembershipForAuthenticatedUserParamSchema = { + org: string + username: string +} + +export type t_OrgsRemoveSecurityManagerTeamParamSchema = { + org: string + team_slug: string +} + +export type t_OrgsReviewPatGrantRequestParamSchema = { + org: string + pat_request_id: number +} + +export type t_OrgsReviewPatGrantRequestRequestBodySchema = { + action: "approve" | "deny" + reason?: (string | null) | undefined +} + +export type t_OrgsReviewPatGrantRequestsInBulkParamSchema = { + org: string +} + +export type t_OrgsReviewPatGrantRequestsInBulkRequestBodySchema = { + action: "approve" | "deny" + pat_request_ids?: number[] | undefined + reason?: (string | null) | undefined +} + +export type t_OrgsRevokeAllOrgRolesTeamParamSchema = { + org: string + team_slug: string +} + +export type t_OrgsRevokeAllOrgRolesUserParamSchema = { + org: string + username: string +} + +export type t_OrgsRevokeOrgRoleTeamParamSchema = { + org: string + role_id: number + team_slug: string +} + +export type t_OrgsRevokeOrgRoleUserParamSchema = { + org: string + role_id: number + username: string +} + +export type t_OrgsSetMembershipForUserParamSchema = { + org: string + username: string +} + +export type t_OrgsSetMembershipForUserRequestBodySchema = { + role?: ("admin" | "member") | undefined +} + +export type t_OrgsSetPublicMembershipForAuthenticatedUserParamSchema = { + org: string + username: string +} + +export type t_OrgsUnblockUserParamSchema = { + org: string + username: string +} + +export type t_OrgsUpdateParamSchema = { + org: string +} + +export type t_OrgsUpdateRequestBodySchema = { + advanced_security_enabled_for_new_repositories?: boolean | undefined + billing_email?: string | undefined + blog?: string | undefined + company?: string | undefined + default_repository_permission?: + | ("read" | "write" | "admin" | "none") + | undefined + dependabot_alerts_enabled_for_new_repositories?: boolean | undefined + dependabot_security_updates_enabled_for_new_repositories?: boolean | undefined + dependency_graph_enabled_for_new_repositories?: boolean | undefined + deploy_keys_enabled_for_repositories?: boolean | undefined + description?: string | undefined + email?: string | undefined + has_organization_projects?: boolean | undefined + has_repository_projects?: boolean | undefined + location?: string | undefined + members_allowed_repository_creation_type?: + | ("all" | "private" | "none") + | undefined + members_can_create_internal_repositories?: boolean | undefined + members_can_create_pages?: boolean | undefined + members_can_create_private_pages?: boolean | undefined + members_can_create_private_repositories?: boolean | undefined + members_can_create_public_pages?: boolean | undefined + members_can_create_public_repositories?: boolean | undefined + members_can_create_repositories?: boolean | undefined + members_can_fork_private_repositories?: boolean | undefined + name?: string | undefined + secret_scanning_enabled_for_new_repositories?: boolean | undefined + secret_scanning_push_protection_custom_link?: string | undefined + secret_scanning_push_protection_custom_link_enabled?: boolean | undefined + secret_scanning_push_protection_enabled_for_new_repositories?: + | boolean + | undefined + twitter_username?: string | undefined + web_commit_signoff_required?: boolean | undefined +} + +export type t_OrgsUpdateIssueTypeParamSchema = { + issue_type_id: number + org: string +} + +export type t_OrgsUpdateIssueTypeRequestBodySchema = { + color?: + | ( + | "gray" + | "blue" + | "green" + | "yellow" + | "orange" + | "red" + | "pink" + | "purple" + | null + ) + | undefined + description?: (string | null) | undefined + is_enabled: boolean + name: string +} + +export type t_OrgsUpdateMembershipForAuthenticatedUserParamSchema = { + org: string +} + +export type t_OrgsUpdateMembershipForAuthenticatedUserRequestBodySchema = { + state: "active" +} + +export type t_OrgsUpdatePatAccessParamSchema = { + org: string + pat_id: number +} + +export type t_OrgsUpdatePatAccessRequestBodySchema = { + action: "revoke" +} + +export type t_OrgsUpdatePatAccessesParamSchema = { + org: string +} + +export type t_OrgsUpdatePatAccessesRequestBodySchema = { + action: "revoke" + pat_ids: number[] +} + +export type t_OrgsUpdateWebhookParamSchema = { + hook_id: number + org: string +} + +export type t_OrgsUpdateWebhookRequestBodySchema = { + active?: boolean | undefined + config?: + | { + content_type?: t_webhook_config_content_type | undefined + insecure_ssl?: t_webhook_config_insecure_ssl | undefined + secret?: t_webhook_config_secret | undefined + url: t_webhook_config_url + } + | undefined + events?: string[] | undefined + name?: string | undefined +} + +export type t_OrgsUpdateWebhookConfigForOrgParamSchema = { + hook_id: number + org: string +} + +export type t_OrgsUpdateWebhookConfigForOrgRequestBodySchema = { + content_type?: t_webhook_config_content_type | undefined + insecure_ssl?: t_webhook_config_insecure_ssl | undefined + secret?: t_webhook_config_secret | undefined + url?: t_webhook_config_url | undefined +} + +export type t_PackagesDeletePackageForAuthenticatedUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" +} + +export type t_PackagesDeletePackageForOrgParamSchema = { + org: string + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" +} + +export type t_PackagesDeletePackageForUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + username: string +} + +export type t_PackagesDeletePackageVersionForAuthenticatedUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number +} + +export type t_PackagesDeletePackageVersionForOrgParamSchema = { + org: string + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number +} + +export type t_PackagesDeletePackageVersionForUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number + username: string +} + +export type t_PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserParamSchema = + { + package_name: string + package_type: + | "npm" + | "maven" + | "rubygems" + | "docker" + | "nuget" + | "container" + } + +export type t_PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserQuerySchema = + { + page?: number | undefined + per_page?: number | undefined + state?: ("active" | "deleted") | undefined + } + +export type t_PackagesGetAllPackageVersionsForPackageOwnedByOrgParamSchema = { + org: string + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" +} + +export type t_PackagesGetAllPackageVersionsForPackageOwnedByOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined + state?: ("active" | "deleted") | undefined +} + +export type t_PackagesGetAllPackageVersionsForPackageOwnedByUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + username: string +} + +export type t_PackagesGetPackageForAuthenticatedUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" +} + +export type t_PackagesGetPackageForOrganizationParamSchema = { + org: string + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" +} + +export type t_PackagesGetPackageForUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + username: string +} + +export type t_PackagesGetPackageVersionForAuthenticatedUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number +} + +export type t_PackagesGetPackageVersionForOrganizationParamSchema = { + org: string + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number +} + +export type t_PackagesGetPackageVersionForUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number + username: string +} + +export type t_PackagesListDockerMigrationConflictingPackagesForOrganizationParamSchema = + { + org: string + } + +export type t_PackagesListDockerMigrationConflictingPackagesForUserParamSchema = + { + username: string + } + +export type t_PackagesListPackagesForAuthenticatedUserQuerySchema = { + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + page?: number | undefined + per_page?: number | undefined + visibility?: ("public" | "private" | "internal") | undefined +} + +export type t_PackagesListPackagesForOrganizationParamSchema = { + org: string +} + +export type t_PackagesListPackagesForOrganizationQuerySchema = { + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + page?: number | undefined + per_page?: number | undefined + visibility?: ("public" | "private" | "internal") | undefined +} + +export type t_PackagesListPackagesForUserParamSchema = { + username: string +} + +export type t_PackagesListPackagesForUserQuerySchema = { + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + page?: number | undefined + per_page?: number | undefined + visibility?: ("public" | "private" | "internal") | undefined +} + +export type t_PackagesRestorePackageForAuthenticatedUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" +} + +export type t_PackagesRestorePackageForAuthenticatedUserQuerySchema = { + token?: string | undefined +} + +export type t_PackagesRestorePackageForOrgParamSchema = { + org: string + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" +} + +export type t_PackagesRestorePackageForOrgQuerySchema = { + token?: string | undefined +} + +export type t_PackagesRestorePackageForUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + username: string +} + +export type t_PackagesRestorePackageForUserQuerySchema = { + token?: string | undefined +} + +export type t_PackagesRestorePackageVersionForAuthenticatedUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number +} + +export type t_PackagesRestorePackageVersionForOrgParamSchema = { + org: string + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number +} + +export type t_PackagesRestorePackageVersionForUserParamSchema = { + package_name: string + package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container" + package_version_id: number + username: string +} + +export type t_PrivateRegistriesCreateOrgPrivateRegistryParamSchema = { + org: string +} + +export type t_PrivateRegistriesCreateOrgPrivateRegistryRequestBodySchema = { + encrypted_value: string + key_id: string + registry_type: "maven_repository" + selected_repository_ids?: number[] | undefined + username?: (string | null) | undefined + visibility: "all" | "private" | "selected" +} + +export type t_PrivateRegistriesDeleteOrgPrivateRegistryParamSchema = { + org: string + secret_name: string +} + +export type t_PrivateRegistriesGetOrgPrivateRegistryParamSchema = { + org: string + secret_name: string +} + +export type t_PrivateRegistriesGetOrgPublicKeyParamSchema = { + org: string +} + +export type t_PrivateRegistriesListOrgPrivateRegistriesParamSchema = { + org: string +} + +export type t_PrivateRegistriesListOrgPrivateRegistriesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_PrivateRegistriesUpdateOrgPrivateRegistryParamSchema = { + org: string + secret_name: string +} + +export type t_PrivateRegistriesUpdateOrgPrivateRegistryRequestBodySchema = { + encrypted_value?: string | undefined + key_id?: string | undefined + registry_type?: "maven_repository" | undefined + selected_repository_ids?: number[] | undefined + username?: (string | null) | undefined + visibility?: ("all" | "private" | "selected") | undefined +} + +export type t_ProjectsAddCollaboratorParamSchema = { + project_id: number + username: string +} + +export type t_ProjectsAddCollaboratorRequestBodySchema = { + permission?: ("read" | "write" | "admin") | undefined +} | null + +export type t_ProjectsCreateCardParamSchema = { + column_id: number +} + +export type t_ProjectsCreateCardRequestBodySchema = + | { + note: string | null + } + | { + content_id: number + content_type: string + } + +export type t_ProjectsCreateColumnParamSchema = { + project_id: number +} + +export type t_ProjectsCreateColumnRequestBodySchema = { + name: string +} + +export type t_ProjectsCreateForAuthenticatedUserRequestBodySchema = { + body?: (string | null) | undefined + name: string +} + +export type t_ProjectsCreateForOrgParamSchema = { + org: string +} + +export type t_ProjectsCreateForOrgRequestBodySchema = { + body?: string | undefined + name: string +} + +export type t_ProjectsCreateForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ProjectsCreateForRepoRequestBodySchema = { + body?: string | undefined + name: string +} + +export type t_ProjectsDeleteParamSchema = { + project_id: number +} + +export type t_ProjectsDeleteCardParamSchema = { + card_id: number +} + +export type t_ProjectsDeleteColumnParamSchema = { + column_id: number +} + +export type t_ProjectsGetParamSchema = { + project_id: number +} + +export type t_ProjectsGetCardParamSchema = { + card_id: number +} + +export type t_ProjectsGetColumnParamSchema = { + column_id: number +} + +export type t_ProjectsGetPermissionForUserParamSchema = { + project_id: number + username: string +} + +export type t_ProjectsListCardsParamSchema = { + column_id: number +} + +export type t_ProjectsListCardsQuerySchema = { + archived_state?: ("all" | "archived" | "not_archived") | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ProjectsListCollaboratorsParamSchema = { + project_id: number +} + +export type t_ProjectsListCollaboratorsQuerySchema = { + affiliation?: ("outside" | "direct" | "all") | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ProjectsListColumnsParamSchema = { + project_id: number +} + +export type t_ProjectsListColumnsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ProjectsListForOrgParamSchema = { + org: string +} + +export type t_ProjectsListForOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined + state?: ("open" | "closed" | "all") | undefined +} + +export type t_ProjectsListForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ProjectsListForRepoQuerySchema = { + page?: number | undefined + per_page?: number | undefined + state?: ("open" | "closed" | "all") | undefined +} + +export type t_ProjectsListForUserParamSchema = { + username: string +} + +export type t_ProjectsListForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined + state?: ("open" | "closed" | "all") | undefined +} + +export type t_ProjectsMoveCardParamSchema = { + card_id: number +} + +export type t_ProjectsMoveCardRequestBodySchema = { + column_id?: number | undefined + position: string +} + +export type t_ProjectsMoveColumnParamSchema = { + column_id: number +} + +export type t_ProjectsMoveColumnRequestBodySchema = { + position: string +} + +export type t_ProjectsRemoveCollaboratorParamSchema = { + project_id: number + username: string +} + +export type t_ProjectsUpdateParamSchema = { + project_id: number +} + +export type t_ProjectsUpdateRequestBodySchema = { + body?: (string | null) | undefined + name?: string | undefined + organization_permission?: ("read" | "write" | "admin" | "none") | undefined + private?: boolean | undefined + state?: string | undefined +} + +export type t_ProjectsUpdateCardParamSchema = { + card_id: number +} + +export type t_ProjectsUpdateCardRequestBodySchema = { + archived?: boolean | undefined + note?: (string | null) | undefined +} + +export type t_ProjectsUpdateColumnParamSchema = { + column_id: number +} + +export type t_ProjectsUpdateColumnRequestBodySchema = { + name: string +} + +export type t_PullsCheckIfMergedParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsCreateParamSchema = { + owner: string + repo: string +} + +export type t_PullsCreateRequestBodySchema = { + base: string + body?: string | undefined + draft?: boolean | undefined + head: string + head_repo?: string | undefined + issue?: number | undefined + maintainer_can_modify?: boolean | undefined + title?: string | undefined +} + +export type t_PullsCreateReplyForReviewCommentParamSchema = { + comment_id: number + owner: string + pull_number: number + repo: string +} + +export type t_PullsCreateReplyForReviewCommentRequestBodySchema = { + body: string +} + +export type t_PullsCreateReviewParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsCreateReviewRequestBodySchema = { + body?: string | undefined + comments?: + | { + body: string + line?: number | undefined + path: string + position?: number | undefined + side?: string | undefined + start_line?: number | undefined + start_side?: string | undefined + }[] + | undefined + commit_id?: string | undefined + event?: ("APPROVE" | "REQUEST_CHANGES" | "COMMENT") | undefined +} + +export type t_PullsCreateReviewCommentParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsCreateReviewCommentRequestBodySchema = { + body: string + commit_id: string + in_reply_to?: number | undefined + line?: number | undefined + path: string + position?: number | undefined + side?: ("LEFT" | "RIGHT") | undefined + start_line?: number | undefined + start_side?: ("LEFT" | "RIGHT" | "side") | undefined + subject_type?: ("line" | "file") | undefined +} + +export type t_PullsDeletePendingReviewParamSchema = { + owner: string + pull_number: number + repo: string + review_id: number +} + +export type t_PullsDeleteReviewCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_PullsDismissReviewParamSchema = { + owner: string + pull_number: number + repo: string + review_id: number +} + +export type t_PullsDismissReviewRequestBodySchema = { + event?: "DISMISS" | undefined + message: string +} + +export type t_PullsGetParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsGetReviewParamSchema = { + owner: string + pull_number: number + repo: string + review_id: number +} + +export type t_PullsGetReviewCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_PullsListParamSchema = { + owner: string + repo: string +} + +export type t_PullsListQuerySchema = { + base?: string | undefined + direction?: ("asc" | "desc") | undefined + head?: string | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("created" | "updated" | "popularity" | "long-running") | undefined + state?: ("open" | "closed" | "all") | undefined +} + +export type t_PullsListCommentsForReviewParamSchema = { + owner: string + pull_number: number + repo: string + review_id: number +} + +export type t_PullsListCommentsForReviewQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_PullsListCommitsParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsListCommitsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_PullsListFilesParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsListFilesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_PullsListRequestedReviewersParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsListReviewCommentsParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsListReviewCommentsQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + sort?: ("created" | "updated") | undefined +} + +export type t_PullsListReviewCommentsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_PullsListReviewCommentsForRepoQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + sort?: ("created" | "updated" | "created_at") | undefined +} + +export type t_PullsListReviewsParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsListReviewsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_PullsMergeParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsMergeRequestBodySchema = { + commit_message?: string | undefined + commit_title?: string | undefined + merge_method?: ("merge" | "squash" | "rebase") | undefined + sha?: string | undefined +} | null + +export type t_PullsRemoveRequestedReviewersParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsRemoveRequestedReviewersRequestBodySchema = { + reviewers: string[] + team_reviewers?: string[] | undefined +} + +export type t_PullsRequestReviewersParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsRequestReviewersRequestBodySchema = { + reviewers?: string[] | undefined + team_reviewers?: string[] | undefined +} + +export type t_PullsSubmitReviewParamSchema = { + owner: string + pull_number: number + repo: string + review_id: number +} + +export type t_PullsSubmitReviewRequestBodySchema = { + body?: string | undefined + event: "APPROVE" | "REQUEST_CHANGES" | "COMMENT" +} + +export type t_PullsUpdateParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsUpdateRequestBodySchema = { + base?: string | undefined + body?: string | undefined + maintainer_can_modify?: boolean | undefined + state?: ("open" | "closed") | undefined + title?: string | undefined +} + +export type t_PullsUpdateBranchParamSchema = { + owner: string + pull_number: number + repo: string +} + +export type t_PullsUpdateBranchRequestBodySchema = { + expected_head_sha?: string | undefined +} | null + +export type t_PullsUpdateReviewParamSchema = { + owner: string + pull_number: number + repo: string + review_id: number +} + +export type t_PullsUpdateReviewRequestBodySchema = { + body: string +} + +export type t_PullsUpdateReviewCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_PullsUpdateReviewCommentRequestBodySchema = { + body: string +} + +export type t_ReactionsCreateForCommitCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReactionsCreateForCommitCommentRequestBodySchema = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" +} + +export type t_ReactionsCreateForIssueParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_ReactionsCreateForIssueRequestBodySchema = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" +} + +export type t_ReactionsCreateForIssueCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReactionsCreateForIssueCommentRequestBodySchema = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" +} + +export type t_ReactionsCreateForPullRequestReviewCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReactionsCreateForPullRequestReviewCommentRequestBodySchema = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" +} + +export type t_ReactionsCreateForReleaseParamSchema = { + owner: string + release_id: number + repo: string +} + +export type t_ReactionsCreateForReleaseRequestBodySchema = { + content: "+1" | "laugh" | "heart" | "hooray" | "rocket" | "eyes" +} + +export type t_ReactionsCreateForTeamDiscussionCommentInOrgParamSchema = { + comment_number: number + discussion_number: number + org: string + team_slug: string +} + +export type t_ReactionsCreateForTeamDiscussionCommentInOrgRequestBodySchema = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" +} + +export type t_ReactionsCreateForTeamDiscussionCommentLegacyParamSchema = { + comment_number: number + discussion_number: number + team_id: number +} + +export type t_ReactionsCreateForTeamDiscussionCommentLegacyRequestBodySchema = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" +} + +export type t_ReactionsCreateForTeamDiscussionInOrgParamSchema = { + discussion_number: number + org: string + team_slug: string +} + +export type t_ReactionsCreateForTeamDiscussionInOrgRequestBodySchema = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" +} + +export type t_ReactionsCreateForTeamDiscussionLegacyParamSchema = { + discussion_number: number + team_id: number +} + +export type t_ReactionsCreateForTeamDiscussionLegacyRequestBodySchema = { + content: + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" +} + +export type t_ReactionsDeleteForCommitCommentParamSchema = { + comment_id: number + owner: string + reaction_id: number + repo: string +} + +export type t_ReactionsDeleteForIssueParamSchema = { + issue_number: number + owner: string + reaction_id: number + repo: string +} + +export type t_ReactionsDeleteForIssueCommentParamSchema = { + comment_id: number + owner: string + reaction_id: number + repo: string +} + +export type t_ReactionsDeleteForPullRequestCommentParamSchema = { + comment_id: number + owner: string + reaction_id: number + repo: string +} + +export type t_ReactionsDeleteForReleaseParamSchema = { + owner: string + reaction_id: number + release_id: number + repo: string +} + +export type t_ReactionsDeleteForTeamDiscussionParamSchema = { + discussion_number: number + org: string + reaction_id: number + team_slug: string +} + +export type t_ReactionsDeleteForTeamDiscussionCommentParamSchema = { + comment_number: number + discussion_number: number + org: string + reaction_id: number + team_slug: string +} + +export type t_ReactionsListForCommitCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReactionsListForCommitCommentQuerySchema = { + content?: + | ( + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + ) + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReactionsListForIssueParamSchema = { + issue_number: number + owner: string + repo: string +} + +export type t_ReactionsListForIssueQuerySchema = { + content?: + | ( + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + ) + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReactionsListForIssueCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReactionsListForIssueCommentQuerySchema = { + content?: + | ( + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + ) + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReactionsListForPullRequestReviewCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReactionsListForPullRequestReviewCommentQuerySchema = { + content?: + | ( + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + ) + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReactionsListForReleaseParamSchema = { + owner: string + release_id: number + repo: string +} + +export type t_ReactionsListForReleaseQuerySchema = { + content?: + | ("+1" | "laugh" | "heart" | "hooray" | "rocket" | "eyes") + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReactionsListForTeamDiscussionCommentInOrgParamSchema = { + comment_number: number + discussion_number: number + org: string + team_slug: string +} + +export type t_ReactionsListForTeamDiscussionCommentInOrgQuerySchema = { + content?: + | ( + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + ) + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReactionsListForTeamDiscussionCommentLegacyParamSchema = { + comment_number: number + discussion_number: number + team_id: number +} + +export type t_ReactionsListForTeamDiscussionCommentLegacyQuerySchema = { + content?: + | ( + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + ) + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReactionsListForTeamDiscussionInOrgParamSchema = { + discussion_number: number + org: string + team_slug: string +} + +export type t_ReactionsListForTeamDiscussionInOrgQuerySchema = { + content?: + | ( + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + ) + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReactionsListForTeamDiscussionLegacyParamSchema = { + discussion_number: number + team_id: number +} + +export type t_ReactionsListForTeamDiscussionLegacyQuerySchema = { + content?: + | ( + | "+1" + | "-1" + | "laugh" + | "confused" + | "heart" + | "hooray" + | "rocket" + | "eyes" + ) + | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposAcceptInvitationForAuthenticatedUserParamSchema = { + invitation_id: number +} + +export type t_ReposAddAppAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposAddAppAccessRestrictionsRequestBodySchema = { + apps: string[] +} + +export type t_ReposAddCollaboratorParamSchema = { + owner: string + repo: string + username: string +} + +export type t_ReposAddCollaboratorRequestBodySchema = { + permission?: string | undefined +} + +export type t_ReposAddStatusCheckContextsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposAddStatusCheckContextsRequestBodySchema = + | { + contexts: string[] + } + | string[] + +export type t_ReposAddTeamAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposAddTeamAccessRestrictionsRequestBodySchema = + | { + teams: string[] + } + | string[] + +export type t_ReposAddUserAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposAddUserAccessRestrictionsRequestBodySchema = { + users: string[] +} + +export type t_ReposCancelPagesDeploymentParamSchema = { + owner: string + pages_deployment_id: number | string + repo: string +} + +export type t_ReposCheckAutomatedSecurityFixesParamSchema = { + owner: string + repo: string +} + +export type t_ReposCheckCollaboratorParamSchema = { + owner: string + repo: string + username: string +} + +export type t_ReposCheckPrivateVulnerabilityReportingParamSchema = { + owner: string + repo: string +} + +export type t_ReposCheckVulnerabilityAlertsParamSchema = { + owner: string + repo: string +} + +export type t_ReposCodeownersErrorsParamSchema = { + owner: string + repo: string +} + +export type t_ReposCodeownersErrorsQuerySchema = { + ref?: string | undefined +} + +export type t_ReposCompareCommitsParamSchema = { + basehead: string + owner: string + repo: string +} + +export type t_ReposCompareCommitsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposCreateAttestationParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateAttestationRequestBodySchema = { + bundle: { + dsseEnvelope?: + | { + [key: string]: unknown | undefined + } + | undefined + mediaType?: string | undefined + verificationMaterial?: + | { + [key: string]: unknown | undefined + } + | undefined + } +} + +export type t_ReposCreateAutolinkParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateAutolinkRequestBodySchema = { + is_alphanumeric?: boolean | undefined + key_prefix: string + url_template: string +} + +export type t_ReposCreateCommitCommentParamSchema = { + commit_sha: string + owner: string + repo: string +} + +export type t_ReposCreateCommitCommentRequestBodySchema = { + body: string + line?: number | undefined + path?: string | undefined + position?: number | undefined +} + +export type t_ReposCreateCommitSignatureProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposCreateCommitStatusParamSchema = { + owner: string + repo: string + sha: string +} + +export type t_ReposCreateCommitStatusRequestBodySchema = { + context?: string | undefined + description?: (string | null) | undefined + state: "error" | "failure" | "pending" | "success" + target_url?: (string | null) | undefined +} + +export type t_ReposCreateDeployKeyParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateDeployKeyRequestBodySchema = { + key: string + read_only?: boolean | undefined + title?: string | undefined +} + +export type t_ReposCreateDeploymentParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateDeploymentRequestBodySchema = { + auto_merge?: boolean | undefined + description?: (string | null) | undefined + environment?: string | undefined + payload?: + | ( + | { + [key: string]: unknown | undefined + } + | string + ) + | undefined + production_environment?: boolean | undefined + ref: string + required_contexts?: string[] | undefined + task?: string | undefined + transient_environment?: boolean | undefined +} + +export type t_ReposCreateDeploymentBranchPolicyParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ReposCreateDeploymentBranchPolicyRequestBodySchema = { + name: string + type?: ("branch" | "tag") | undefined +} + +export type t_ReposCreateDeploymentProtectionRuleParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ReposCreateDeploymentProtectionRuleRequestBodySchema = { + integration_id?: number | undefined +} + +export type t_ReposCreateDeploymentStatusParamSchema = { + deployment_id: number + owner: string + repo: string +} + +export type t_ReposCreateDeploymentStatusRequestBodySchema = { + auto_inactive?: boolean | undefined + description?: string | undefined + environment?: string | undefined + environment_url?: string | undefined + log_url?: string | undefined + state: + | "error" + | "failure" + | "inactive" + | "in_progress" + | "queued" + | "pending" + | "success" + target_url?: string | undefined +} + +export type t_ReposCreateDispatchEventParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateDispatchEventRequestBodySchema = { + client_payload?: + | { + [key: string]: unknown | undefined + } + | undefined + event_type: string +} + +export type t_ReposCreateForAuthenticatedUserRequestBodySchema = { + allow_auto_merge?: boolean | undefined + allow_merge_commit?: boolean | undefined + allow_rebase_merge?: boolean | undefined + allow_squash_merge?: boolean | undefined + auto_init?: boolean | undefined + delete_branch_on_merge?: boolean | undefined + description?: string | undefined + gitignore_template?: string | undefined + has_discussions?: boolean | undefined + has_downloads?: boolean | undefined + has_issues?: boolean | undefined + has_projects?: boolean | undefined + has_wiki?: boolean | undefined + homepage?: string | undefined + is_template?: boolean | undefined + license_template?: string | undefined + merge_commit_message?: ("PR_BODY" | "PR_TITLE" | "BLANK") | undefined + merge_commit_title?: ("PR_TITLE" | "MERGE_MESSAGE") | undefined + name: string + private?: boolean | undefined + squash_merge_commit_message?: + | ("PR_BODY" | "COMMIT_MESSAGES" | "BLANK") + | undefined + squash_merge_commit_title?: ("PR_TITLE" | "COMMIT_OR_PR_TITLE") | undefined + team_id?: number | undefined +} + +export type t_ReposCreateForkParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateForkRequestBodySchema = { + default_branch_only?: boolean | undefined + name?: string | undefined + organization?: string | undefined +} | null + +export type t_ReposCreateInOrgParamSchema = { + org: string +} + +export type t_ReposCreateInOrgRequestBodySchema = { + allow_auto_merge?: boolean | undefined + allow_merge_commit?: boolean | undefined + allow_rebase_merge?: boolean | undefined + allow_squash_merge?: boolean | undefined + auto_init?: boolean | undefined + custom_properties?: + | { + [key: string]: unknown | undefined + } + | undefined + delete_branch_on_merge?: boolean | undefined + description?: string | undefined + gitignore_template?: string | undefined + has_downloads?: boolean | undefined + has_issues?: boolean | undefined + has_projects?: boolean | undefined + has_wiki?: boolean | undefined + homepage?: string | undefined + is_template?: boolean | undefined + license_template?: string | undefined + merge_commit_message?: ("PR_BODY" | "PR_TITLE" | "BLANK") | undefined + merge_commit_title?: ("PR_TITLE" | "MERGE_MESSAGE") | undefined + name: string + private?: boolean | undefined + squash_merge_commit_message?: + | ("PR_BODY" | "COMMIT_MESSAGES" | "BLANK") + | undefined + squash_merge_commit_title?: ("PR_TITLE" | "COMMIT_OR_PR_TITLE") | undefined + team_id?: number | undefined + use_squash_pr_title_as_default?: boolean | undefined + visibility?: ("public" | "private") | undefined +} + +export type t_ReposCreateOrUpdateCustomPropertiesValuesParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateOrUpdateCustomPropertiesValuesRequestBodySchema = { + properties: t_custom_property_value[] +} + +export type t_ReposCreateOrUpdateEnvironmentParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ReposCreateOrUpdateEnvironmentRequestBodySchema = { + deployment_branch_policy?: t_deployment_branch_policy_settings | undefined + prevent_self_review?: t_prevent_self_review | undefined + reviewers?: + | ( + | { + id?: number | undefined + type?: t_deployment_reviewer_type | undefined + }[] + | null + ) + | undefined + wait_timer?: t_wait_timer | undefined +} | null + +export type t_ReposCreateOrUpdateFileContentsParamSchema = { + owner: string + path: string + repo: string +} + +export type t_ReposCreateOrUpdateFileContentsRequestBodySchema = { + author?: + | { + date?: string | undefined + email: string + name: string + } + | undefined + branch?: string | undefined + committer?: + | { + date?: string | undefined + email: string + name: string + } + | undefined + content: string + message: string + sha?: string | undefined +} + +export type t_ReposCreateOrgRulesetParamSchema = { + org: string +} + +export type t_ReposCreateOrgRulesetRequestBodySchema = { + bypass_actors?: t_repository_ruleset_bypass_actor[] | undefined + conditions?: t_org_ruleset_conditions | undefined + enforcement: t_repository_rule_enforcement + name: string + rules?: t_repository_rule[] | undefined + target?: ("branch" | "tag" | "push" | "repository") | undefined +} + +export type t_ReposCreatePagesDeploymentParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreatePagesDeploymentRequestBodySchema = { + artifact_id?: number | undefined + artifact_url?: string | undefined + environment?: string | undefined + oidc_token: string + pages_build_version: string +} + +export type t_ReposCreatePagesSiteParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreatePagesSiteRequestBodySchema = { + build_type?: ("legacy" | "workflow") | undefined + source?: + | { + branch: string + path?: ("/" | "/docs") | undefined + } + | undefined +} | null + +export type t_ReposCreateReleaseParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateReleaseRequestBodySchema = { + body?: string | undefined + discussion_category_name?: string | undefined + draft?: boolean | undefined + generate_release_notes?: boolean | undefined + make_latest?: ("true" | "false" | "legacy") | undefined + name?: string | undefined + prerelease?: boolean | undefined + tag_name: string + target_commitish?: string | undefined +} + +export type t_ReposCreateRepoRulesetParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateRepoRulesetRequestBodySchema = { + bypass_actors?: t_repository_ruleset_bypass_actor[] | undefined + conditions?: t_repository_ruleset_conditions | undefined + enforcement: t_repository_rule_enforcement + name: string + rules?: t_repository_rule[] | undefined + target?: ("branch" | "tag" | "push") | undefined +} + +export type t_ReposCreateTagProtectionParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateTagProtectionRequestBodySchema = { + pattern: string +} + +export type t_ReposCreateUsingTemplateParamSchema = { + template_owner: string + template_repo: string +} + +export type t_ReposCreateUsingTemplateRequestBodySchema = { + description?: string | undefined + include_all_branches?: boolean | undefined + name: string + owner?: string | undefined + private?: boolean | undefined +} + +export type t_ReposCreateWebhookParamSchema = { + owner: string + repo: string +} + +export type t_ReposCreateWebhookRequestBodySchema = { + active?: boolean | undefined + config?: + | { + content_type?: t_webhook_config_content_type | undefined + insecure_ssl?: t_webhook_config_insecure_ssl | undefined + secret?: t_webhook_config_secret | undefined + url?: t_webhook_config_url | undefined + } + | undefined + events?: string[] | undefined + name?: string | undefined +} | null + +export type t_ReposDeclineInvitationForAuthenticatedUserParamSchema = { + invitation_id: number +} + +export type t_ReposDeleteParamSchema = { + owner: string + repo: string +} + +export type t_ReposDeleteAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposDeleteAdminBranchProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposDeleteAnEnvironmentParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ReposDeleteAutolinkParamSchema = { + autolink_id: number + owner: string + repo: string +} + +export type t_ReposDeleteBranchProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposDeleteCommitCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReposDeleteCommitSignatureProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposDeleteDeployKeyParamSchema = { + key_id: number + owner: string + repo: string +} + +export type t_ReposDeleteDeploymentParamSchema = { + deployment_id: number + owner: string + repo: string +} + +export type t_ReposDeleteDeploymentBranchPolicyParamSchema = { + branch_policy_id: number + environment_name: string + owner: string + repo: string +} + +export type t_ReposDeleteFileParamSchema = { + owner: string + path: string + repo: string +} + +export type t_ReposDeleteFileRequestBodySchema = { + author?: + | { + email?: string | undefined + name?: string | undefined + } + | undefined + branch?: string | undefined + committer?: + | { + email?: string | undefined + name?: string | undefined + } + | undefined + message: string + sha: string +} + +export type t_ReposDeleteInvitationParamSchema = { + invitation_id: number + owner: string + repo: string +} + +export type t_ReposDeleteOrgRulesetParamSchema = { + org: string + ruleset_id: number +} + +export type t_ReposDeletePagesSiteParamSchema = { + owner: string + repo: string +} + +export type t_ReposDeletePullRequestReviewProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposDeleteReleaseParamSchema = { + owner: string + release_id: number + repo: string +} + +export type t_ReposDeleteReleaseAssetParamSchema = { + asset_id: number + owner: string + repo: string +} + +export type t_ReposDeleteRepoRulesetParamSchema = { + owner: string + repo: string + ruleset_id: number +} + +export type t_ReposDeleteTagProtectionParamSchema = { + owner: string + repo: string + tag_protection_id: number +} + +export type t_ReposDeleteWebhookParamSchema = { + hook_id: number + owner: string + repo: string +} + +export type t_ReposDisableAutomatedSecurityFixesParamSchema = { + owner: string + repo: string +} + +export type t_ReposDisableDeploymentProtectionRuleParamSchema = { + environment_name: string + owner: string + protection_rule_id: number + repo: string +} + +export type t_ReposDisablePrivateVulnerabilityReportingParamSchema = { + owner: string + repo: string +} + +export type t_ReposDisableVulnerabilityAlertsParamSchema = { + owner: string + repo: string +} + +export type t_ReposDownloadTarballArchiveParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_ReposDownloadZipballArchiveParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_ReposEnableAutomatedSecurityFixesParamSchema = { + owner: string + repo: string +} + +export type t_ReposEnablePrivateVulnerabilityReportingParamSchema = { + owner: string + repo: string +} + +export type t_ReposEnableVulnerabilityAlertsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGenerateReleaseNotesParamSchema = { + owner: string + repo: string +} + +export type t_ReposGenerateReleaseNotesRequestBodySchema = { + configuration_file_path?: string | undefined + previous_tag_name?: string | undefined + tag_name: string + target_commitish?: string | undefined +} + +export type t_ReposGetParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetAdminBranchProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetAllDeploymentProtectionRulesParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ReposGetAllEnvironmentsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetAllEnvironmentsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposGetAllStatusCheckContextsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetAllTopicsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetAllTopicsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposGetAppsWithAccessToProtectedBranchParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetAutolinkParamSchema = { + autolink_id: number + owner: string + repo: string +} + +export type t_ReposGetBranchParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetBranchProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetBranchRulesParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetBranchRulesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposGetClonesParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetClonesQuerySchema = { + per?: ("day" | "week") | undefined +} + +export type t_ReposGetCodeFrequencyStatsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetCollaboratorPermissionLevelParamSchema = { + owner: string + repo: string + username: string +} + +export type t_ReposGetCombinedStatusForRefParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_ReposGetCombinedStatusForRefQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposGetCommitParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_ReposGetCommitQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposGetCommitActivityStatsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetCommitCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReposGetCommitSignatureProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetCommunityProfileMetricsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetContentParamSchema = { + owner: string + path: string + repo: string +} + +export type t_ReposGetContentQuerySchema = { + ref?: string | undefined +} + +export type t_ReposGetContributorsStatsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetCustomDeploymentProtectionRuleParamSchema = { + environment_name: string + owner: string + protection_rule_id: number + repo: string +} + +export type t_ReposGetCustomPropertiesValuesParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetDeployKeyParamSchema = { + key_id: number + owner: string + repo: string +} + +export type t_ReposGetDeploymentParamSchema = { + deployment_id: number + owner: string + repo: string +} + +export type t_ReposGetDeploymentBranchPolicyParamSchema = { + branch_policy_id: number + environment_name: string + owner: string + repo: string +} + +export type t_ReposGetDeploymentStatusParamSchema = { + deployment_id: number + owner: string + repo: string + status_id: number +} + +export type t_ReposGetEnvironmentParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ReposGetLatestPagesBuildParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetLatestReleaseParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetOrgRuleSuiteParamSchema = { + org: string + rule_suite_id: number +} + +export type t_ReposGetOrgRuleSuitesParamSchema = { + org: string +} + +export type t_ReposGetOrgRuleSuitesQuerySchema = { + actor_name?: string | undefined + page?: number | undefined + per_page?: number | undefined + ref?: string | undefined + repository_name?: string | undefined + rule_suite_result?: ("pass" | "fail" | "bypass" | "all") | undefined + time_period?: ("hour" | "day" | "week" | "month") | undefined +} + +export type t_ReposGetOrgRulesetParamSchema = { + org: string + ruleset_id: number +} + +export type t_ReposGetOrgRulesetsParamSchema = { + org: string +} + +export type t_ReposGetOrgRulesetsQuerySchema = { + page?: number | undefined + per_page?: number | undefined + targets?: string | undefined +} + +export type t_ReposGetPagesParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetPagesBuildParamSchema = { + build_id: number + owner: string + repo: string +} + +export type t_ReposGetPagesDeploymentParamSchema = { + owner: string + pages_deployment_id: number | string + repo: string +} + +export type t_ReposGetPagesHealthCheckParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetParticipationStatsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetPullRequestReviewProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetPunchCardStatsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetReadmeParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetReadmeQuerySchema = { + ref?: string | undefined +} + +export type t_ReposGetReadmeInDirectoryParamSchema = { + dir: string + owner: string + repo: string +} + +export type t_ReposGetReadmeInDirectoryQuerySchema = { + ref?: string | undefined +} + +export type t_ReposGetReleaseParamSchema = { + owner: string + release_id: number + repo: string +} + +export type t_ReposGetReleaseAssetParamSchema = { + asset_id: number + owner: string + repo: string +} + +export type t_ReposGetReleaseByTagParamSchema = { + owner: string + repo: string + tag: string +} + +export type t_ReposGetRepoRuleSuiteParamSchema = { + owner: string + repo: string + rule_suite_id: number +} + +export type t_ReposGetRepoRuleSuitesParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetRepoRuleSuitesQuerySchema = { + actor_name?: string | undefined + page?: number | undefined + per_page?: number | undefined + ref?: string | undefined + rule_suite_result?: ("pass" | "fail" | "bypass" | "all") | undefined + time_period?: ("hour" | "day" | "week" | "month") | undefined +} + +export type t_ReposGetRepoRulesetParamSchema = { + owner: string + repo: string + ruleset_id: number +} + +export type t_ReposGetRepoRulesetQuerySchema = { + includes_parents?: boolean | undefined +} + +export type t_ReposGetRepoRulesetHistoryParamSchema = { + owner: string + repo: string + ruleset_id: number +} + +export type t_ReposGetRepoRulesetHistoryQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposGetRepoRulesetVersionParamSchema = { + owner: string + repo: string + ruleset_id: number + version_id: number +} + +export type t_ReposGetRepoRulesetsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetRepoRulesetsQuerySchema = { + includes_parents?: boolean | undefined + page?: number | undefined + per_page?: number | undefined + targets?: string | undefined +} + +export type t_ReposGetStatusChecksProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetTeamsWithAccessToProtectedBranchParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetTopPathsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetTopReferrersParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetUsersWithAccessToProtectedBranchParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposGetViewsParamSchema = { + owner: string + repo: string +} + +export type t_ReposGetViewsQuerySchema = { + per?: ("day" | "week") | undefined +} + +export type t_ReposGetWebhookParamSchema = { + hook_id: number + owner: string + repo: string +} + +export type t_ReposGetWebhookConfigForRepoParamSchema = { + hook_id: number + owner: string + repo: string +} + +export type t_ReposGetWebhookDeliveryParamSchema = { + delivery_id: number + hook_id: number + owner: string + repo: string +} + +export type t_ReposListActivitiesParamSchema = { + owner: string + repo: string +} + +export type t_ReposListActivitiesQuerySchema = { + activity_type?: + | ( + | "push" + | "force_push" + | "branch_creation" + | "branch_deletion" + | "pr_merge" + | "merge_queue_merge" + ) + | undefined + actor?: string | undefined + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + per_page?: number | undefined + ref?: string | undefined + time_period?: ("day" | "week" | "month" | "quarter" | "year") | undefined +} + +export type t_ReposListAttestationsParamSchema = { + owner: string + repo: string + subject_digest: string +} + +export type t_ReposListAttestationsQuerySchema = { + after?: string | undefined + before?: string | undefined + per_page?: number | undefined + predicate_type?: string | undefined +} + +export type t_ReposListAutolinksParamSchema = { + owner: string + repo: string +} + +export type t_ReposListBranchesParamSchema = { + owner: string + repo: string +} + +export type t_ReposListBranchesQuerySchema = { + page?: number | undefined + per_page?: number | undefined + protected?: boolean | undefined +} + +export type t_ReposListBranchesForHeadCommitParamSchema = { + commit_sha: string + owner: string + repo: string +} + +export type t_ReposListCollaboratorsParamSchema = { + owner: string + repo: string +} + +export type t_ReposListCollaboratorsQuerySchema = { + affiliation?: ("outside" | "direct" | "all") | undefined + page?: number | undefined + per_page?: number | undefined + permission?: ("pull" | "triage" | "push" | "maintain" | "admin") | undefined +} + +export type t_ReposListCommentsForCommitParamSchema = { + commit_sha: string + owner: string + repo: string +} + +export type t_ReposListCommentsForCommitQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListCommitCommentsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_ReposListCommitCommentsForRepoQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListCommitStatusesForRefParamSchema = { + owner: string + ref: string + repo: string +} + +export type t_ReposListCommitStatusesForRefQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListCommitsParamSchema = { + owner: string + repo: string +} + +export type t_ReposListCommitsQuerySchema = { + author?: string | undefined + committer?: string | undefined + page?: number | undefined + path?: string | undefined + per_page?: number | undefined + sha?: string | undefined + since?: string | undefined + until?: string | undefined +} + +export type t_ReposListContributorsParamSchema = { + owner: string + repo: string +} + +export type t_ReposListContributorsQuerySchema = { + anon?: string | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListCustomDeploymentRuleIntegrationsParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ReposListCustomDeploymentRuleIntegrationsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListDeployKeysParamSchema = { + owner: string + repo: string +} + +export type t_ReposListDeployKeysQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListDeploymentBranchPoliciesParamSchema = { + environment_name: string + owner: string + repo: string +} + +export type t_ReposListDeploymentBranchPoliciesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListDeploymentStatusesParamSchema = { + deployment_id: number + owner: string + repo: string +} + +export type t_ReposListDeploymentStatusesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListDeploymentsParamSchema = { + owner: string + repo: string +} + +export type t_ReposListDeploymentsQuerySchema = { + environment?: (string | null) | undefined + page?: number | undefined + per_page?: number | undefined + ref?: string | undefined + sha?: string | undefined + task?: string | undefined +} + +export type t_ReposListForAuthenticatedUserQuerySchema = { + affiliation?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + since?: string | undefined + sort?: ("created" | "updated" | "pushed" | "full_name") | undefined + type?: ("all" | "owner" | "public" | "private" | "member") | undefined + visibility?: ("all" | "public" | "private") | undefined +} + +export type t_ReposListForOrgParamSchema = { + org: string +} + +export type t_ReposListForOrgQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("created" | "updated" | "pushed" | "full_name") | undefined + type?: + | ("all" | "public" | "private" | "forks" | "sources" | "member") + | undefined +} + +export type t_ReposListForUserParamSchema = { + username: string +} + +export type t_ReposListForUserQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + sort?: ("created" | "updated" | "pushed" | "full_name") | undefined + type?: ("all" | "owner" | "member") | undefined +} + +export type t_ReposListForksParamSchema = { + owner: string + repo: string +} + +export type t_ReposListForksQuerySchema = { + page?: number | undefined + per_page?: number | undefined + sort?: ("newest" | "oldest" | "stargazers" | "watchers") | undefined +} + +export type t_ReposListInvitationsParamSchema = { + owner: string + repo: string +} + +export type t_ReposListInvitationsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListInvitationsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListLanguagesParamSchema = { + owner: string + repo: string +} + +export type t_ReposListPagesBuildsParamSchema = { + owner: string + repo: string +} + +export type t_ReposListPagesBuildsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListPublicQuerySchema = { + since?: number | undefined +} + +export type t_ReposListPullRequestsAssociatedWithCommitParamSchema = { + commit_sha: string + owner: string + repo: string +} + +export type t_ReposListPullRequestsAssociatedWithCommitQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListReleaseAssetsParamSchema = { + owner: string + release_id: number + repo: string +} + +export type t_ReposListReleaseAssetsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListReleasesParamSchema = { + owner: string + repo: string +} + +export type t_ReposListReleasesQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListTagProtectionParamSchema = { + owner: string + repo: string +} + +export type t_ReposListTagsParamSchema = { + owner: string + repo: string +} + +export type t_ReposListTagsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListTeamsParamSchema = { + owner: string + repo: string +} + +export type t_ReposListTeamsQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposListWebhookDeliveriesParamSchema = { + hook_id: number + owner: string + repo: string +} + +export type t_ReposListWebhookDeliveriesQuerySchema = { + cursor?: string | undefined + per_page?: number | undefined +} + +export type t_ReposListWebhooksParamSchema = { + owner: string + repo: string +} + +export type t_ReposListWebhooksQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_ReposMergeParamSchema = { + owner: string + repo: string +} + +export type t_ReposMergeRequestBodySchema = { + base: string + commit_message?: string | undefined + head: string +} + +export type t_ReposMergeUpstreamParamSchema = { + owner: string + repo: string +} + +export type t_ReposMergeUpstreamRequestBodySchema = { + branch: string +} + +export type t_ReposPingWebhookParamSchema = { + hook_id: number + owner: string + repo: string +} + +export type t_ReposRedeliverWebhookDeliveryParamSchema = { + delivery_id: number + hook_id: number + owner: string + repo: string +} + +export type t_ReposRemoveAppAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposRemoveAppAccessRestrictionsRequestBodySchema = { + apps: string[] +} + +export type t_ReposRemoveCollaboratorParamSchema = { + owner: string + repo: string + username: string +} + +export type t_ReposRemoveStatusCheckContextsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposRemoveStatusCheckContextsRequestBodySchema = + | { + contexts: string[] + } + | string[] + +export type t_ReposRemoveStatusCheckProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposRemoveTeamAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposRemoveTeamAccessRestrictionsRequestBodySchema = + | { + teams: string[] + } + | string[] + +export type t_ReposRemoveUserAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposRemoveUserAccessRestrictionsRequestBodySchema = { + users: string[] +} + +export type t_ReposRenameBranchParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposRenameBranchRequestBodySchema = { + new_name: string +} + +export type t_ReposReplaceAllTopicsParamSchema = { + owner: string + repo: string +} + +export type t_ReposReplaceAllTopicsRequestBodySchema = { + names: string[] +} + +export type t_ReposRequestPagesBuildParamSchema = { + owner: string + repo: string +} + +export type t_ReposSetAdminBranchProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposSetAppAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposSetAppAccessRestrictionsRequestBodySchema = { + apps: string[] +} + +export type t_ReposSetStatusCheckContextsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposSetStatusCheckContextsRequestBodySchema = + | { + contexts: string[] + } + | string[] + +export type t_ReposSetTeamAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposSetTeamAccessRestrictionsRequestBodySchema = + | { + teams: string[] + } + | string[] + +export type t_ReposSetUserAccessRestrictionsParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposSetUserAccessRestrictionsRequestBodySchema = { + users: string[] +} + +export type t_ReposTestPushWebhookParamSchema = { + hook_id: number + owner: string + repo: string +} + +export type t_ReposTransferParamSchema = { + owner: string + repo: string +} + +export type t_ReposTransferRequestBodySchema = { + new_name?: string | undefined + new_owner: string + team_ids?: number[] | undefined +} + +export type t_ReposUpdateParamSchema = { + owner: string + repo: string +} + +export type t_ReposUpdateRequestBodySchema = { + allow_auto_merge?: boolean | undefined + allow_forking?: boolean | undefined + allow_merge_commit?: boolean | undefined + allow_rebase_merge?: boolean | undefined + allow_squash_merge?: boolean | undefined + allow_update_branch?: boolean | undefined + archived?: boolean | undefined + default_branch?: string | undefined + delete_branch_on_merge?: boolean | undefined + description?: string | undefined + has_issues?: boolean | undefined + has_projects?: boolean | undefined + has_wiki?: boolean | undefined + homepage?: string | undefined + is_template?: boolean | undefined + merge_commit_message?: ("PR_BODY" | "PR_TITLE" | "BLANK") | undefined + merge_commit_title?: ("PR_TITLE" | "MERGE_MESSAGE") | undefined + name?: string | undefined + private?: boolean | undefined + security_and_analysis?: + | ({ + advanced_security?: + | { + status?: string | undefined + } + | undefined + code_security?: + | { + status?: string | undefined + } + | undefined + secret_scanning?: + | { + status?: string | undefined + } + | undefined + secret_scanning_ai_detection?: + | { + status?: string | undefined + } + | undefined + secret_scanning_non_provider_patterns?: + | { + status?: string | undefined + } + | undefined + secret_scanning_push_protection?: + | { + status?: string | undefined + } + | undefined + } | null) + | undefined + squash_merge_commit_message?: + | ("PR_BODY" | "COMMIT_MESSAGES" | "BLANK") + | undefined + squash_merge_commit_title?: ("PR_TITLE" | "COMMIT_OR_PR_TITLE") | undefined + use_squash_pr_title_as_default?: boolean | undefined + visibility?: ("public" | "private") | undefined + web_commit_signoff_required?: boolean | undefined +} + +export type t_ReposUpdateBranchProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposUpdateBranchProtectionRequestBodySchema = { + allow_deletions?: boolean | undefined + allow_force_pushes?: (boolean | null) | undefined + allow_fork_syncing?: boolean | undefined + block_creations?: boolean | undefined + enforce_admins: boolean | null + lock_branch?: boolean | undefined + required_conversation_resolution?: boolean | undefined + required_linear_history?: boolean | undefined + required_pull_request_reviews: { + bypass_pull_request_allowances?: + | { + apps?: string[] | undefined + teams?: string[] | undefined + users?: string[] | undefined + } + | undefined + dismiss_stale_reviews?: boolean | undefined + dismissal_restrictions?: + | { + apps?: string[] | undefined + teams?: string[] | undefined + users?: string[] | undefined + } + | undefined + require_code_owner_reviews?: boolean | undefined + require_last_push_approval?: boolean | undefined + required_approving_review_count?: number | undefined + } | null + required_status_checks: { + checks?: + | { + app_id?: number | undefined + context: string + }[] + | undefined + contexts: string[] + strict: boolean + } | null + restrictions: { + apps?: string[] | undefined + teams: string[] + users: string[] + } | null +} + +export type t_ReposUpdateCommitCommentParamSchema = { + comment_id: number + owner: string + repo: string +} + +export type t_ReposUpdateCommitCommentRequestBodySchema = { + body: string +} + +export type t_ReposUpdateDeploymentBranchPolicyParamSchema = { + branch_policy_id: number + environment_name: string + owner: string + repo: string +} + +export type t_ReposUpdateDeploymentBranchPolicyRequestBodySchema = { + name: string +} + +export type t_ReposUpdateInformationAboutPagesSiteParamSchema = { + owner: string + repo: string +} + +export type t_ReposUpdateInformationAboutPagesSiteRequestBodySchema = { + build_type?: ("legacy" | "workflow") | undefined + cname?: (string | null) | undefined + https_enforced?: boolean | undefined + source?: + | ( + | "gh-pages" + | "master" + | "master /docs" + | { + branch: string + path: "/" | "/docs" + } + ) + | undefined +} + +export type t_ReposUpdateInvitationParamSchema = { + invitation_id: number + owner: string + repo: string +} + +export type t_ReposUpdateInvitationRequestBodySchema = { + permissions?: ("read" | "write" | "maintain" | "triage" | "admin") | undefined +} + +export type t_ReposUpdateOrgRulesetParamSchema = { + org: string + ruleset_id: number +} + +export type t_ReposUpdateOrgRulesetRequestBodySchema = { + bypass_actors?: t_repository_ruleset_bypass_actor[] | undefined + conditions?: t_org_ruleset_conditions | undefined + enforcement?: t_repository_rule_enforcement | undefined + name?: string | undefined + rules?: t_repository_rule[] | undefined + target?: ("branch" | "tag" | "push" | "repository") | undefined +} + +export type t_ReposUpdatePullRequestReviewProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposUpdatePullRequestReviewProtectionRequestBodySchema = { + bypass_pull_request_allowances?: + | { + apps?: string[] | undefined + teams?: string[] | undefined + users?: string[] | undefined + } + | undefined + dismiss_stale_reviews?: boolean | undefined + dismissal_restrictions?: + | { + apps?: string[] | undefined + teams?: string[] | undefined + users?: string[] | undefined + } + | undefined + require_code_owner_reviews?: boolean | undefined + require_last_push_approval?: boolean | undefined + required_approving_review_count?: number | undefined +} + +export type t_ReposUpdateReleaseParamSchema = { + owner: string + release_id: number + repo: string +} + +export type t_ReposUpdateReleaseRequestBodySchema = { + body?: string | undefined + discussion_category_name?: string | undefined + draft?: boolean | undefined + make_latest?: ("true" | "false" | "legacy") | undefined + name?: string | undefined + prerelease?: boolean | undefined + tag_name?: string | undefined + target_commitish?: string | undefined +} + +export type t_ReposUpdateReleaseAssetParamSchema = { + asset_id: number + owner: string + repo: string +} + +export type t_ReposUpdateReleaseAssetRequestBodySchema = { + label?: string | undefined + name?: string | undefined + state?: string | undefined +} + +export type t_ReposUpdateRepoRulesetParamSchema = { + owner: string + repo: string + ruleset_id: number +} + +export type t_ReposUpdateRepoRulesetRequestBodySchema = { + bypass_actors?: t_repository_ruleset_bypass_actor[] | undefined + conditions?: t_repository_ruleset_conditions | undefined + enforcement?: t_repository_rule_enforcement | undefined + name?: string | undefined + rules?: t_repository_rule[] | undefined + target?: ("branch" | "tag" | "push") | undefined +} + +export type t_ReposUpdateStatusCheckProtectionParamSchema = { + branch: string + owner: string + repo: string +} + +export type t_ReposUpdateStatusCheckProtectionRequestBodySchema = { + checks?: + | { + app_id?: number | undefined + context: string + }[] + | undefined + contexts?: string[] | undefined + strict?: boolean | undefined +} + +export type t_ReposUpdateWebhookParamSchema = { + hook_id: number + owner: string + repo: string +} + +export type t_ReposUpdateWebhookRequestBodySchema = { + active?: boolean | undefined + add_events?: string[] | undefined + config?: t_webhook_config | undefined + events?: string[] | undefined + remove_events?: string[] | undefined +} + +export type t_ReposUpdateWebhookConfigForRepoParamSchema = { + hook_id: number + owner: string + repo: string +} + +export type t_ReposUpdateWebhookConfigForRepoRequestBodySchema = { + content_type?: t_webhook_config_content_type | undefined + insecure_ssl?: t_webhook_config_insecure_ssl | undefined + secret?: t_webhook_config_secret | undefined + url?: t_webhook_config_url | undefined +} + +export type t_ReposUploadReleaseAssetParamSchema = { + owner: string + release_id: number + repo: string +} + +export type t_ReposUploadReleaseAssetQuerySchema = { + label?: string | undefined + name: string +} + +export type t_ReposUploadReleaseAssetRequestBodySchema = string + +export type t_SearchCodeQuerySchema = { + order?: ("desc" | "asc") | undefined + page?: number | undefined + per_page?: number | undefined + q: string + sort?: "indexed" | undefined +} + +export type t_SearchCommitsQuerySchema = { + order?: ("desc" | "asc") | undefined + page?: number | undefined + per_page?: number | undefined + q: string + sort?: ("author-date" | "committer-date") | undefined +} + +export type t_SearchIssuesAndPullRequestsQuerySchema = { + advanced_search?: string | undefined + order?: ("desc" | "asc") | undefined + page?: number | undefined + per_page?: number | undefined + q: string + sort?: + | ( + | "comments" + | "reactions" + | "reactions-+1" + | "reactions--1" + | "reactions-smile" + | "reactions-thinking_face" + | "reactions-heart" + | "reactions-tada" + | "interactions" + | "created" + | "updated" + ) + | undefined +} + +export type t_SearchLabelsQuerySchema = { + order?: ("desc" | "asc") | undefined + page?: number | undefined + per_page?: number | undefined + q: string + repository_id: number + sort?: ("created" | "updated") | undefined +} + +export type t_SearchReposQuerySchema = { + order?: ("desc" | "asc") | undefined + page?: number | undefined + per_page?: number | undefined + q: string + sort?: ("stars" | "forks" | "help-wanted-issues" | "updated") | undefined +} + +export type t_SearchTopicsQuerySchema = { + page?: number | undefined + per_page?: number | undefined + q: string +} + +export type t_SearchUsersQuerySchema = { + order?: ("desc" | "asc") | undefined + page?: number | undefined + per_page?: number | undefined + q: string + sort?: ("followers" | "repositories" | "joined") | undefined +} + +export type t_SecretScanningCreatePushProtectionBypassParamSchema = { + owner: string + repo: string +} + +export type t_SecretScanningCreatePushProtectionBypassRequestBodySchema = { + placeholder_id: t_secret_scanning_push_protection_bypass_placeholder_id + reason: t_secret_scanning_push_protection_bypass_reason +} + +export type t_SecretScanningGetAlertParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_SecretScanningGetScanHistoryParamSchema = { + owner: string + repo: string +} + +export type t_SecretScanningListAlertsForEnterpriseParamSchema = { + enterprise: string +} + +export type t_SecretScanningListAlertsForEnterpriseQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + is_multi_repo?: boolean | undefined + is_publicly_leaked?: boolean | undefined + per_page?: number | undefined + resolution?: string | undefined + secret_type?: string | undefined + sort?: ("created" | "updated") | undefined + state?: ("open" | "resolved") | undefined + validity?: string | undefined +} + +export type t_SecretScanningListAlertsForOrgParamSchema = { + org: string +} + +export type t_SecretScanningListAlertsForOrgQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + is_multi_repo?: boolean | undefined + is_publicly_leaked?: boolean | undefined + page?: number | undefined + per_page?: number | undefined + resolution?: string | undefined + secret_type?: string | undefined + sort?: ("created" | "updated") | undefined + state?: ("open" | "resolved") | undefined + validity?: string | undefined +} + +export type t_SecretScanningListAlertsForRepoParamSchema = { + owner: string + repo: string +} + +export type t_SecretScanningListAlertsForRepoQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + is_multi_repo?: boolean | undefined + is_publicly_leaked?: boolean | undefined + page?: number | undefined + per_page?: number | undefined + resolution?: string | undefined + secret_type?: string | undefined + sort?: ("created" | "updated") | undefined + state?: ("open" | "resolved") | undefined + validity?: string | undefined +} + +export type t_SecretScanningListLocationsForAlertParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_SecretScanningListLocationsForAlertQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_SecretScanningUpdateAlertParamSchema = { + alert_number: t_alert_number + owner: string + repo: string +} + +export type t_SecretScanningUpdateAlertRequestBodySchema = { + resolution?: t_secret_scanning_alert_resolution | undefined + resolution_comment?: t_secret_scanning_alert_resolution_comment | undefined + state: t_secret_scanning_alert_state +} + +export type t_SecurityAdvisoriesCreateForkParamSchema = { + ghsa_id: string + owner: string + repo: string +} + +export type t_SecurityAdvisoriesCreatePrivateVulnerabilityReportParamSchema = { + owner: string + repo: string +} + +export type t_SecurityAdvisoriesCreatePrivateVulnerabilityReportRequestBodySchema = + { + cvss_vector_string?: (string | null) | undefined + cwe_ids?: (string[] | null) | undefined + description: string + severity?: ("critical" | "high" | "medium" | "low" | null) | undefined + start_private_fork?: boolean | undefined + summary: string + vulnerabilities?: + | ( + | { + package: { + ecosystem: t_security_advisory_ecosystems + name?: (string | null) | undefined + } + patched_versions?: (string | null) | undefined + vulnerable_functions?: (string[] | null) | undefined + vulnerable_version_range?: (string | null) | undefined + }[] + | null + ) + | undefined + } + +export type t_SecurityAdvisoriesCreateRepositoryAdvisoryParamSchema = { + owner: string + repo: string +} + +export type t_SecurityAdvisoriesCreateRepositoryAdvisoryRequestBodySchema = { + credits?: + | ( + | { + login: string + type: t_security_advisory_credit_types + }[] + | null + ) + | undefined + cve_id?: (string | null) | undefined + cvss_vector_string?: (string | null) | undefined + cwe_ids?: (string[] | null) | undefined + description: string + severity?: ("critical" | "high" | "medium" | "low" | null) | undefined + start_private_fork?: boolean | undefined + summary: string + vulnerabilities: { + package: { + ecosystem: t_security_advisory_ecosystems + name?: (string | null) | undefined + } + patched_versions?: (string | null) | undefined + vulnerable_functions?: (string[] | null) | undefined + vulnerable_version_range?: (string | null) | undefined + }[] +} + +export type t_SecurityAdvisoriesCreateRepositoryAdvisoryCveRequestParamSchema = + { + ghsa_id: string + owner: string + repo: string + } + +export type t_SecurityAdvisoriesGetGlobalAdvisoryParamSchema = { + ghsa_id: string +} + +export type t_SecurityAdvisoriesGetRepositoryAdvisoryParamSchema = { + ghsa_id: string + owner: string + repo: string +} + +export type t_SecurityAdvisoriesListGlobalAdvisoriesQuerySchema = { + affects?: (string | string[]) | undefined + after?: string | undefined + before?: string | undefined + cve_id?: string | undefined + cwes?: (string | string[]) | undefined + direction?: ("asc" | "desc") | undefined + ecosystem?: t_security_advisory_ecosystems | undefined + epss_percentage?: string | undefined + epss_percentile?: string | undefined + ghsa_id?: string | undefined + is_withdrawn?: boolean | undefined + modified?: string | undefined + per_page?: number | undefined + published?: string | undefined + severity?: ("unknown" | "low" | "medium" | "high" | "critical") | undefined + sort?: + | ("updated" | "published" | "epss_percentage" | "epss_percentile") + | undefined + type?: ("reviewed" | "malware" | "unreviewed") | undefined + updated?: string | undefined +} + +export type t_SecurityAdvisoriesListOrgRepositoryAdvisoriesParamSchema = { + org: string +} + +export type t_SecurityAdvisoriesListOrgRepositoryAdvisoriesQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + per_page?: number | undefined + sort?: ("created" | "updated" | "published") | undefined + state?: ("triage" | "draft" | "published" | "closed") | undefined +} + +export type t_SecurityAdvisoriesListRepositoryAdvisoriesParamSchema = { + owner: string + repo: string +} + +export type t_SecurityAdvisoriesListRepositoryAdvisoriesQuerySchema = { + after?: string | undefined + before?: string | undefined + direction?: ("asc" | "desc") | undefined + per_page?: number | undefined + sort?: ("created" | "updated" | "published") | undefined + state?: ("triage" | "draft" | "published" | "closed") | undefined +} + +export type t_SecurityAdvisoriesUpdateRepositoryAdvisoryParamSchema = { + ghsa_id: string + owner: string + repo: string +} + +export type t_SecurityAdvisoriesUpdateRepositoryAdvisoryRequestBodySchema = { + collaborating_teams?: (string[] | null) | undefined + collaborating_users?: (string[] | null) | undefined + credits?: + | ( + | { + login: string + type: t_security_advisory_credit_types + }[] + | null + ) + | undefined + cve_id?: (string | null) | undefined + cvss_vector_string?: (string | null) | undefined + cwe_ids?: (string[] | null) | undefined + description?: string | undefined + severity?: ("critical" | "high" | "medium" | "low" | null) | undefined + state?: ("published" | "closed" | "draft") | undefined + summary?: string | undefined + vulnerabilities?: + | { + package: { + ecosystem: t_security_advisory_ecosystems + name?: (string | null) | undefined + } + patched_versions?: (string | null) | undefined + vulnerable_functions?: (string[] | null) | undefined + vulnerable_version_range?: (string | null) | undefined + }[] + | undefined +} + +export type t_TeamsAddMemberLegacyParamSchema = { + team_id: number + username: string +} + +export type t_TeamsAddOrUpdateMembershipForUserInOrgParamSchema = { + org: string + team_slug: string + username: string +} + +export type t_TeamsAddOrUpdateMembershipForUserInOrgRequestBodySchema = { + role?: ("member" | "maintainer") | undefined +} + +export type t_TeamsAddOrUpdateMembershipForUserLegacyParamSchema = { + team_id: number + username: string +} + +export type t_TeamsAddOrUpdateMembershipForUserLegacyRequestBodySchema = { + role?: ("member" | "maintainer") | undefined +} + +export type t_TeamsAddOrUpdateProjectPermissionsInOrgParamSchema = { + org: string + project_id: number + team_slug: string +} + +export type t_TeamsAddOrUpdateProjectPermissionsInOrgRequestBodySchema = { + permission?: ("read" | "write" | "admin") | undefined +} | null + +export type t_TeamsAddOrUpdateProjectPermissionsLegacyParamSchema = { + project_id: number + team_id: number +} + +export type t_TeamsAddOrUpdateProjectPermissionsLegacyRequestBodySchema = { + permission?: ("read" | "write" | "admin") | undefined +} + +export type t_TeamsAddOrUpdateRepoPermissionsInOrgParamSchema = { + org: string + owner: string + repo: string + team_slug: string +} + +export type t_TeamsAddOrUpdateRepoPermissionsInOrgRequestBodySchema = { + permission?: string | undefined +} + +export type t_TeamsAddOrUpdateRepoPermissionsLegacyParamSchema = { + owner: string + repo: string + team_id: number +} + +export type t_TeamsAddOrUpdateRepoPermissionsLegacyRequestBodySchema = { + permission?: ("pull" | "push" | "admin") | undefined +} + +export type t_TeamsCheckPermissionsForProjectInOrgParamSchema = { + org: string + project_id: number + team_slug: string +} + +export type t_TeamsCheckPermissionsForProjectLegacyParamSchema = { + project_id: number + team_id: number +} + +export type t_TeamsCheckPermissionsForRepoInOrgParamSchema = { + org: string + owner: string + repo: string + team_slug: string +} + +export type t_TeamsCheckPermissionsForRepoLegacyParamSchema = { + owner: string + repo: string + team_id: number +} + +export type t_TeamsCreateParamSchema = { + org: string +} + +export type t_TeamsCreateRequestBodySchema = { + description?: string | undefined + maintainers?: string[] | undefined + name: string + notification_setting?: + | ("notifications_enabled" | "notifications_disabled") + | undefined + parent_team_id?: number | undefined + permission?: ("pull" | "push") | undefined + privacy?: ("secret" | "closed") | undefined + repo_names?: string[] | undefined +} + +export type t_TeamsCreateDiscussionCommentInOrgParamSchema = { + discussion_number: number + org: string + team_slug: string +} + +export type t_TeamsCreateDiscussionCommentInOrgRequestBodySchema = { + body: string +} + +export type t_TeamsCreateDiscussionCommentLegacyParamSchema = { + discussion_number: number + team_id: number +} + +export type t_TeamsCreateDiscussionCommentLegacyRequestBodySchema = { + body: string +} + +export type t_TeamsCreateDiscussionInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsCreateDiscussionInOrgRequestBodySchema = { + body: string + private?: boolean | undefined + title: string +} + +export type t_TeamsCreateDiscussionLegacyParamSchema = { + team_id: number +} + +export type t_TeamsCreateDiscussionLegacyRequestBodySchema = { + body: string + private?: boolean | undefined + title: string +} + +export type t_TeamsDeleteDiscussionCommentInOrgParamSchema = { + comment_number: number + discussion_number: number + org: string + team_slug: string +} + +export type t_TeamsDeleteDiscussionCommentLegacyParamSchema = { + comment_number: number + discussion_number: number + team_id: number +} + +export type t_TeamsDeleteDiscussionInOrgParamSchema = { + discussion_number: number + org: string + team_slug: string +} + +export type t_TeamsDeleteDiscussionLegacyParamSchema = { + discussion_number: number + team_id: number +} + +export type t_TeamsDeleteInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsDeleteLegacyParamSchema = { + team_id: number +} + +export type t_TeamsGetByNameParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsGetDiscussionCommentInOrgParamSchema = { + comment_number: number + discussion_number: number + org: string + team_slug: string +} + +export type t_TeamsGetDiscussionCommentLegacyParamSchema = { + comment_number: number + discussion_number: number + team_id: number +} + +export type t_TeamsGetDiscussionInOrgParamSchema = { + discussion_number: number + org: string + team_slug: string +} + +export type t_TeamsGetDiscussionLegacyParamSchema = { + discussion_number: number + team_id: number +} + +export type t_TeamsGetLegacyParamSchema = { + team_id: number +} + +export type t_TeamsGetMemberLegacyParamSchema = { + team_id: number + username: string +} + +export type t_TeamsGetMembershipForUserInOrgParamSchema = { + org: string + team_slug: string + username: string +} + +export type t_TeamsGetMembershipForUserLegacyParamSchema = { + team_id: number + username: string +} + +export type t_TeamsListParamSchema = { + org: string +} + +export type t_TeamsListQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListChildInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsListChildInOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListChildLegacyParamSchema = { + team_id: number +} + +export type t_TeamsListChildLegacyQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListDiscussionCommentsInOrgParamSchema = { + discussion_number: number + org: string + team_slug: string +} + +export type t_TeamsListDiscussionCommentsInOrgQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListDiscussionCommentsLegacyParamSchema = { + discussion_number: number + team_id: number +} + +export type t_TeamsListDiscussionCommentsLegacyQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListDiscussionsInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsListDiscussionsInOrgQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined + pinned?: string | undefined +} + +export type t_TeamsListDiscussionsLegacyParamSchema = { + team_id: number +} + +export type t_TeamsListDiscussionsLegacyQuerySchema = { + direction?: ("asc" | "desc") | undefined + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListMembersInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsListMembersInOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined + role?: ("member" | "maintainer" | "all") | undefined +} + +export type t_TeamsListMembersLegacyParamSchema = { + team_id: number +} + +export type t_TeamsListMembersLegacyQuerySchema = { + page?: number | undefined + per_page?: number | undefined + role?: ("member" | "maintainer" | "all") | undefined +} + +export type t_TeamsListPendingInvitationsInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsListPendingInvitationsInOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListPendingInvitationsLegacyParamSchema = { + team_id: number +} + +export type t_TeamsListPendingInvitationsLegacyQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListProjectsInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsListProjectsInOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListProjectsLegacyParamSchema = { + team_id: number +} + +export type t_TeamsListProjectsLegacyQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListReposInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsListReposInOrgQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsListReposLegacyParamSchema = { + team_id: number +} + +export type t_TeamsListReposLegacyQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_TeamsRemoveMemberLegacyParamSchema = { + team_id: number + username: string +} + +export type t_TeamsRemoveMembershipForUserInOrgParamSchema = { + org: string + team_slug: string + username: string +} + +export type t_TeamsRemoveMembershipForUserLegacyParamSchema = { + team_id: number + username: string +} + +export type t_TeamsRemoveProjectInOrgParamSchema = { + org: string + project_id: number + team_slug: string +} + +export type t_TeamsRemoveProjectLegacyParamSchema = { + project_id: number + team_id: number +} + +export type t_TeamsRemoveRepoInOrgParamSchema = { + org: string + owner: string + repo: string + team_slug: string +} + +export type t_TeamsRemoveRepoLegacyParamSchema = { + owner: string + repo: string + team_id: number +} + +export type t_TeamsUpdateDiscussionCommentInOrgParamSchema = { + comment_number: number + discussion_number: number + org: string + team_slug: string +} + +export type t_TeamsUpdateDiscussionCommentInOrgRequestBodySchema = { + body: string +} + +export type t_TeamsUpdateDiscussionCommentLegacyParamSchema = { + comment_number: number + discussion_number: number + team_id: number +} + +export type t_TeamsUpdateDiscussionCommentLegacyRequestBodySchema = { + body: string +} + +export type t_TeamsUpdateDiscussionInOrgParamSchema = { + discussion_number: number + org: string + team_slug: string +} + +export type t_TeamsUpdateDiscussionInOrgRequestBodySchema = { + body?: string | undefined + title?: string | undefined +} + +export type t_TeamsUpdateDiscussionLegacyParamSchema = { + discussion_number: number + team_id: number +} + +export type t_TeamsUpdateDiscussionLegacyRequestBodySchema = { + body?: string | undefined + title?: string | undefined +} + +export type t_TeamsUpdateInOrgParamSchema = { + org: string + team_slug: string +} + +export type t_TeamsUpdateInOrgRequestBodySchema = { + description?: string | undefined + name?: string | undefined + notification_setting?: + | ("notifications_enabled" | "notifications_disabled") + | undefined + parent_team_id?: (number | null) | undefined + permission?: ("pull" | "push" | "admin") | undefined + privacy?: ("secret" | "closed") | undefined +} + +export type t_TeamsUpdateLegacyParamSchema = { + team_id: number +} + +export type t_TeamsUpdateLegacyRequestBodySchema = { + description?: string | undefined + name: string + notification_setting?: + | ("notifications_enabled" | "notifications_disabled") + | undefined + parent_team_id?: (number | null) | undefined + permission?: ("pull" | "push" | "admin") | undefined + privacy?: ("secret" | "closed") | undefined +} + +export type t_UsersAddEmailForAuthenticatedUserRequestBodySchema = + | { + emails: string[] + } + | string[] + | string + +export type t_UsersAddSocialAccountForAuthenticatedUserRequestBodySchema = { + account_urls: string[] +} + +export type t_UsersBlockParamSchema = { + username: string +} + +export type t_UsersCheckBlockedParamSchema = { + username: string +} + +export type t_UsersCheckFollowingForUserParamSchema = { + target_user: string + username: string +} + +export type t_UsersCheckPersonIsFollowedByAuthenticatedParamSchema = { + username: string +} + +export type t_UsersCreateGpgKeyForAuthenticatedUserRequestBodySchema = { + armored_public_key: string + name?: string | undefined +} + +export type t_UsersCreatePublicSshKeyForAuthenticatedUserRequestBodySchema = { + key: string + title?: string | undefined +} + +export type t_UsersCreateSshSigningKeyForAuthenticatedUserRequestBodySchema = { + key: string + title?: string | undefined +} + +export type t_UsersDeleteEmailForAuthenticatedUserRequestBodySchema = + | { + emails: string[] + } + | string[] + | string + +export type t_UsersDeleteGpgKeyForAuthenticatedUserParamSchema = { + gpg_key_id: number +} + +export type t_UsersDeletePublicSshKeyForAuthenticatedUserParamSchema = { + key_id: number +} + +export type t_UsersDeleteSocialAccountForAuthenticatedUserRequestBodySchema = { + account_urls: string[] +} + +export type t_UsersDeleteSshSigningKeyForAuthenticatedUserParamSchema = { + ssh_signing_key_id: number +} + +export type t_UsersFollowParamSchema = { + username: string +} + +export type t_UsersGetByIdParamSchema = { + account_id: number +} + +export type t_UsersGetByUsernameParamSchema = { + username: string +} + +export type t_UsersGetContextForUserParamSchema = { + username: string +} + +export type t_UsersGetContextForUserQuerySchema = { + subject_id?: string | undefined + subject_type?: + | ("organization" | "repository" | "issue" | "pull_request") + | undefined +} + +export type t_UsersGetGpgKeyForAuthenticatedUserParamSchema = { + gpg_key_id: number +} + +export type t_UsersGetPublicSshKeyForAuthenticatedUserParamSchema = { + key_id: number +} + +export type t_UsersGetSshSigningKeyForAuthenticatedUserParamSchema = { + ssh_signing_key_id: number +} + +export type t_UsersListQuerySchema = { + per_page?: number | undefined + since?: number | undefined +} + +export type t_UsersListAttestationsParamSchema = { + subject_digest: string + username: string +} + +export type t_UsersListAttestationsQuerySchema = { + after?: string | undefined + before?: string | undefined + per_page?: number | undefined + predicate_type?: string | undefined +} + +export type t_UsersListBlockedByAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListEmailsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListFollowedByAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListFollowersForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListFollowersForUserParamSchema = { + username: string +} + +export type t_UsersListFollowersForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListFollowingForUserParamSchema = { + username: string +} + +export type t_UsersListFollowingForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListGpgKeysForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListGpgKeysForUserParamSchema = { + username: string +} + +export type t_UsersListGpgKeysForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListPublicEmailsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListPublicKeysForUserParamSchema = { + username: string +} + +export type t_UsersListPublicKeysForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListPublicSshKeysForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListSocialAccountsForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListSocialAccountsForUserParamSchema = { + username: string +} + +export type t_UsersListSocialAccountsForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListSshSigningKeysForAuthenticatedUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersListSshSigningKeysForUserParamSchema = { + username: string +} + +export type t_UsersListSshSigningKeysForUserQuerySchema = { + page?: number | undefined + per_page?: number | undefined +} + +export type t_UsersSetPrimaryEmailVisibilityForAuthenticatedUserRequestBodySchema = + { + visibility: "public" | "private" + } + +export type t_UsersUnblockParamSchema = { + username: string +} + +export type t_UsersUnfollowParamSchema = { + username: string +} + +export type t_UsersUpdateAuthenticatedRequestBodySchema = { + bio?: string | undefined + blog?: string | undefined + company?: string | undefined + email?: string | undefined + hireable?: boolean | undefined + location?: string | undefined + name?: string | undefined + twitter_username?: (string | null) | undefined +} diff --git a/integration-tests/typescript-express/src/generated/api.github.com.yaml/schemas.ts b/integration-tests/typescript-express/src/generated/api.github.com.yaml/schemas.ts new file mode 100644 index 000000000..7186fbe3e --- /dev/null +++ b/integration-tests/typescript-express/src/generated/api.github.com.yaml/schemas.ts @@ -0,0 +1,8194 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { z } from "zod" + +export const PermissiveBoolean = z.preprocess((value) => { + if (typeof value === "string" && (value === "true" || value === "false")) { + return value === "true" + } else if (typeof value === "number" && (value === 1 || value === 0)) { + return value === 1 + } + return value +}, z.boolean()) + +export const s_actions_billing_usage = z.object({ + total_minutes_used: z.coerce.number(), + total_paid_minutes_used: z.coerce.number(), + included_minutes: z.coerce.number(), + minutes_used_breakdown: z.object({ + UBUNTU: z.coerce.number().optional(), + MACOS: z.coerce.number().optional(), + WINDOWS: z.coerce.number().optional(), + ubuntu_4_core: z.coerce.number().optional(), + ubuntu_8_core: z.coerce.number().optional(), + ubuntu_16_core: z.coerce.number().optional(), + ubuntu_32_core: z.coerce.number().optional(), + ubuntu_64_core: z.coerce.number().optional(), + windows_4_core: z.coerce.number().optional(), + windows_8_core: z.coerce.number().optional(), + windows_16_core: z.coerce.number().optional(), + windows_32_core: z.coerce.number().optional(), + windows_64_core: z.coerce.number().optional(), + macos_12_core: z.coerce.number().optional(), + total: z.coerce.number().optional(), + }), +}) + +export const s_actions_cache_list = z.object({ + total_count: z.coerce.number(), + actions_caches: z.array( + z.object({ + id: z.coerce.number().optional(), + ref: z.string().optional(), + key: z.string().optional(), + version: z.string().optional(), + last_accessed_at: z.string().datetime({ offset: true }).optional(), + created_at: z.string().datetime({ offset: true }).optional(), + size_in_bytes: z.coerce.number().optional(), + }), + ), +}) + +export const s_actions_cache_usage_by_repository = z.object({ + full_name: z.string(), + active_caches_size_in_bytes: z.coerce.number(), + active_caches_count: z.coerce.number(), +}) + +export const s_actions_cache_usage_org_enterprise = z.object({ + total_active_caches_count: z.coerce.number(), + total_active_caches_size_in_bytes: z.coerce.number(), +}) + +export const s_actions_can_approve_pull_request_reviews = PermissiveBoolean + +export const s_actions_default_workflow_permissions = z.enum(["read", "write"]) + +export const s_actions_enabled = PermissiveBoolean + +export const s_actions_hosted_runner_image = z.object({ + id: z.string(), + platform: z.string(), + size_gb: z.coerce.number(), + display_name: z.string(), + source: z.enum(["github", "partner", "custom"]), +}) + +export const s_actions_hosted_runner_limits = z.object({ + public_ips: z.object({ + maximum: z.coerce.number(), + current_usage: z.coerce.number(), + }), +}) + +export const s_actions_hosted_runner_machine_spec = z.object({ + id: z.string(), + cpu_cores: z.coerce.number(), + memory_gb: z.coerce.number(), + storage_gb: z.coerce.number(), +}) + +export const s_actions_public_key = z.object({ + key_id: z.string(), + key: z.string(), + id: z.coerce.number().optional(), + url: z.string().optional(), + title: z.string().optional(), + created_at: z.string().optional(), +}) + +export const s_actions_secret = z.object({ + name: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_actions_variable = z.object({ + name: z.string(), + value: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_actions_workflow_access_to_repository = z.object({ + access_level: z.enum(["none", "user", "organization"]), +}) + +export const s_actor = z.object({ + id: z.coerce.number(), + login: z.string(), + display_login: z.string().optional(), + gravatar_id: z.string().nullable(), + url: z.string(), + avatar_url: z.string(), +}) + +export const s_alert_auto_dismissed_at = z + .string() + .datetime({ offset: true }) + .nullable() + +export const s_alert_created_at = z.string().datetime({ offset: true }) + +export const s_alert_dismissed_at = z + .string() + .datetime({ offset: true }) + .nullable() + +export const s_alert_fixed_at = z.string().datetime({ offset: true }).nullable() + +export const s_alert_html_url = z.string() + +export const s_alert_instances_url = z.string() + +export const s_alert_number = z.coerce.number() + +export const s_alert_updated_at = z.string().datetime({ offset: true }) + +export const s_alert_url = z.string() + +export const s_allowed_actions = z.enum(["all", "local_only", "selected"]) + +export const s_api_insights_route_stats = z.array( + z.object({ + http_method: z.string().optional(), + api_route: z.string().optional(), + total_request_count: z.coerce.number().optional(), + rate_limited_request_count: z.coerce.number().optional(), + last_rate_limited_timestamp: z.string().nullable().optional(), + last_request_timestamp: z.string().optional(), + }), +) + +export const s_api_insights_subject_stats = z.array( + z.object({ + subject_type: z.string().optional(), + subject_name: z.string().optional(), + subject_id: z.coerce.number().optional(), + total_request_count: z.coerce.number().optional(), + rate_limited_request_count: z.coerce.number().optional(), + last_rate_limited_timestamp: z.string().nullable().optional(), + last_request_timestamp: z.string().optional(), + }), +) + +export const s_api_insights_summary_stats = z.object({ + total_request_count: z.coerce.number().optional(), + rate_limited_request_count: z.coerce.number().optional(), +}) + +export const s_api_insights_time_stats = z.array( + z.object({ + timestamp: z.string().optional(), + total_request_count: z.coerce.number().optional(), + rate_limited_request_count: z.coerce.number().optional(), + }), +) + +export const s_api_insights_user_stats = z.array( + z.object({ + actor_type: z.string().optional(), + actor_name: z.string().optional(), + actor_id: z.coerce.number().optional(), + integration_id: z.coerce.number().nullable().optional(), + oauth_application_id: z.coerce.number().nullable().optional(), + total_request_count: z.coerce.number().optional(), + rate_limited_request_count: z.coerce.number().optional(), + last_rate_limited_timestamp: z.string().nullable().optional(), + last_request_timestamp: z.string().optional(), + }), +) + +export const s_api_overview = z.object({ + verifiable_password_authentication: PermissiveBoolean, + ssh_key_fingerprints: z + .object({ + SHA256_RSA: z.string().optional(), + SHA256_DSA: z.string().optional(), + SHA256_ECDSA: z.string().optional(), + SHA256_ED25519: z.string().optional(), + }) + .optional(), + ssh_keys: z.array(z.string()).optional(), + hooks: z.array(z.string()).optional(), + github_enterprise_importer: z.array(z.string()).optional(), + web: z.array(z.string()).optional(), + api: z.array(z.string()).optional(), + git: z.array(z.string()).optional(), + packages: z.array(z.string()).optional(), + pages: z.array(z.string()).optional(), + importer: z.array(z.string()).optional(), + actions: z.array(z.string()).optional(), + actions_macos: z.array(z.string()).optional(), + codespaces: z.array(z.string()).optional(), + dependabot: z.array(z.string()).optional(), + copilot: z.array(z.string()).optional(), + domains: z + .object({ + website: z.array(z.string()).optional(), + codespaces: z.array(z.string()).optional(), + copilot: z.array(z.string()).optional(), + packages: z.array(z.string()).optional(), + actions: z.array(z.string()).optional(), + actions_inbound: z + .object({ + full_domains: z.array(z.string()).optional(), + wildcard_domains: z.array(z.string()).optional(), + }) + .optional(), + artifact_attestations: z + .object({ + trust_domain: z.string().optional(), + services: z.array(z.string()).optional(), + }) + .optional(), + }) + .optional(), +}) + +export const s_app_permissions = z.object({ + actions: z.enum(["read", "write"]).optional(), + administration: z.enum(["read", "write"]).optional(), + checks: z.enum(["read", "write"]).optional(), + codespaces: z.enum(["read", "write"]).optional(), + contents: z.enum(["read", "write"]).optional(), + dependabot_secrets: z.enum(["read", "write"]).optional(), + deployments: z.enum(["read", "write"]).optional(), + environments: z.enum(["read", "write"]).optional(), + issues: z.enum(["read", "write"]).optional(), + metadata: z.enum(["read", "write"]).optional(), + packages: z.enum(["read", "write"]).optional(), + pages: z.enum(["read", "write"]).optional(), + pull_requests: z.enum(["read", "write"]).optional(), + repository_custom_properties: z.enum(["read", "write"]).optional(), + repository_hooks: z.enum(["read", "write"]).optional(), + repository_projects: z.enum(["read", "write", "admin"]).optional(), + secret_scanning_alerts: z.enum(["read", "write"]).optional(), + secrets: z.enum(["read", "write"]).optional(), + security_events: z.enum(["read", "write"]).optional(), + single_file: z.enum(["read", "write"]).optional(), + statuses: z.enum(["read", "write"]).optional(), + vulnerability_alerts: z.enum(["read", "write"]).optional(), + workflows: z.enum(["write"]).optional(), + members: z.enum(["read", "write"]).optional(), + organization_administration: z.enum(["read", "write"]).optional(), + organization_custom_roles: z.enum(["read", "write"]).optional(), + organization_custom_org_roles: z.enum(["read", "write"]).optional(), + organization_custom_properties: z.enum(["read", "write", "admin"]).optional(), + organization_copilot_seat_management: z.enum(["write"]).optional(), + organization_announcement_banners: z.enum(["read", "write"]).optional(), + organization_events: z.enum(["read"]).optional(), + organization_hooks: z.enum(["read", "write"]).optional(), + organization_personal_access_tokens: z.enum(["read", "write"]).optional(), + organization_personal_access_token_requests: z + .enum(["read", "write"]) + .optional(), + organization_plan: z.enum(["read"]).optional(), + organization_projects: z.enum(["read", "write", "admin"]).optional(), + organization_packages: z.enum(["read", "write"]).optional(), + organization_secrets: z.enum(["read", "write"]).optional(), + organization_self_hosted_runners: z.enum(["read", "write"]).optional(), + organization_user_blocking: z.enum(["read", "write"]).optional(), + team_discussions: z.enum(["read", "write"]).optional(), + email_addresses: z.enum(["read", "write"]).optional(), + followers: z.enum(["read", "write"]).optional(), + git_ssh_keys: z.enum(["read", "write"]).optional(), + gpg_keys: z.enum(["read", "write"]).optional(), + interaction_limits: z.enum(["read", "write"]).optional(), + profile: z.enum(["write"]).optional(), + starring: z.enum(["read", "write"]).optional(), +}) + +export const s_artifact = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + size_in_bytes: z.coerce.number(), + url: z.string(), + archive_download_url: z.string(), + expired: PermissiveBoolean, + created_at: z.string().datetime({ offset: true }).nullable(), + expires_at: z.string().datetime({ offset: true }).nullable(), + updated_at: z.string().datetime({ offset: true }).nullable(), + digest: z.string().nullable().optional(), + workflow_run: z + .object({ + id: z.coerce.number().optional(), + repository_id: z.coerce.number().optional(), + head_repository_id: z.coerce.number().optional(), + head_branch: z.string().optional(), + head_sha: z.string().optional(), + }) + .nullable() + .optional(), +}) + +export const s_author_association = z.enum([ + "COLLABORATOR", + "CONTRIBUTOR", + "FIRST_TIMER", + "FIRST_TIME_CONTRIBUTOR", + "MANNEQUIN", + "MEMBER", + "NONE", + "OWNER", +]) + +export const s_autolink = z.object({ + id: z.coerce.number(), + key_prefix: z.string(), + url_template: z.string(), + is_alphanumeric: PermissiveBoolean, +}) + +export const s_basic_error = z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + url: z.string().optional(), + status: z.string().optional(), +}) + +export const s_billing_usage_report = z.object({ + usageItems: z + .array( + z.object({ + date: z.string(), + product: z.string(), + sku: z.string(), + quantity: z.coerce.number(), + unitType: z.string(), + pricePerUnit: z.coerce.number(), + grossAmount: z.coerce.number(), + discountAmount: z.coerce.number(), + netAmount: z.coerce.number(), + organizationName: z.string(), + repositoryName: z.string().optional(), + }), + ) + .optional(), +}) + +export const s_blob = z.object({ + content: z.string(), + encoding: z.string(), + url: z.string(), + sha: z.string(), + size: z.coerce.number().nullable(), + node_id: z.string(), + highlighted_content: z.string().optional(), +}) + +export const s_branch_restriction_policy = z.object({ + url: z.string(), + users_url: z.string(), + teams_url: z.string(), + apps_url: z.string(), + users: z.array( + z.object({ + login: z.string().optional(), + id: z.coerce.number().optional(), + node_id: z.string().optional(), + avatar_url: z.string().optional(), + gravatar_id: z.string().optional(), + url: z.string().optional(), + html_url: z.string().optional(), + followers_url: z.string().optional(), + following_url: z.string().optional(), + gists_url: z.string().optional(), + starred_url: z.string().optional(), + subscriptions_url: z.string().optional(), + organizations_url: z.string().optional(), + repos_url: z.string().optional(), + events_url: z.string().optional(), + received_events_url: z.string().optional(), + type: z.string().optional(), + site_admin: PermissiveBoolean.optional(), + user_view_type: z.string().optional(), + }), + ), + teams: z.array( + z.object({ + id: z.coerce.number().optional(), + node_id: z.string().optional(), + url: z.string().optional(), + html_url: z.string().optional(), + name: z.string().optional(), + slug: z.string().optional(), + description: z.string().nullable().optional(), + privacy: z.string().optional(), + notification_setting: z.string().optional(), + permission: z.string().optional(), + members_url: z.string().optional(), + repositories_url: z.string().optional(), + parent: z.string().nullable().optional(), + }), + ), + apps: z.array( + z.object({ + id: z.coerce.number().optional(), + slug: z.string().optional(), + node_id: z.string().optional(), + owner: z + .object({ + login: z.string().optional(), + id: z.coerce.number().optional(), + node_id: z.string().optional(), + url: z.string().optional(), + repos_url: z.string().optional(), + events_url: z.string().optional(), + hooks_url: z.string().optional(), + issues_url: z.string().optional(), + members_url: z.string().optional(), + public_members_url: z.string().optional(), + avatar_url: z.string().optional(), + description: z.string().optional(), + gravatar_id: z.string().optional(), + html_url: z.string().optional(), + followers_url: z.string().optional(), + following_url: z.string().optional(), + gists_url: z.string().optional(), + starred_url: z.string().optional(), + subscriptions_url: z.string().optional(), + organizations_url: z.string().optional(), + received_events_url: z.string().optional(), + type: z.string().optional(), + site_admin: PermissiveBoolean.optional(), + user_view_type: z.string().optional(), + }) + .optional(), + name: z.string().optional(), + client_id: z.string().optional(), + description: z.string().optional(), + external_url: z.string().optional(), + html_url: z.string().optional(), + created_at: z.string().optional(), + updated_at: z.string().optional(), + permissions: z + .object({ + metadata: z.string().optional(), + contents: z.string().optional(), + issues: z.string().optional(), + single_file: z.string().optional(), + }) + .optional(), + events: z.array(z.string()).optional(), + }), + ), +}) + +export const s_branch_short = z.object({ + name: z.string(), + commit: z.object({ sha: z.string(), url: z.string() }), + protected: PermissiveBoolean, +}) + +export const s_campaign_state = z.enum(["open", "closed"]) + +export const s_check_annotation = z.object({ + path: z.string(), + start_line: z.coerce.number(), + end_line: z.coerce.number(), + start_column: z.coerce.number().nullable(), + end_column: z.coerce.number().nullable(), + annotation_level: z.string().nullable(), + title: z.string().nullable(), + message: z.string().nullable(), + raw_details: z.string().nullable(), + blob_href: z.string(), +}) + +export const s_check_automated_security_fixes = z.object({ + enabled: PermissiveBoolean, + paused: PermissiveBoolean, +}) + +export const s_classroom_assignment_grade = z.object({ + assignment_name: z.string(), + assignment_url: z.string(), + starter_code_url: z.string(), + github_username: z.string(), + roster_identifier: z.string(), + student_repository_name: z.string(), + student_repository_url: z.string(), + submission_timestamp: z.string(), + points_awarded: z.coerce.number(), + points_available: z.coerce.number(), + group_name: z.string().optional(), +}) + +export const s_code_frequency_stat = z.array(z.coerce.number()) + +export const s_code_of_conduct = z.object({ + key: z.string(), + name: z.string(), + url: z.string(), + body: z.string().optional(), + html_url: z.string().nullable(), +}) + +export const s_code_of_conduct_simple = z.object({ + url: z.string(), + key: z.string(), + name: z.string(), + html_url: z.string().nullable(), +}) + +export const s_code_scanning_alert_classification = z + .enum(["source", "generated", "test", "library"]) + .nullable() + +export const s_code_scanning_alert_create_request = PermissiveBoolean + +export const s_code_scanning_alert_dismissed_comment = z + .string() + .max(280) + .nullable() + +export const s_code_scanning_alert_dismissed_reason = z + .enum(["false positive", "won't fix", "used in tests"]) + .nullable() + +export const s_code_scanning_alert_environment = z.string() + +export const s_code_scanning_alert_location = z.object({ + path: z.string().optional(), + start_line: z.coerce.number().optional(), + end_line: z.coerce.number().optional(), + start_column: z.coerce.number().optional(), + end_column: z.coerce.number().optional(), +}) + +export const s_code_scanning_alert_rule = z.object({ + id: z.string().nullable().optional(), + name: z.string().optional(), + severity: z.enum(["none", "note", "warning", "error"]).nullable().optional(), + security_severity_level: z + .enum(["low", "medium", "high", "critical"]) + .nullable() + .optional(), + description: z.string().optional(), + full_description: z.string().optional(), + tags: z.array(z.string()).nullable().optional(), + help: z.string().nullable().optional(), + help_uri: z.string().nullable().optional(), +}) + +export const s_code_scanning_alert_rule_summary = z.object({ + id: z.string().nullable().optional(), + name: z.string().optional(), + severity: z.enum(["none", "note", "warning", "error"]).nullable().optional(), + security_severity_level: z + .enum(["low", "medium", "high", "critical"]) + .nullable() + .optional(), + description: z.string().optional(), + full_description: z.string().optional(), + tags: z.array(z.string()).nullable().optional(), + help: z.string().nullable().optional(), + help_uri: z.string().nullable().optional(), +}) + +export const s_code_scanning_alert_set_state = z.enum(["open", "dismissed"]) + +export const s_code_scanning_alert_severity = z.enum([ + "critical", + "high", + "medium", + "low", + "warning", + "note", + "error", +]) + +export const s_code_scanning_alert_state = z + .enum(["open", "dismissed", "fixed"]) + .nullable() + +export const s_code_scanning_alert_state_query = z.enum([ + "open", + "closed", + "dismissed", + "fixed", +]) + +export const s_code_scanning_analysis_analysis_key = z.string() + +export const s_code_scanning_analysis_category = z.string() + +export const s_code_scanning_analysis_commit_sha = z + .string() + .min(40) + .max(40) + .regex(new RegExp("^[0-9a-fA-F]+$")) + +export const s_code_scanning_analysis_created_at = z + .string() + .datetime({ offset: true }) + +export const s_code_scanning_analysis_deletion = z.object({ + next_analysis_url: z.string().nullable(), + confirm_delete_url: z.string().nullable(), +}) + +export const s_code_scanning_analysis_environment = z.string() + +export const s_code_scanning_analysis_sarif_file = z.string() + +export const s_code_scanning_analysis_sarif_id = z.string() + +export const s_code_scanning_analysis_tool_guid = z.string().nullable() + +export const s_code_scanning_analysis_tool_name = z.string() + +export const s_code_scanning_analysis_tool_version = z.string().nullable() + +export const s_code_scanning_analysis_url = z.string() + +export const s_code_scanning_autofix_commits = z + .object({ target_ref: z.string().optional(), message: z.string().optional() }) + .nullable() + +export const s_code_scanning_autofix_commits_response = z.object({ + target_ref: z.string().optional(), + sha: z.string().optional(), +}) + +export const s_code_scanning_autofix_description = z.string().nullable() + +export const s_code_scanning_autofix_started_at = z + .string() + .datetime({ offset: true }) + +export const s_code_scanning_autofix_status = z.enum([ + "pending", + "error", + "success", + "outdated", +]) + +export const s_code_scanning_default_setup = z.object({ + state: z.enum(["configured", "not-configured"]).optional(), + languages: z + .array( + z.enum([ + "actions", + "c-cpp", + "csharp", + "go", + "java-kotlin", + "javascript-typescript", + "javascript", + "python", + "ruby", + "typescript", + "swift", + ]), + ) + .optional(), + runner_type: z.enum(["standard", "labeled"]).nullable().optional(), + runner_label: z.string().nullable().optional(), + query_suite: z.enum(["default", "extended"]).optional(), + updated_at: z.string().datetime({ offset: true }).nullable().optional(), + schedule: z.enum(["weekly"]).nullable().optional(), +}) + +export const s_code_scanning_default_setup_options = z + .object({ + runner_type: z.enum(["standard", "labeled", "not_set"]).optional(), + runner_label: z.string().nullable().optional(), + }) + .nullable() + +export const s_code_scanning_default_setup_update = z.object({ + state: z.enum(["configured", "not-configured"]).optional(), + runner_type: z.enum(["standard", "labeled"]).optional(), + runner_label: z.string().nullable().optional(), + query_suite: z.enum(["default", "extended"]).optional(), + languages: z + .array( + z.enum([ + "actions", + "c-cpp", + "csharp", + "go", + "java-kotlin", + "javascript-typescript", + "python", + "ruby", + "swift", + ]), + ) + .optional(), +}) + +export const s_code_scanning_default_setup_update_response = z.object({ + run_id: z.coerce.number().optional(), + run_url: z.string().optional(), +}) + +export const s_code_scanning_ref = z.string() + +export const s_code_scanning_ref_full = z + .string() + .regex(new RegExp("^refs/(heads|tags|pull)/.*$")) + +export const s_code_scanning_sarifs_status = z.object({ + processing_status: z.enum(["pending", "complete", "failed"]).optional(), + analyses_url: z.string().nullable().optional(), + errors: z.array(z.string()).nullable().optional(), +}) + +export const s_code_scanning_variant_analysis_language = z.enum([ + "cpp", + "csharp", + "go", + "java", + "javascript", + "python", + "ruby", + "rust", + "swift", +]) + +export const s_code_scanning_variant_analysis_repository = z.object({ + id: z.coerce.number(), + name: z.string(), + full_name: z.string(), + private: PermissiveBoolean, + stargazers_count: z.coerce.number(), + updated_at: z.string().datetime({ offset: true }).nullable(), +}) + +export const s_code_scanning_variant_analysis_status = z.enum([ + "pending", + "in_progress", + "succeeded", + "failed", + "canceled", + "timed_out", +]) + +export const s_code_security_configuration = z.object({ + id: z.coerce.number().optional(), + name: z.string().optional(), + target_type: z.enum(["global", "organization", "enterprise"]).optional(), + description: z.string().optional(), + advanced_security: z + .enum(["enabled", "disabled", "code_security", "secret_protection"]) + .optional(), + dependency_graph: z.enum(["enabled", "disabled", "not_set"]).optional(), + dependency_graph_autosubmit_action: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + dependency_graph_autosubmit_action_options: z + .object({ labeled_runners: PermissiveBoolean.optional() }) + .optional(), + dependabot_alerts: z.enum(["enabled", "disabled", "not_set"]).optional(), + dependabot_security_updates: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + code_scanning_default_setup: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + code_scanning_default_setup_options: z + .object({ + runner_type: z + .enum(["standard", "labeled", "not_set"]) + .nullable() + .optional(), + runner_label: z.string().nullable().optional(), + }) + .nullable() + .optional(), + code_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning: z.enum(["enabled", "disabled", "not_set"]).optional(), + secret_scanning_push_protection: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_delegated_bypass: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_delegated_bypass_options: z + .object({ + reviewers: z + .array( + z.object({ + reviewer_id: z.coerce.number(), + reviewer_type: z.enum(["TEAM", "ROLE"]), + }), + ) + .optional(), + }) + .optional(), + secret_scanning_validity_checks: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_non_provider_patterns: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_generic_secrets: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + secret_scanning_delegated_alert_dismissal: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + private_vulnerability_reporting: z + .enum(["enabled", "disabled", "not_set"]) + .optional(), + enforcement: z.enum(["enforced", "unenforced"]).optional(), + url: z.string().optional(), + html_url: z.string().optional(), + created_at: z.string().datetime({ offset: true }).optional(), + updated_at: z.string().datetime({ offset: true }).optional(), +}) + +export const s_code_security_default_configurations = z.array( + z.object({ + default_for_new_repos: z.object({}).optional(), + configuration: s_code_security_configuration.optional(), + }), +) + +export const s_codeowners_errors = z.object({ + errors: z.array( + z.object({ + line: z.coerce.number(), + column: z.coerce.number(), + source: z.string().optional(), + kind: z.string(), + suggestion: z.string().nullable().optional(), + message: z.string(), + path: z.string(), + }), + ), +}) + +export const s_codespace_export_details = z.object({ + state: z.string().nullable().optional(), + completed_at: z.string().datetime({ offset: true }).nullable().optional(), + branch: z.string().nullable().optional(), + sha: z.string().nullable().optional(), + id: z.string().optional(), + export_url: z.string().optional(), + html_url: z.string().nullable().optional(), +}) + +export const s_codespace_machine = z.object({ + name: z.string(), + display_name: z.string(), + operating_system: z.string(), + storage_in_bytes: z.coerce.number(), + memory_in_bytes: z.coerce.number(), + cpus: z.coerce.number(), + prebuild_availability: z.enum(["none", "ready", "in_progress"]).nullable(), +}) + +export const s_codespaces_org_secret = z.object({ + name: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + visibility: z.enum(["all", "private", "selected"]), + selected_repositories_url: z.string().optional(), +}) + +export const s_codespaces_permissions_check_for_devcontainer = z.object({ + accepted: PermissiveBoolean, +}) + +export const s_codespaces_public_key = z.object({ + key_id: z.string(), + key: z.string(), + id: z.coerce.number().optional(), + url: z.string().optional(), + title: z.string().optional(), + created_at: z.string().optional(), +}) + +export const s_codespaces_secret = z.object({ + name: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + visibility: z.enum(["all", "private", "selected"]), + selected_repositories_url: z.string(), +}) + +export const s_codespaces_user_public_key = z.object({ + key_id: z.string(), + key: z.string(), +}) + +export const s_collaborator = z.object({ + login: z.string(), + id: z.coerce.number(), + email: z.string().nullable().optional(), + name: z.string().nullable().optional(), + node_id: z.string(), + avatar_url: z.string(), + gravatar_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + followers_url: z.string(), + following_url: z.string(), + gists_url: z.string(), + starred_url: z.string(), + subscriptions_url: z.string(), + organizations_url: z.string(), + repos_url: z.string(), + events_url: z.string(), + received_events_url: z.string(), + type: z.string(), + site_admin: PermissiveBoolean, + permissions: z + .object({ + pull: PermissiveBoolean, + triage: PermissiveBoolean.optional(), + push: PermissiveBoolean, + maintain: PermissiveBoolean.optional(), + admin: PermissiveBoolean, + }) + .optional(), + role_name: z.string(), + user_view_type: z.string().optional(), +}) + +export const s_combined_billing_usage = z.object({ + days_left_in_billing_cycle: z.coerce.number(), + estimated_paid_storage_for_month: z.coerce.number(), + estimated_storage_for_month: z.coerce.number(), +}) + +export const s_commit_activity = z.object({ + days: z.array(z.coerce.number()), + total: z.coerce.number(), + week: z.coerce.number(), +}) + +export const s_content_directory = z.array( + z.object({ + type: z.enum(["dir", "file", "submodule", "symlink"]), + size: z.coerce.number(), + name: z.string(), + path: z.string(), + content: z.string().optional(), + sha: z.string(), + url: z.string(), + git_url: z.string().nullable(), + html_url: z.string().nullable(), + download_url: z.string().nullable(), + _links: z.object({ + git: z.string().nullable(), + html: z.string().nullable(), + self: z.string(), + }), + }), +) + +export const s_content_file = z.object({ + type: z.enum(["file"]), + encoding: z.string(), + size: z.coerce.number(), + name: z.string(), + path: z.string(), + content: z.string(), + sha: z.string(), + url: z.string(), + git_url: z.string().nullable(), + html_url: z.string().nullable(), + download_url: z.string().nullable(), + _links: z.object({ + git: z.string().nullable(), + html: z.string().nullable(), + self: z.string(), + }), + target: z.string().optional(), + submodule_git_url: z.string().optional(), +}) + +export const s_content_submodule = z.object({ + type: z.enum(["submodule"]), + submodule_git_url: z.string(), + size: z.coerce.number(), + name: z.string(), + path: z.string(), + sha: z.string(), + url: z.string(), + git_url: z.string().nullable(), + html_url: z.string().nullable(), + download_url: z.string().nullable(), + _links: z.object({ + git: z.string().nullable(), + html: z.string().nullable(), + self: z.string(), + }), +}) + +export const s_content_symlink = z.object({ + type: z.enum(["symlink"]), + target: z.string(), + size: z.coerce.number(), + name: z.string(), + path: z.string(), + sha: z.string(), + url: z.string(), + git_url: z.string().nullable(), + html_url: z.string().nullable(), + download_url: z.string().nullable(), + _links: z.object({ + git: z.string().nullable(), + html: z.string().nullable(), + self: z.string(), + }), +}) + +export const s_content_traffic = z.object({ + path: z.string(), + title: z.string(), + count: z.coerce.number(), + uniques: z.coerce.number(), +}) + +export const s_contributor = z.object({ + login: z.string().optional(), + id: z.coerce.number().optional(), + node_id: z.string().optional(), + avatar_url: z.string().optional(), + gravatar_id: z.string().nullable().optional(), + url: z.string().optional(), + html_url: z.string().optional(), + followers_url: z.string().optional(), + following_url: z.string().optional(), + gists_url: z.string().optional(), + starred_url: z.string().optional(), + subscriptions_url: z.string().optional(), + organizations_url: z.string().optional(), + repos_url: z.string().optional(), + events_url: z.string().optional(), + received_events_url: z.string().optional(), + type: z.string(), + site_admin: PermissiveBoolean.optional(), + contributions: z.coerce.number(), + email: z.string().optional(), + name: z.string().optional(), + user_view_type: z.string().optional(), +}) + +export const s_copilot_dotcom_chat = z + .intersection( + z.object({ + total_engaged_users: z.coerce.number().optional(), + models: z + .array( + z.object({ + name: z.string().optional(), + is_custom_model: PermissiveBoolean.optional(), + custom_model_training_date: z.string().nullable().optional(), + total_engaged_users: z.coerce.number().optional(), + total_chats: z.coerce.number().optional(), + }), + ) + .optional(), + }), + z.record(z.unknown()), + ) + .nullable() + +export const s_copilot_dotcom_pull_requests = z + .intersection( + z.object({ + total_engaged_users: z.coerce.number().optional(), + repositories: z + .array( + z.object({ + name: z.string().optional(), + total_engaged_users: z.coerce.number().optional(), + models: z + .array( + z.object({ + name: z.string().optional(), + is_custom_model: PermissiveBoolean.optional(), + custom_model_training_date: z.string().nullable().optional(), + total_pr_summaries_created: z.coerce.number().optional(), + total_engaged_users: z.coerce.number().optional(), + }), + ) + .optional(), + }), + ) + .optional(), + }), + z.record(z.unknown()), + ) + .nullable() + +export const s_copilot_ide_chat = z + .intersection( + z.object({ + total_engaged_users: z.coerce.number().optional(), + editors: z + .array( + z.object({ + name: z.string().optional(), + total_engaged_users: z.coerce.number().optional(), + models: z + .array( + z.object({ + name: z.string().optional(), + is_custom_model: PermissiveBoolean.optional(), + custom_model_training_date: z.string().nullable().optional(), + total_engaged_users: z.coerce.number().optional(), + total_chats: z.coerce.number().optional(), + total_chat_insertion_events: z.coerce.number().optional(), + total_chat_copy_events: z.coerce.number().optional(), + }), + ) + .optional(), + }), + ) + .optional(), + }), + z.record(z.unknown()), + ) + .nullable() + +export const s_copilot_ide_code_completions = z + .intersection( + z.object({ + total_engaged_users: z.coerce.number().optional(), + languages: z + .array( + z.object({ + name: z.string().optional(), + total_engaged_users: z.coerce.number().optional(), + }), + ) + .optional(), + editors: z + .array( + z.intersection( + z.object({ + name: z.string().optional(), + total_engaged_users: z.coerce.number().optional(), + models: z + .array( + z.object({ + name: z.string().optional(), + is_custom_model: PermissiveBoolean.optional(), + custom_model_training_date: z + .string() + .nullable() + .optional(), + total_engaged_users: z.coerce.number().optional(), + languages: z + .array( + z.object({ + name: z.string().optional(), + total_engaged_users: z.coerce.number().optional(), + total_code_suggestions: z.coerce.number().optional(), + total_code_acceptances: z.coerce.number().optional(), + total_code_lines_suggested: z.coerce + .number() + .optional(), + total_code_lines_accepted: z.coerce + .number() + .optional(), + }), + ) + .optional(), + }), + ) + .optional(), + }), + z.record(z.unknown()), + ), + ) + .optional(), + }), + z.record(z.unknown()), + ) + .nullable() + +export const s_copilot_organization_seat_breakdown = z.object({ + total: z.coerce.number().optional(), + added_this_cycle: z.coerce.number().optional(), + pending_cancellation: z.coerce.number().optional(), + pending_invitation: z.coerce.number().optional(), + active_this_cycle: z.coerce.number().optional(), + inactive_this_cycle: z.coerce.number().optional(), +}) + +export const s_custom_deployment_rule_app = z.object({ + id: z.coerce.number(), + slug: z.string(), + integration_url: z.string(), + node_id: z.string(), +}) + +export const s_custom_property = z.object({ + property_name: z.string(), + url: z.string().optional(), + source_type: z.enum(["organization", "enterprise"]).optional(), + value_type: z.enum(["string", "single_select", "multi_select", "true_false"]), + required: PermissiveBoolean.optional(), + default_value: z + .union([z.string(), z.array(z.string())]) + .nullable() + .optional(), + description: z.string().nullable().optional(), + allowed_values: z.array(z.string().max(75)).max(200).nullable().optional(), + values_editable_by: z + .enum(["org_actors", "org_and_repo_actors"]) + .nullable() + .optional(), +}) + +export const s_custom_property_set_payload = z.object({ + value_type: z.enum(["string", "single_select", "multi_select", "true_false"]), + required: PermissiveBoolean.optional(), + default_value: z + .union([z.string(), z.array(z.string())]) + .nullable() + .optional(), + description: z.string().nullable().optional(), + allowed_values: z.array(z.string().max(75)).max(200).nullable().optional(), + values_editable_by: z + .enum(["org_actors", "org_and_repo_actors"]) + .nullable() + .optional(), +}) + +export const s_custom_property_value = z.object({ + property_name: z.string(), + value: z.union([z.string(), z.array(z.string())]).nullable(), +}) + +export const s_cvss_severities = z + .object({ + cvss_v3: z + .object({ + vector_string: z.string().nullable(), + score: z.coerce.number().min(0).max(10).nullable(), + }) + .nullable() + .optional(), + cvss_v4: z + .object({ + vector_string: z.string().nullable(), + score: z.coerce.number().min(0).max(10).nullable(), + }) + .nullable() + .optional(), + }) + .nullable() + +export const s_dependabot_alert_package = z.object({ + ecosystem: z.string(), + name: z.string(), +}) + +export const s_dependabot_public_key = z.object({ + key_id: z.string(), + key: z.string(), +}) + +export const s_dependabot_secret = z.object({ + name: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_dependency_graph_diff = z.array( + z.object({ + change_type: z.enum(["added", "removed"]), + manifest: z.string(), + ecosystem: z.string(), + name: z.string(), + version: z.string(), + package_url: z.string().nullable(), + license: z.string().nullable(), + source_repository_url: z.string().nullable(), + vulnerabilities: z.array( + z.object({ + severity: z.string(), + advisory_ghsa_id: z.string(), + advisory_summary: z.string(), + advisory_url: z.string(), + }), + ), + scope: z.enum(["unknown", "runtime", "development"]), + }), +) + +export const s_dependency_graph_spdx_sbom = z.object({ + sbom: z.object({ + SPDXID: z.string(), + spdxVersion: z.string(), + comment: z.string().optional(), + creationInfo: z.object({ + created: z.string(), + creators: z.array(z.string()), + }), + name: z.string(), + dataLicense: z.string(), + documentNamespace: z.string(), + packages: z.array( + z.object({ + SPDXID: z.string().optional(), + name: z.string().optional(), + versionInfo: z.string().optional(), + downloadLocation: z.string().optional(), + filesAnalyzed: PermissiveBoolean.optional(), + licenseConcluded: z.string().optional(), + licenseDeclared: z.string().optional(), + supplier: z.string().optional(), + copyrightText: z.string().optional(), + externalRefs: z + .array( + z.object({ + referenceCategory: z.string(), + referenceLocator: z.string(), + referenceType: z.string(), + }), + ) + .optional(), + }), + ), + relationships: z + .array( + z.object({ + relationshipType: z.string().optional(), + spdxElementId: z.string().optional(), + relatedSpdxElement: z.string().optional(), + }), + ) + .optional(), + }), +}) + +export const s_deploy_key = z.object({ + id: z.coerce.number(), + key: z.string(), + url: z.string(), + title: z.string(), + verified: PermissiveBoolean, + created_at: z.string(), + read_only: PermissiveBoolean, + added_by: z.string().nullable().optional(), + last_used: z.string().nullable().optional(), + enabled: PermissiveBoolean.optional(), +}) + +export const s_deployment_branch_policy = z.object({ + id: z.coerce.number().optional(), + node_id: z.string().optional(), + name: z.string().optional(), + type: z.enum(["branch", "tag"]).optional(), +}) + +export const s_deployment_branch_policy_name_pattern = z.object({ + name: z.string(), +}) + +export const s_deployment_branch_policy_name_pattern_with_type = z.object({ + name: z.string(), + type: z.enum(["branch", "tag"]).optional(), +}) + +export const s_deployment_branch_policy_settings = z + .object({ + protected_branches: PermissiveBoolean, + custom_branch_policies: PermissiveBoolean, + }) + .nullable() + +export const s_deployment_reviewer_type = z.enum(["User", "Team"]) + +export const s_diff_entry = z.object({ + sha: z.string(), + filename: z.string(), + status: z.enum([ + "added", + "removed", + "modified", + "renamed", + "copied", + "changed", + "unchanged", + ]), + additions: z.coerce.number(), + deletions: z.coerce.number(), + changes: z.coerce.number(), + blob_url: z.string(), + raw_url: z.string(), + contents_url: z.string(), + patch: z.string().optional(), + previous_filename: z.string().optional(), +}) + +export const s_email = z.object({ + email: z.string().email(), + primary: PermissiveBoolean, + verified: PermissiveBoolean, + visibility: z.string().nullable(), +}) + +export const s_empty_object = z.object({}) + +export const s_enabled_repositories = z.enum(["all", "none", "selected"]) + +export const s_enterprise = z.object({ + description: z.string().nullable().optional(), + html_url: z.string(), + website_url: z.string().nullable().optional(), + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + slug: z.string(), + created_at: z.string().datetime({ offset: true }).nullable(), + updated_at: z.string().datetime({ offset: true }).nullable(), + avatar_url: z.string(), +}) + +export const s_enterprise_team = z.object({ + id: z.coerce.number(), + name: z.string(), + slug: z.string(), + url: z.string(), + sync_to_organizations: z.string(), + group_id: z.string().nullable().optional(), + group_name: z.string().nullable().optional(), + html_url: z.string(), + members_url: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_file_commit = z.object({ + content: z + .object({ + name: z.string().optional(), + path: z.string().optional(), + sha: z.string().optional(), + size: z.coerce.number().optional(), + url: z.string().optional(), + html_url: z.string().optional(), + git_url: z.string().optional(), + download_url: z.string().optional(), + type: z.string().optional(), + _links: z + .object({ + self: z.string().optional(), + git: z.string().optional(), + html: z.string().optional(), + }) + .optional(), + }) + .nullable(), + commit: z.object({ + sha: z.string().optional(), + node_id: z.string().optional(), + url: z.string().optional(), + html_url: z.string().optional(), + author: z + .object({ + date: z.string().optional(), + name: z.string().optional(), + email: z.string().optional(), + }) + .optional(), + committer: z + .object({ + date: z.string().optional(), + name: z.string().optional(), + email: z.string().optional(), + }) + .optional(), + message: z.string().optional(), + tree: z + .object({ url: z.string().optional(), sha: z.string().optional() }) + .optional(), + parents: z + .array( + z.object({ + url: z.string().optional(), + html_url: z.string().optional(), + sha: z.string().optional(), + }), + ) + .optional(), + verification: z + .object({ + verified: PermissiveBoolean.optional(), + reason: z.string().optional(), + signature: z.string().nullable().optional(), + payload: z.string().nullable().optional(), + verified_at: z.string().nullable().optional(), + }) + .optional(), + }), +}) + +export const s_git_commit = z.object({ + sha: z.string(), + node_id: z.string(), + url: z.string(), + author: z.object({ + date: z.string().datetime({ offset: true }), + email: z.string(), + name: z.string(), + }), + committer: z.object({ + date: z.string().datetime({ offset: true }), + email: z.string(), + name: z.string(), + }), + message: z.string(), + tree: z.object({ sha: z.string(), url: z.string() }), + parents: z.array( + z.object({ sha: z.string(), url: z.string(), html_url: z.string() }), + ), + verification: z.object({ + verified: PermissiveBoolean, + reason: z.string(), + signature: z.string().nullable(), + payload: z.string().nullable(), + verified_at: z.string().nullable(), + }), + html_url: z.string(), +}) + +export const s_git_ref = z.object({ + ref: z.string(), + node_id: z.string(), + url: z.string(), + object: z.object({ + type: z.string(), + sha: z.string().min(40).max(40), + url: z.string(), + }), +}) + +export const s_git_tree = z.object({ + sha: z.string(), + url: z.string().optional(), + truncated: PermissiveBoolean, + tree: z.array( + z.object({ + path: z.string(), + mode: z.string(), + type: z.string(), + sha: z.string(), + size: z.coerce.number().optional(), + url: z.string().optional(), + }), + ), +}) + +export const s_gitignore_template = z.object({ + name: z.string(), + source: z.string(), +}) + +export const s_gpg_key = z.object({ + id: z.coerce.number(), + name: z.string().nullable().optional(), + primary_key_id: z.coerce.number().nullable(), + key_id: z.string(), + public_key: z.string(), + emails: z.array( + z.object({ + email: z.string().optional(), + verified: PermissiveBoolean.optional(), + }), + ), + subkeys: z.array( + z.object({ + id: z.coerce.number().optional(), + primary_key_id: z.coerce.number().optional(), + key_id: z.string().optional(), + public_key: z.string().optional(), + emails: z + .array( + z.object({ + email: z.string().optional(), + verified: PermissiveBoolean.optional(), + }), + ) + .optional(), + subkeys: z.array(z.unknown()).optional(), + can_sign: PermissiveBoolean.optional(), + can_encrypt_comms: PermissiveBoolean.optional(), + can_encrypt_storage: PermissiveBoolean.optional(), + can_certify: PermissiveBoolean.optional(), + created_at: z.string().optional(), + expires_at: z.string().nullable().optional(), + raw_key: z.string().nullable().optional(), + revoked: PermissiveBoolean.optional(), + }), + ), + can_sign: PermissiveBoolean, + can_encrypt_comms: PermissiveBoolean, + can_encrypt_storage: PermissiveBoolean, + can_certify: PermissiveBoolean, + created_at: z.string().datetime({ offset: true }), + expires_at: z.string().datetime({ offset: true }).nullable(), + revoked: PermissiveBoolean, + raw_key: z.string().nullable(), +}) + +export const s_hook_delivery = z.object({ + id: z.coerce.number(), + guid: z.string(), + delivered_at: z.string().datetime({ offset: true }), + redelivery: PermissiveBoolean, + duration: z.coerce.number(), + status: z.string(), + status_code: z.coerce.number(), + event: z.string(), + action: z.string().nullable(), + installation_id: z.coerce.number().nullable(), + repository_id: z.coerce.number().nullable(), + throttled_at: z.string().datetime({ offset: true }).nullable().optional(), + url: z.string().optional(), + request: z.object({ + headers: z.record(z.unknown()).nullable(), + payload: z.record(z.unknown()).nullable(), + }), + response: z.object({ + headers: z.record(z.unknown()).nullable(), + payload: z.string().nullable(), + }), +}) + +export const s_hook_delivery_item = z.object({ + id: z.coerce.number(), + guid: z.string(), + delivered_at: z.string().datetime({ offset: true }), + redelivery: PermissiveBoolean, + duration: z.coerce.number(), + status: z.string(), + status_code: z.coerce.number(), + event: z.string(), + action: z.string().nullable(), + installation_id: z.coerce.number().nullable(), + repository_id: z.coerce.number().nullable(), + throttled_at: z.string().datetime({ offset: true }).nullable().optional(), +}) + +export const s_hook_response = z.object({ + code: z.coerce.number().nullable(), + status: z.string().nullable(), + message: z.string().nullable(), +}) + +export const s_hovercard = z.object({ + contexts: z.array(z.object({ message: z.string(), octicon: z.string() })), +}) + +export const s_import = z.object({ + vcs: z.string().nullable(), + use_lfs: PermissiveBoolean.optional(), + vcs_url: z.string(), + svc_root: z.string().optional(), + tfvc_project: z.string().optional(), + status: z.enum([ + "auth", + "error", + "none", + "detecting", + "choose", + "auth_failed", + "importing", + "mapping", + "waiting_to_push", + "pushing", + "complete", + "setup", + "unknown", + "detection_found_multiple", + "detection_found_nothing", + "detection_needs_auth", + ]), + status_text: z.string().nullable().optional(), + failed_step: z.string().nullable().optional(), + error_message: z.string().nullable().optional(), + import_percent: z.coerce.number().nullable().optional(), + commit_count: z.coerce.number().nullable().optional(), + push_percent: z.coerce.number().nullable().optional(), + has_large_files: PermissiveBoolean.optional(), + large_files_size: z.coerce.number().optional(), + large_files_count: z.coerce.number().optional(), + project_choices: z + .array( + z.object({ + vcs: z.string().optional(), + tfvc_project: z.string().optional(), + human_name: z.string().optional(), + }), + ) + .optional(), + message: z.string().optional(), + authors_count: z.coerce.number().nullable().optional(), + url: z.string(), + html_url: z.string(), + authors_url: z.string(), + repository_url: z.string(), + svn_root: z.string().optional(), +}) + +export const s_interaction_expiry = z.enum([ + "one_day", + "three_days", + "one_week", + "one_month", + "six_months", +]) + +export const s_interaction_group = z.enum([ + "existing_users", + "contributors_only", + "collaborators_only", +]) + +export const s_issue_event_dismissed_review = z.object({ + state: z.string(), + review_id: z.coerce.number(), + dismissal_message: z.string().nullable(), + dismissal_commit_id: z.string().nullable().optional(), +}) + +export const s_issue_event_label = z.object({ + name: z.string().nullable(), + color: z.string().nullable(), +}) + +export const s_issue_event_milestone = z.object({ title: z.string() }) + +export const s_issue_event_project_card = z.object({ + url: z.string(), + id: z.coerce.number(), + project_url: z.string(), + project_id: z.coerce.number(), + column_name: z.string(), + previous_column_name: z.string().optional(), +}) + +export const s_issue_event_rename = z.object({ + from: z.string(), + to: z.string(), +}) + +export const s_issue_type = z + .object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + description: z.string().nullable(), + color: z + .enum([ + "gray", + "blue", + "green", + "yellow", + "orange", + "red", + "pink", + "purple", + ]) + .nullable() + .optional(), + created_at: z.string().datetime({ offset: true }).optional(), + updated_at: z.string().datetime({ offset: true }).optional(), + is_enabled: PermissiveBoolean.optional(), + }) + .nullable() + +export const s_job = z.object({ + id: z.coerce.number(), + run_id: z.coerce.number(), + run_url: z.string(), + run_attempt: z.coerce.number().optional(), + node_id: z.string(), + head_sha: z.string(), + url: z.string(), + html_url: z.string().nullable(), + status: z.enum([ + "queued", + "in_progress", + "completed", + "waiting", + "requested", + "pending", + ]), + conclusion: z + .enum([ + "success", + "failure", + "neutral", + "cancelled", + "skipped", + "timed_out", + "action_required", + ]) + .nullable(), + created_at: z.string().datetime({ offset: true }), + started_at: z.string().datetime({ offset: true }), + completed_at: z.string().datetime({ offset: true }).nullable(), + name: z.string(), + steps: z + .array( + z.object({ + status: z.enum(["queued", "in_progress", "completed"]), + conclusion: z.string().nullable(), + name: z.string(), + number: z.coerce.number(), + started_at: z.string().datetime({ offset: true }).nullable().optional(), + completed_at: z + .string() + .datetime({ offset: true }) + .nullable() + .optional(), + }), + ) + .optional(), + check_run_url: z.string(), + labels: z.array(z.string()), + runner_id: z.coerce.number().nullable(), + runner_name: z.string().nullable(), + runner_group_id: z.coerce.number().nullable(), + runner_group_name: z.string().nullable(), + workflow_name: z.string().nullable(), + head_branch: z.string().nullable(), +}) + +export const s_key = z.object({ + key: z.string(), + id: z.coerce.number(), + url: z.string(), + title: z.string(), + created_at: z.string().datetime({ offset: true }), + verified: PermissiveBoolean, + read_only: PermissiveBoolean, +}) + +export const s_key_simple = z.object({ id: z.coerce.number(), key: z.string() }) + +export const s_label = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + name: z.string(), + description: z.string().nullable(), + color: z.string(), + default: PermissiveBoolean, +}) + +export const s_language = z.record(z.coerce.number()) + +export const s_license = z.object({ + key: z.string(), + name: z.string(), + spdx_id: z.string().nullable(), + url: z.string().nullable(), + node_id: z.string(), + html_url: z.string(), + description: z.string(), + implementation: z.string(), + permissions: z.array(z.string()), + conditions: z.array(z.string()), + limitations: z.array(z.string()), + body: z.string(), + featured: PermissiveBoolean, +}) + +export const s_license_simple = z.object({ + key: z.string(), + name: z.string(), + url: z.string().nullable(), + spdx_id: z.string().nullable(), + node_id: z.string(), + html_url: z.string().optional(), +}) + +export const s_link = z.object({ href: z.string() }) + +export const s_link_with_type = z.object({ href: z.string(), type: z.string() }) + +export const s_marketplace_account = z.object({ + url: z.string(), + id: z.coerce.number(), + type: z.string(), + node_id: z.string().optional(), + login: z.string(), + email: z.string().email().nullable().optional(), + organization_billing_email: z.string().email().nullable().optional(), +}) + +export const s_marketplace_listing_plan = z.object({ + url: z.string(), + accounts_url: z.string(), + id: z.coerce.number(), + number: z.coerce.number(), + name: z.string(), + description: z.string(), + monthly_price_in_cents: z.coerce.number(), + yearly_price_in_cents: z.coerce.number(), + price_model: z.enum(["FREE", "FLAT_RATE", "PER_UNIT"]), + has_free_trial: PermissiveBoolean, + unit_name: z.string().nullable(), + state: z.string(), + bullets: z.array(z.string()), +}) + +export const s_merged_upstream = z.object({ + message: z.string().optional(), + merge_type: z.enum(["merge", "fast-forward", "none"]).optional(), + base_branch: z.string().optional(), +}) + +export const s_metadata = z.record( + z.union([z.string(), z.coerce.number(), PermissiveBoolean]).nullable(), +) + +export const s_network_configuration = z.object({ + id: z.string(), + name: z.string(), + compute_service: z.enum(["none", "actions", "codespaces"]).optional(), + network_settings_ids: z.array(z.string()).optional(), + created_on: z.string().datetime({ offset: true }).nullable(), +}) + +export const s_network_settings = z.object({ + id: z.string(), + network_configuration_id: z.string().optional(), + name: z.string(), + subnet_id: z.string(), + region: z.string(), +}) + +export const s_nullable_actions_hosted_runner_pool_image = z + .object({ + id: z.string(), + size_gb: z.coerce.number(), + display_name: z.string(), + source: z.enum(["github", "partner", "custom"]), + }) + .nullable() + +export const s_nullable_alert_updated_at = z + .string() + .datetime({ offset: true }) + .nullable() + +export const s_nullable_code_of_conduct_simple = z + .object({ + url: z.string(), + key: z.string(), + name: z.string(), + html_url: z.string().nullable(), + }) + .nullable() + +export const s_nullable_codespace_machine = z + .object({ + name: z.string(), + display_name: z.string(), + operating_system: z.string(), + storage_in_bytes: z.coerce.number(), + memory_in_bytes: z.coerce.number(), + cpus: z.coerce.number(), + prebuild_availability: z.enum(["none", "ready", "in_progress"]).nullable(), + }) + .nullable() + +export const s_nullable_collaborator = z + .object({ + login: z.string(), + id: z.coerce.number(), + email: z.string().nullable().optional(), + name: z.string().nullable().optional(), + node_id: z.string(), + avatar_url: z.string(), + gravatar_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + followers_url: z.string(), + following_url: z.string(), + gists_url: z.string(), + starred_url: z.string(), + subscriptions_url: z.string(), + organizations_url: z.string(), + repos_url: z.string(), + events_url: z.string(), + received_events_url: z.string(), + type: z.string(), + site_admin: PermissiveBoolean, + permissions: z + .object({ + pull: PermissiveBoolean, + triage: PermissiveBoolean.optional(), + push: PermissiveBoolean, + maintain: PermissiveBoolean.optional(), + admin: PermissiveBoolean, + }) + .optional(), + role_name: z.string(), + user_view_type: z.string().optional(), + }) + .nullable() + +export const s_nullable_community_health_file = z + .object({ url: z.string(), html_url: z.string() }) + .nullable() + +export const s_nullable_git_user = z + .object({ + name: z.string().optional(), + email: z.string().optional(), + date: z.string().optional(), + }) + .nullable() + +export const s_nullable_license_simple = z + .object({ + key: z.string(), + name: z.string(), + url: z.string().nullable(), + spdx_id: z.string().nullable(), + node_id: z.string(), + html_url: z.string().optional(), + }) + .nullable() + +export const s_nullable_organization_simple = z + .object({ + login: z.string(), + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + repos_url: z.string(), + events_url: z.string(), + hooks_url: z.string(), + issues_url: z.string(), + members_url: z.string(), + public_members_url: z.string(), + avatar_url: z.string(), + description: z.string().nullable(), + }) + .nullable() + +export const s_nullable_simple_commit = z + .object({ + id: z.string(), + tree_id: z.string(), + message: z.string(), + timestamp: z.string().datetime({ offset: true }), + author: z + .object({ name: z.string(), email: z.string().email() }) + .nullable(), + committer: z + .object({ name: z.string(), email: z.string().email() }) + .nullable(), + }) + .nullable() + +export const s_nullable_simple_user = z + .object({ + name: z.string().nullable().optional(), + email: z.string().nullable().optional(), + login: z.string(), + id: z.coerce.number(), + node_id: z.string(), + avatar_url: z.string(), + gravatar_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + followers_url: z.string(), + following_url: z.string(), + gists_url: z.string(), + starred_url: z.string(), + subscriptions_url: z.string(), + organizations_url: z.string(), + repos_url: z.string(), + events_url: z.string(), + received_events_url: z.string(), + type: z.string(), + site_admin: PermissiveBoolean, + starred_at: z.string().optional(), + user_view_type: z.string().optional(), + }) + .nullable() + +export const s_nullable_team_simple = z + .object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + members_url: z.string(), + name: z.string(), + description: z.string().nullable(), + permission: z.string(), + privacy: z.string().optional(), + notification_setting: z.string().optional(), + html_url: z.string(), + repositories_url: z.string(), + slug: z.string(), + ldap_dn: z.string().optional(), + }) + .nullable() + +export const s_oidc_custom_sub = z.object({ + include_claim_keys: z.array(z.string()), +}) + +export const s_oidc_custom_sub_repo = z.object({ + use_default: PermissiveBoolean, + include_claim_keys: z.array(z.string()).optional(), +}) + +export const s_org_hook = z.object({ + id: z.coerce.number(), + url: z.string(), + ping_url: z.string(), + deliveries_url: z.string().optional(), + name: z.string(), + events: z.array(z.string()), + active: PermissiveBoolean, + config: z.object({ + url: z.string().optional(), + insecure_ssl: z.string().optional(), + content_type: z.string().optional(), + secret: z.string().optional(), + }), + updated_at: z.string().datetime({ offset: true }), + created_at: z.string().datetime({ offset: true }), + type: z.string(), +}) + +export const s_org_private_registry_configuration = z.object({ + name: z.string(), + registry_type: z.enum(["maven_repository"]), + username: z.string().nullable().optional(), + visibility: z.enum(["all", "private", "selected"]), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_org_private_registry_configuration_with_selected_repositories = + z.object({ + name: z.string(), + registry_type: z.enum(["maven_repository"]), + username: z.string().optional(), + visibility: z.enum(["all", "private", "selected"]), + selected_repository_ids: z.array(z.coerce.number()).optional(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + }) + +export const s_organization_actions_secret = z.object({ + name: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + visibility: z.enum(["all", "private", "selected"]), + selected_repositories_url: z.string().optional(), +}) + +export const s_organization_actions_variable = z.object({ + name: z.string(), + value: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + visibility: z.enum(["all", "private", "selected"]), + selected_repositories_url: z.string().optional(), +}) + +export const s_organization_create_issue_type = z.object({ + name: z.string(), + is_enabled: PermissiveBoolean, + description: z.string().nullable().optional(), + color: z + .enum([ + "gray", + "blue", + "green", + "yellow", + "orange", + "red", + "pink", + "purple", + ]) + .nullable() + .optional(), +}) + +export const s_organization_dependabot_secret = z.object({ + name: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + visibility: z.enum(["all", "private", "selected"]), + selected_repositories_url: z.string().optional(), +}) + +export const s_organization_full = z.object({ + login: z.string(), + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + repos_url: z.string(), + events_url: z.string(), + hooks_url: z.string(), + issues_url: z.string(), + members_url: z.string(), + public_members_url: z.string(), + avatar_url: z.string(), + description: z.string().nullable(), + name: z.string().optional(), + company: z.string().optional(), + blog: z.string().optional(), + location: z.string().optional(), + email: z.string().email().optional(), + twitter_username: z.string().nullable().optional(), + is_verified: PermissiveBoolean.optional(), + has_organization_projects: PermissiveBoolean, + has_repository_projects: PermissiveBoolean, + public_repos: z.coerce.number(), + public_gists: z.coerce.number(), + followers: z.coerce.number(), + following: z.coerce.number(), + html_url: z.string(), + type: z.string(), + total_private_repos: z.coerce.number().optional(), + owned_private_repos: z.coerce.number().optional(), + private_gists: z.coerce.number().nullable().optional(), + disk_usage: z.coerce.number().nullable().optional(), + collaborators: z.coerce.number().nullable().optional(), + billing_email: z.string().email().nullable().optional(), + plan: z + .object({ + name: z.string(), + space: z.coerce.number(), + private_repos: z.coerce.number(), + filled_seats: z.coerce.number().optional(), + seats: z.coerce.number().optional(), + }) + .optional(), + default_repository_permission: z.string().nullable().optional(), + members_can_create_repositories: PermissiveBoolean.nullable().optional(), + two_factor_requirement_enabled: PermissiveBoolean.nullable().optional(), + members_allowed_repository_creation_type: z.string().optional(), + members_can_create_public_repositories: PermissiveBoolean.optional(), + members_can_create_private_repositories: PermissiveBoolean.optional(), + members_can_create_internal_repositories: PermissiveBoolean.optional(), + members_can_create_pages: PermissiveBoolean.optional(), + members_can_create_public_pages: PermissiveBoolean.optional(), + members_can_create_private_pages: PermissiveBoolean.optional(), + members_can_fork_private_repositories: + PermissiveBoolean.nullable().optional(), + web_commit_signoff_required: PermissiveBoolean.optional(), + advanced_security_enabled_for_new_repositories: PermissiveBoolean.optional(), + dependabot_alerts_enabled_for_new_repositories: PermissiveBoolean.optional(), + dependabot_security_updates_enabled_for_new_repositories: + PermissiveBoolean.optional(), + dependency_graph_enabled_for_new_repositories: PermissiveBoolean.optional(), + secret_scanning_enabled_for_new_repositories: PermissiveBoolean.optional(), + secret_scanning_push_protection_enabled_for_new_repositories: + PermissiveBoolean.optional(), + secret_scanning_push_protection_custom_link_enabled: + PermissiveBoolean.optional(), + secret_scanning_push_protection_custom_link: z.string().nullable().optional(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + archived_at: z.string().datetime({ offset: true }).nullable(), + deploy_keys_enabled_for_repositories: PermissiveBoolean.optional(), +}) + +export const s_organization_simple = z.object({ + login: z.string(), + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + repos_url: z.string(), + events_url: z.string(), + hooks_url: z.string(), + issues_url: z.string(), + members_url: z.string(), + public_members_url: z.string(), + avatar_url: z.string(), + description: z.string().nullable(), +}) + +export const s_organization_update_issue_type = z.object({ + name: z.string(), + is_enabled: PermissiveBoolean, + description: z.string().nullable().optional(), + color: z + .enum([ + "gray", + "blue", + "green", + "yellow", + "orange", + "red", + "pink", + "purple", + ]) + .nullable() + .optional(), +}) + +export const s_package_version = z.object({ + id: z.coerce.number(), + name: z.string(), + url: z.string(), + package_html_url: z.string(), + html_url: z.string().optional(), + license: z.string().optional(), + description: z.string().optional(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + deleted_at: z.string().datetime({ offset: true }).optional(), + metadata: z + .object({ + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + container: z.object({ tags: z.array(z.string()) }).optional(), + docker: z.object({ tag: z.array(z.string()).optional() }).optional(), + }) + .optional(), +}) + +export const s_packages_billing_usage = z.object({ + total_gigabytes_bandwidth_used: z.coerce.number(), + total_paid_gigabytes_bandwidth_used: z.coerce.number(), + included_gigabytes_bandwidth: z.coerce.number(), +}) + +export const s_page_build_status = z.object({ + url: z.string(), + status: z.string(), +}) + +export const s_page_deployment = z.object({ + id: z.union([z.coerce.number(), z.string()]), + status_url: z.string(), + page_url: z.string(), + preview_url: z.string().optional(), +}) + +export const s_pages_deployment_status = z.object({ + status: z + .enum([ + "deployment_in_progress", + "syncing_files", + "finished_file_sync", + "updating_pages", + "purging_cdn", + "deployment_cancelled", + "deployment_failed", + "deployment_content_failed", + "deployment_attempt_error", + "deployment_lost", + "succeed", + ]) + .optional(), +}) + +export const s_pages_health_check = z.object({ + domain: z + .object({ + host: z.string().optional(), + uri: z.string().optional(), + nameservers: z.string().optional(), + dns_resolves: PermissiveBoolean.optional(), + is_proxied: PermissiveBoolean.nullable().optional(), + is_cloudflare_ip: PermissiveBoolean.nullable().optional(), + is_fastly_ip: PermissiveBoolean.nullable().optional(), + is_old_ip_address: PermissiveBoolean.nullable().optional(), + is_a_record: PermissiveBoolean.nullable().optional(), + has_cname_record: PermissiveBoolean.nullable().optional(), + has_mx_records_present: PermissiveBoolean.nullable().optional(), + is_valid_domain: PermissiveBoolean.optional(), + is_apex_domain: PermissiveBoolean.optional(), + should_be_a_record: PermissiveBoolean.nullable().optional(), + is_cname_to_github_user_domain: PermissiveBoolean.nullable().optional(), + is_cname_to_pages_dot_github_dot_com: + PermissiveBoolean.nullable().optional(), + is_cname_to_fastly: PermissiveBoolean.nullable().optional(), + is_pointed_to_github_pages_ip: PermissiveBoolean.nullable().optional(), + is_non_github_pages_ip_present: PermissiveBoolean.nullable().optional(), + is_pages_domain: PermissiveBoolean.optional(), + is_served_by_pages: PermissiveBoolean.nullable().optional(), + is_valid: PermissiveBoolean.optional(), + reason: z.string().nullable().optional(), + responds_to_https: PermissiveBoolean.optional(), + enforces_https: PermissiveBoolean.optional(), + https_error: z.string().nullable().optional(), + is_https_eligible: PermissiveBoolean.nullable().optional(), + caa_error: z.string().nullable().optional(), + }) + .optional(), + alt_domain: z + .object({ + host: z.string().optional(), + uri: z.string().optional(), + nameservers: z.string().optional(), + dns_resolves: PermissiveBoolean.optional(), + is_proxied: PermissiveBoolean.nullable().optional(), + is_cloudflare_ip: PermissiveBoolean.nullable().optional(), + is_fastly_ip: PermissiveBoolean.nullable().optional(), + is_old_ip_address: PermissiveBoolean.nullable().optional(), + is_a_record: PermissiveBoolean.nullable().optional(), + has_cname_record: PermissiveBoolean.nullable().optional(), + has_mx_records_present: PermissiveBoolean.nullable().optional(), + is_valid_domain: PermissiveBoolean.optional(), + is_apex_domain: PermissiveBoolean.optional(), + should_be_a_record: PermissiveBoolean.nullable().optional(), + is_cname_to_github_user_domain: PermissiveBoolean.nullable().optional(), + is_cname_to_pages_dot_github_dot_com: + PermissiveBoolean.nullable().optional(), + is_cname_to_fastly: PermissiveBoolean.nullable().optional(), + is_pointed_to_github_pages_ip: PermissiveBoolean.nullable().optional(), + is_non_github_pages_ip_present: PermissiveBoolean.nullable().optional(), + is_pages_domain: PermissiveBoolean.optional(), + is_served_by_pages: PermissiveBoolean.nullable().optional(), + is_valid: PermissiveBoolean.optional(), + reason: z.string().nullable().optional(), + responds_to_https: PermissiveBoolean.optional(), + enforces_https: PermissiveBoolean.optional(), + https_error: z.string().nullable().optional(), + is_https_eligible: PermissiveBoolean.nullable().optional(), + caa_error: z.string().nullable().optional(), + }) + .nullable() + .optional(), +}) + +export const s_pages_https_certificate = z.object({ + state: z.enum([ + "new", + "authorization_created", + "authorization_pending", + "authorized", + "authorization_revoked", + "issued", + "uploaded", + "approved", + "errored", + "bad_authz", + "destroy_pending", + "dns_changed", + ]), + description: z.string(), + domains: z.array(z.string()), + expires_at: z.string().optional(), +}) + +export const s_pages_source_hash = z.object({ + branch: z.string(), + path: z.string(), +}) + +export const s_participation_stats = z.object({ + all: z.array(z.coerce.number()), + owner: z.array(z.coerce.number()), +}) + +export const s_porter_author = z.object({ + id: z.coerce.number(), + remote_id: z.string(), + remote_name: z.string(), + email: z.string(), + name: z.string(), + url: z.string(), + import_url: z.string(), +}) + +export const s_porter_large_file = z.object({ + ref_name: z.string(), + path: z.string(), + oid: z.string(), + size: z.coerce.number(), +}) + +export const s_prevent_self_review = PermissiveBoolean + +export const s_private_user = z.object({ + login: z.string(), + id: z.coerce.number(), + user_view_type: z.string().optional(), + node_id: z.string(), + avatar_url: z.string(), + gravatar_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + followers_url: z.string(), + following_url: z.string(), + gists_url: z.string(), + starred_url: z.string(), + subscriptions_url: z.string(), + organizations_url: z.string(), + repos_url: z.string(), + events_url: z.string(), + received_events_url: z.string(), + type: z.string(), + site_admin: PermissiveBoolean, + name: z.string().nullable(), + company: z.string().nullable(), + blog: z.string().nullable(), + location: z.string().nullable(), + email: z.string().email().nullable(), + notification_email: z.string().email().nullable().optional(), + hireable: PermissiveBoolean.nullable(), + bio: z.string().nullable(), + twitter_username: z.string().nullable().optional(), + public_repos: z.coerce.number(), + public_gists: z.coerce.number(), + followers: z.coerce.number(), + following: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + private_gists: z.coerce.number(), + total_private_repos: z.coerce.number(), + owned_private_repos: z.coerce.number(), + disk_usage: z.coerce.number(), + collaborators: z.coerce.number(), + two_factor_authentication: PermissiveBoolean, + plan: z + .object({ + collaborators: z.coerce.number(), + name: z.string(), + space: z.coerce.number(), + private_repos: z.coerce.number(), + }) + .optional(), + business_plus: PermissiveBoolean.optional(), + ldap_dn: z.string().optional(), +}) + +export const s_project_column = z.object({ + url: z.string(), + project_url: z.string(), + cards_url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_protected_branch_admin_enforced = z.object({ + url: z.string(), + enabled: PermissiveBoolean, +}) + +export const s_protected_branch_required_status_check = z.object({ + url: z.string().optional(), + enforcement_level: z.string().optional(), + contexts: z.array(z.string()), + checks: z.array( + z.object({ context: z.string(), app_id: z.coerce.number().nullable() }), + ), + contexts_url: z.string().optional(), + strict: PermissiveBoolean.optional(), +}) + +export const s_public_ip = z.object({ + enabled: PermissiveBoolean.optional(), + prefix: z.string().optional(), + length: z.coerce.number().optional(), +}) + +export const s_public_user = z.object({ + login: z.string(), + id: z.coerce.number(), + user_view_type: z.string().optional(), + node_id: z.string(), + avatar_url: z.string(), + gravatar_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + followers_url: z.string(), + following_url: z.string(), + gists_url: z.string(), + starred_url: z.string(), + subscriptions_url: z.string(), + organizations_url: z.string(), + repos_url: z.string(), + events_url: z.string(), + received_events_url: z.string(), + type: z.string(), + site_admin: PermissiveBoolean, + name: z.string().nullable(), + company: z.string().nullable(), + blog: z.string().nullable(), + location: z.string().nullable(), + email: z.string().email().nullable(), + notification_email: z.string().email().nullable().optional(), + hireable: PermissiveBoolean.nullable(), + bio: z.string().nullable(), + twitter_username: z.string().nullable().optional(), + public_repos: z.coerce.number(), + public_gists: z.coerce.number(), + followers: z.coerce.number(), + following: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + plan: z + .object({ + collaborators: z.coerce.number(), + name: z.string(), + space: z.coerce.number(), + private_repos: z.coerce.number(), + }) + .optional(), + private_gists: z.coerce.number().optional(), + total_private_repos: z.coerce.number().optional(), + owned_private_repos: z.coerce.number().optional(), + disk_usage: z.coerce.number().optional(), + collaborators: z.coerce.number().optional(), +}) + +export const s_pull_request_merge_result = z.object({ + sha: z.string(), + merged: PermissiveBoolean, + message: z.string(), +}) + +export const s_pull_request_minimal = z.object({ + id: z.coerce.number(), + number: z.coerce.number(), + url: z.string(), + head: z.object({ + ref: z.string(), + sha: z.string(), + repo: z.object({ + id: z.coerce.number(), + url: z.string(), + name: z.string(), + }), + }), + base: z.object({ + ref: z.string(), + sha: z.string(), + repo: z.object({ + id: z.coerce.number(), + url: z.string(), + name: z.string(), + }), + }), +}) + +export const s_rate_limit = z.object({ + limit: z.coerce.number(), + remaining: z.coerce.number(), + reset: z.coerce.number(), + used: z.coerce.number(), +}) + +export const s_reaction_rollup = z.object({ + url: z.string(), + total_count: z.coerce.number(), + "+1": z.coerce.number(), + "-1": z.coerce.number(), + laugh: z.coerce.number(), + confused: z.coerce.number(), + heart: z.coerce.number(), + hooray: z.coerce.number(), + eyes: z.coerce.number(), + rocket: z.coerce.number(), +}) + +export const s_referenced_workflow = z.object({ + path: z.string(), + sha: z.string(), + ref: z.string().optional(), +}) + +export const s_referrer_traffic = z.object({ + referrer: z.string(), + count: z.coerce.number(), + uniques: z.coerce.number(), +}) + +export const s_release_notes_content = z.object({ + name: z.string(), + body: z.string(), +}) + +export const s_repo_codespaces_secret = z.object({ + name: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_repository_rule_branch_name_pattern = z.object({ + type: z.enum(["branch_name_pattern"]), + parameters: z + .object({ + name: z.string().optional(), + negate: PermissiveBoolean.optional(), + operator: z.enum(["starts_with", "ends_with", "contains", "regex"]), + pattern: z.string(), + }) + .optional(), +}) + +export const s_repository_rule_commit_author_email_pattern = z.object({ + type: z.enum(["commit_author_email_pattern"]), + parameters: z + .object({ + name: z.string().optional(), + negate: PermissiveBoolean.optional(), + operator: z.enum(["starts_with", "ends_with", "contains", "regex"]), + pattern: z.string(), + }) + .optional(), +}) + +export const s_repository_rule_commit_message_pattern = z.object({ + type: z.enum(["commit_message_pattern"]), + parameters: z + .object({ + name: z.string().optional(), + negate: PermissiveBoolean.optional(), + operator: z.enum(["starts_with", "ends_with", "contains", "regex"]), + pattern: z.string(), + }) + .optional(), +}) + +export const s_repository_rule_committer_email_pattern = z.object({ + type: z.enum(["committer_email_pattern"]), + parameters: z + .object({ + name: z.string().optional(), + negate: PermissiveBoolean.optional(), + operator: z.enum(["starts_with", "ends_with", "contains", "regex"]), + pattern: z.string(), + }) + .optional(), +}) + +export const s_repository_rule_creation = z.object({ + type: z.enum(["creation"]), +}) + +export const s_repository_rule_deletion = z.object({ + type: z.enum(["deletion"]), +}) + +export const s_repository_rule_enforcement = z.enum([ + "disabled", + "active", + "evaluate", +]) + +export const s_repository_rule_file_extension_restriction = z.object({ + type: z.enum(["file_extension_restriction"]), + parameters: z + .object({ restricted_file_extensions: z.array(z.string()) }) + .optional(), +}) + +export const s_repository_rule_file_path_restriction = z.object({ + type: z.enum(["file_path_restriction"]), + parameters: z + .object({ restricted_file_paths: z.array(z.string()) }) + .optional(), +}) + +export const s_repository_rule_max_file_path_length = z.object({ + type: z.enum(["max_file_path_length"]), + parameters: z + .object({ max_file_path_length: z.coerce.number().min(1).max(256) }) + .optional(), +}) + +export const s_repository_rule_max_file_size = z.object({ + type: z.enum(["max_file_size"]), + parameters: z + .object({ max_file_size: z.coerce.number().min(1).max(100) }) + .optional(), +}) + +export const s_repository_rule_merge_queue = z.object({ + type: z.enum(["merge_queue"]), + parameters: z + .object({ + check_response_timeout_minutes: z.coerce.number().min(1).max(360), + grouping_strategy: z.enum(["ALLGREEN", "HEADGREEN"]), + max_entries_to_build: z.coerce.number().min(0).max(100), + max_entries_to_merge: z.coerce.number().min(0).max(100), + merge_method: z.enum(["MERGE", "SQUASH", "REBASE"]), + min_entries_to_merge: z.coerce.number().min(0).max(100), + min_entries_to_merge_wait_minutes: z.coerce.number().min(0).max(360), + }) + .optional(), +}) + +export const s_repository_rule_non_fast_forward = z.object({ + type: z.enum(["non_fast_forward"]), +}) + +export const s_repository_rule_params_code_scanning_tool = z.object({ + alerts_threshold: z.enum(["none", "errors", "errors_and_warnings", "all"]), + security_alerts_threshold: z.enum([ + "none", + "critical", + "high_or_higher", + "medium_or_higher", + "all", + ]), + tool: z.string(), +}) + +export const s_repository_rule_params_status_check_configuration = z.object({ + context: z.string(), + integration_id: z.coerce.number().optional(), +}) + +export const s_repository_rule_params_workflow_file_reference = z.object({ + path: z.string(), + ref: z.string().optional(), + repository_id: z.coerce.number(), + sha: z.string().optional(), +}) + +export const s_repository_rule_pull_request = z.object({ + type: z.enum(["pull_request"]), + parameters: z + .object({ + allowed_merge_methods: z + .array(z.enum(["merge", "squash", "rebase"])) + .optional(), + automatic_copilot_code_review_enabled: PermissiveBoolean.optional(), + dismiss_stale_reviews_on_push: PermissiveBoolean, + require_code_owner_review: PermissiveBoolean, + require_last_push_approval: PermissiveBoolean, + required_approving_review_count: z.coerce.number().min(0).max(10), + required_review_thread_resolution: PermissiveBoolean, + }) + .optional(), +}) + +export const s_repository_rule_required_deployments = z.object({ + type: z.enum(["required_deployments"]), + parameters: z + .object({ required_deployment_environments: z.array(z.string()) }) + .optional(), +}) + +export const s_repository_rule_required_linear_history = z.object({ + type: z.enum(["required_linear_history"]), +}) + +export const s_repository_rule_required_signatures = z.object({ + type: z.enum(["required_signatures"]), +}) + +export const s_repository_rule_ruleset_info = z.object({ + ruleset_source_type: z.enum(["Repository", "Organization"]).optional(), + ruleset_source: z.string().optional(), + ruleset_id: z.coerce.number().optional(), +}) + +export const s_repository_rule_tag_name_pattern = z.object({ + type: z.enum(["tag_name_pattern"]), + parameters: z + .object({ + name: z.string().optional(), + negate: PermissiveBoolean.optional(), + operator: z.enum(["starts_with", "ends_with", "contains", "regex"]), + pattern: z.string(), + }) + .optional(), +}) + +export const s_repository_rule_update = z.object({ + type: z.enum(["update"]), + parameters: z + .object({ update_allows_fetch_and_merge: PermissiveBoolean }) + .optional(), +}) + +export const s_repository_ruleset_bypass_actor = z.object({ + actor_id: z.coerce.number().nullable().optional(), + actor_type: z.enum([ + "Integration", + "OrganizationAdmin", + "RepositoryRole", + "Team", + "DeployKey", + ]), + bypass_mode: z.enum(["always", "pull_request"]).optional().default("always"), +}) + +export const s_repository_ruleset_conditions = z.object({ + ref_name: z + .object({ + include: z.array(z.string()).optional(), + exclude: z.array(z.string()).optional(), + }) + .optional(), +}) + +export const s_repository_ruleset_conditions_repository_id_target = z.object({ + repository_id: z.object({ + repository_ids: z.array(z.coerce.number()).optional(), + }), +}) + +export const s_repository_ruleset_conditions_repository_name_target = z.object({ + repository_name: z.object({ + include: z.array(z.string()).optional(), + exclude: z.array(z.string()).optional(), + protected: PermissiveBoolean.optional(), + }), +}) + +export const s_repository_ruleset_conditions_repository_property_spec = + z.object({ + name: z.string(), + property_values: z.array(z.string()), + source: z.enum(["custom", "system"]).optional(), + }) + +export const s_repository_subscription = z.object({ + subscribed: PermissiveBoolean, + ignored: PermissiveBoolean, + reason: z.string().nullable(), + created_at: z.string().datetime({ offset: true }), + url: z.string(), + repository_url: z.string(), +}) + +export const s_review_custom_gates_comment_required = z.object({ + environment_name: z.string(), + comment: z.string(), +}) + +export const s_review_custom_gates_state_required = z.object({ + environment_name: z.string(), + state: z.enum(["approved", "rejected"]), + comment: z.string().optional(), +}) + +export const s_root = z.object({ + current_user_url: z.string(), + current_user_authorizations_html_url: z.string(), + authorizations_url: z.string(), + code_search_url: z.string(), + commit_search_url: z.string(), + emails_url: z.string(), + emojis_url: z.string(), + events_url: z.string(), + feeds_url: z.string(), + followers_url: z.string(), + following_url: z.string(), + gists_url: z.string(), + hub_url: z.string().optional(), + issue_search_url: z.string(), + issues_url: z.string(), + keys_url: z.string(), + label_search_url: z.string(), + notifications_url: z.string(), + organization_url: z.string(), + organization_repositories_url: z.string(), + organization_teams_url: z.string(), + public_gists_url: z.string(), + rate_limit_url: z.string(), + repository_url: z.string(), + repository_search_url: z.string(), + current_user_repositories_url: z.string(), + starred_url: z.string(), + starred_gists_url: z.string(), + topic_search_url: z.string().optional(), + user_url: z.string(), + user_organizations_url: z.string(), + user_repositories_url: z.string(), + user_search_url: z.string(), +}) + +export const s_rule_suite = z.object({ + id: z.coerce.number().optional(), + actor_id: z.coerce.number().nullable().optional(), + actor_name: z.string().nullable().optional(), + before_sha: z.string().optional(), + after_sha: z.string().optional(), + ref: z.string().optional(), + repository_id: z.coerce.number().optional(), + repository_name: z.string().optional(), + pushed_at: z.string().datetime({ offset: true }).optional(), + result: z.enum(["pass", "fail", "bypass"]).optional(), + evaluation_result: z.enum(["pass", "fail", "bypass"]).nullable().optional(), + rule_evaluations: z + .array( + z.object({ + rule_source: z + .object({ + type: z.string().optional(), + id: z.coerce.number().nullable().optional(), + name: z.string().nullable().optional(), + }) + .optional(), + enforcement: z + .enum(["active", "evaluate", "deleted ruleset"]) + .optional(), + result: z.enum(["pass", "fail"]).optional(), + rule_type: z.string().optional(), + details: z.string().nullable().optional(), + }), + ) + .optional(), +}) + +export const s_rule_suites = z.array( + z.object({ + id: z.coerce.number().optional(), + actor_id: z.coerce.number().optional(), + actor_name: z.string().optional(), + before_sha: z.string().optional(), + after_sha: z.string().optional(), + ref: z.string().optional(), + repository_id: z.coerce.number().optional(), + repository_name: z.string().optional(), + pushed_at: z.string().datetime({ offset: true }).optional(), + result: z.enum(["pass", "fail", "bypass"]).optional(), + evaluation_result: z.enum(["pass", "fail", "bypass"]).optional(), + }), +) + +export const s_ruleset_version = z.object({ + version_id: z.coerce.number(), + actor: z.object({ + id: z.coerce.number().optional(), + type: z.string().optional(), + }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_runner_application = z.object({ + os: z.string(), + architecture: z.string(), + download_url: z.string(), + filename: z.string(), + temp_download_token: z.string().optional(), + sha256_checksum: z.string().optional(), +}) + +export const s_runner_groups_org = z.object({ + id: z.coerce.number(), + name: z.string(), + visibility: z.string(), + default: PermissiveBoolean, + selected_repositories_url: z.string().optional(), + runners_url: z.string(), + hosted_runners_url: z.string().optional(), + network_configuration_id: z.string().optional(), + inherited: PermissiveBoolean, + inherited_allows_public_repositories: PermissiveBoolean.optional(), + allows_public_repositories: PermissiveBoolean, + workflow_restrictions_read_only: PermissiveBoolean.optional().default(false), + restricted_to_workflows: PermissiveBoolean.optional().default(false), + selected_workflows: z.array(z.string()).optional(), +}) + +export const s_runner_label = z.object({ + id: z.coerce.number().optional(), + name: z.string(), + type: z.enum(["read-only", "custom"]).optional(), +}) + +export const s_scim_error = z.object({ + message: z.string().nullable().optional(), + documentation_url: z.string().nullable().optional(), + detail: z.string().nullable().optional(), + status: z.coerce.number().optional(), + scimType: z.string().nullable().optional(), + schemas: z.array(z.string()).optional(), +}) + +export const s_search_result_text_matches = z.array( + z.object({ + object_url: z.string().optional(), + object_type: z.string().nullable().optional(), + property: z.string().optional(), + fragment: z.string().optional(), + matches: z + .array( + z.object({ + text: z.string().optional(), + indices: z.array(z.coerce.number()).optional(), + }), + ) + .optional(), + }), +) + +export const s_secret_scanning_alert_resolution = z + .enum(["false_positive", "wont_fix", "revoked", "used_in_tests"]) + .nullable() + +export const s_secret_scanning_alert_resolution_comment = z.string().nullable() + +export const s_secret_scanning_alert_state = z.enum(["open", "resolved"]) + +export const s_secret_scanning_location_commit = z.object({ + path: z.string(), + start_line: z.coerce.number(), + end_line: z.coerce.number(), + start_column: z.coerce.number(), + end_column: z.coerce.number(), + blob_sha: z.string(), + blob_url: z.string(), + commit_sha: z.string(), + commit_url: z.string(), +}) + +export const s_secret_scanning_location_discussion_body = z.object({ + discussion_body_url: z.string(), +}) + +export const s_secret_scanning_location_discussion_comment = z.object({ + discussion_comment_url: z.string(), +}) + +export const s_secret_scanning_location_discussion_title = z.object({ + discussion_title_url: z.string(), +}) + +export const s_secret_scanning_location_issue_body = z.object({ + issue_body_url: z.string(), +}) + +export const s_secret_scanning_location_issue_comment = z.object({ + issue_comment_url: z.string(), +}) + +export const s_secret_scanning_location_issue_title = z.object({ + issue_title_url: z.string(), +}) + +export const s_secret_scanning_location_pull_request_body = z.object({ + pull_request_body_url: z.string(), +}) + +export const s_secret_scanning_location_pull_request_comment = z.object({ + pull_request_comment_url: z.string(), +}) + +export const s_secret_scanning_location_pull_request_review = z.object({ + pull_request_review_url: z.string(), +}) + +export const s_secret_scanning_location_pull_request_review_comment = z.object({ + pull_request_review_comment_url: z.string(), +}) + +export const s_secret_scanning_location_pull_request_title = z.object({ + pull_request_title_url: z.string(), +}) + +export const s_secret_scanning_location_wiki_commit = z.object({ + path: z.string(), + start_line: z.coerce.number(), + end_line: z.coerce.number(), + start_column: z.coerce.number(), + end_column: z.coerce.number(), + blob_sha: z.string(), + page_url: z.string(), + commit_sha: z.string(), + commit_url: z.string(), +}) + +export const s_secret_scanning_push_protection_bypass_placeholder_id = + z.string() + +export const s_secret_scanning_push_protection_bypass_reason = z.enum([ + "false_positive", + "used_in_tests", + "will_fix_later", +]) + +export const s_secret_scanning_scan = z.object({ + type: z.string().optional(), + status: z.string().optional(), + completed_at: z.string().datetime({ offset: true }).nullable().optional(), + started_at: z.string().datetime({ offset: true }).nullable().optional(), +}) + +export const s_security_advisory_credit_types = z.enum([ + "analyst", + "finder", + "reporter", + "coordinator", + "remediation_developer", + "remediation_reviewer", + "remediation_verifier", + "tool", + "sponsor", + "other", +]) + +export const s_security_advisory_ecosystems = z.enum([ + "rubygems", + "npm", + "pip", + "maven", + "nuget", + "composer", + "go", + "rust", + "erlang", + "actions", + "pub", + "other", + "swift", +]) + +export const s_security_advisory_epss = z + .object({ + percentage: z.coerce.number().min(0).max(100).optional(), + percentile: z.coerce.number().min(0).max(100).optional(), + }) + .nullable() + +export const s_security_and_analysis = z + .object({ + advanced_security: z + .object({ status: z.enum(["enabled", "disabled"]).optional() }) + .optional(), + code_security: z + .object({ status: z.enum(["enabled", "disabled"]).optional() }) + .optional(), + dependabot_security_updates: z + .object({ status: z.enum(["enabled", "disabled"]).optional() }) + .optional(), + secret_scanning: z + .object({ status: z.enum(["enabled", "disabled"]).optional() }) + .optional(), + secret_scanning_push_protection: z + .object({ status: z.enum(["enabled", "disabled"]).optional() }) + .optional(), + secret_scanning_non_provider_patterns: z + .object({ status: z.enum(["enabled", "disabled"]).optional() }) + .optional(), + secret_scanning_ai_detection: z + .object({ status: z.enum(["enabled", "disabled"]).optional() }) + .optional(), + }) + .nullable() + +export const s_selected_actions = z.object({ + github_owned_allowed: PermissiveBoolean.optional(), + verified_allowed: PermissiveBoolean.optional(), + patterns_allowed: z.array(z.string()).optional(), +}) + +export const s_selected_actions_url = z.string() + +export const s_short_blob = z.object({ url: z.string(), sha: z.string() }) + +export const s_simple_classroom = z.object({ + id: z.coerce.number(), + name: z.string(), + archived: PermissiveBoolean, + url: z.string(), +}) + +export const s_simple_classroom_organization = z.object({ + id: z.coerce.number(), + login: z.string(), + node_id: z.string(), + html_url: z.string(), + name: z.string().nullable(), + avatar_url: z.string(), +}) + +export const s_simple_classroom_repository = z.object({ + id: z.coerce.number(), + full_name: z.string(), + html_url: z.string(), + node_id: z.string(), + private: PermissiveBoolean, + default_branch: z.string(), +}) + +export const s_simple_classroom_user = z.object({ + id: z.coerce.number(), + login: z.string(), + avatar_url: z.string(), + html_url: z.string(), +}) + +export const s_simple_commit = z.object({ + id: z.string(), + tree_id: z.string(), + message: z.string(), + timestamp: z.string().datetime({ offset: true }), + author: z.object({ name: z.string(), email: z.string().email() }).nullable(), + committer: z + .object({ name: z.string(), email: z.string().email() }) + .nullable(), +}) + +export const s_simple_commit_status = z.object({ + description: z.string().nullable(), + id: z.coerce.number(), + node_id: z.string(), + state: z.string(), + context: z.string(), + target_url: z.string().nullable(), + required: PermissiveBoolean.nullable().optional(), + avatar_url: z.string().nullable(), + url: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_simple_user = z.object({ + name: z.string().nullable().optional(), + email: z.string().nullable().optional(), + login: z.string(), + id: z.coerce.number(), + node_id: z.string(), + avatar_url: z.string(), + gravatar_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + followers_url: z.string(), + following_url: z.string(), + gists_url: z.string(), + starred_url: z.string(), + subscriptions_url: z.string(), + organizations_url: z.string(), + repos_url: z.string(), + events_url: z.string(), + received_events_url: z.string(), + type: z.string(), + site_admin: PermissiveBoolean, + starred_at: z.string().optional(), + user_view_type: z.string().optional(), +}) + +export const s_social_account = z.object({ + provider: z.string(), + url: z.string(), +}) + +export const s_ssh_signing_key = z.object({ + key: z.string(), + id: z.coerce.number(), + title: z.string(), + created_at: z.string().datetime({ offset: true }), +}) + +export const s_status_check_policy = z.object({ + url: z.string(), + strict: PermissiveBoolean, + contexts: z.array(z.string()), + checks: z.array( + z.object({ context: z.string(), app_id: z.coerce.number().nullable() }), + ), + contexts_url: z.string(), +}) + +export const s_sub_issues_summary = z.object({ + total: z.coerce.number(), + completed: z.coerce.number(), + percent_completed: z.coerce.number(), +}) + +export const s_tag = z.object({ + name: z.string(), + commit: z.object({ sha: z.string(), url: z.string() }), + zipball_url: z.string(), + tarball_url: z.string(), + node_id: z.string(), +}) + +export const s_tag_protection = z.object({ + id: z.coerce.number().optional(), + created_at: z.string().optional(), + updated_at: z.string().optional(), + enabled: PermissiveBoolean.optional(), + pattern: z.string(), +}) + +export const s_team_membership = z.object({ + url: z.string(), + role: z.enum(["member", "maintainer"]).default("member"), + state: z.enum(["active", "pending"]), +}) + +export const s_team_organization = z.object({ + login: z.string(), + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + repos_url: z.string(), + events_url: z.string(), + hooks_url: z.string(), + issues_url: z.string(), + members_url: z.string(), + public_members_url: z.string(), + avatar_url: z.string(), + description: z.string().nullable(), + name: z.string().optional(), + company: z.string().optional(), + blog: z.string().optional(), + location: z.string().optional(), + email: z.string().email().optional(), + twitter_username: z.string().nullable().optional(), + is_verified: PermissiveBoolean.optional(), + has_organization_projects: PermissiveBoolean, + has_repository_projects: PermissiveBoolean, + public_repos: z.coerce.number(), + public_gists: z.coerce.number(), + followers: z.coerce.number(), + following: z.coerce.number(), + html_url: z.string(), + created_at: z.string().datetime({ offset: true }), + type: z.string(), + total_private_repos: z.coerce.number().optional(), + owned_private_repos: z.coerce.number().optional(), + private_gists: z.coerce.number().nullable().optional(), + disk_usage: z.coerce.number().nullable().optional(), + collaborators: z.coerce.number().nullable().optional(), + billing_email: z.string().email().nullable().optional(), + plan: z + .object({ + name: z.string(), + space: z.coerce.number(), + private_repos: z.coerce.number(), + filled_seats: z.coerce.number().optional(), + seats: z.coerce.number().optional(), + }) + .optional(), + default_repository_permission: z.string().nullable().optional(), + members_can_create_repositories: PermissiveBoolean.nullable().optional(), + two_factor_requirement_enabled: PermissiveBoolean.nullable().optional(), + members_allowed_repository_creation_type: z.string().optional(), + members_can_create_public_repositories: PermissiveBoolean.optional(), + members_can_create_private_repositories: PermissiveBoolean.optional(), + members_can_create_internal_repositories: PermissiveBoolean.optional(), + members_can_create_pages: PermissiveBoolean.optional(), + members_can_create_public_pages: PermissiveBoolean.optional(), + members_can_create_private_pages: PermissiveBoolean.optional(), + members_can_fork_private_repositories: + PermissiveBoolean.nullable().optional(), + web_commit_signoff_required: PermissiveBoolean.optional(), + updated_at: z.string().datetime({ offset: true }), + archived_at: z.string().datetime({ offset: true }).nullable(), +}) + +export const s_team_simple = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + members_url: z.string(), + name: z.string(), + description: z.string().nullable(), + permission: z.string(), + privacy: z.string().optional(), + notification_setting: z.string().optional(), + html_url: z.string(), + repositories_url: z.string(), + slug: z.string(), + ldap_dn: z.string().optional(), +}) + +export const s_thread_subscription = z.object({ + subscribed: PermissiveBoolean, + ignored: PermissiveBoolean, + reason: z.string().nullable(), + created_at: z.string().datetime({ offset: true }).nullable(), + url: z.string(), + thread_url: z.string().optional(), + repository_url: z.string().optional(), +}) + +export const s_timeline_committed_event = z.object({ + event: z.string().optional(), + sha: z.string(), + node_id: z.string(), + url: z.string(), + author: z.object({ + date: z.string().datetime({ offset: true }), + email: z.string(), + name: z.string(), + }), + committer: z.object({ + date: z.string().datetime({ offset: true }), + email: z.string(), + name: z.string(), + }), + message: z.string(), + tree: z.object({ sha: z.string(), url: z.string() }), + parents: z.array( + z.object({ sha: z.string(), url: z.string(), html_url: z.string() }), + ), + verification: z.object({ + verified: PermissiveBoolean, + reason: z.string(), + signature: z.string().nullable(), + payload: z.string().nullable(), + verified_at: z.string().nullable(), + }), + html_url: z.string(), +}) + +export const s_topic = z.object({ names: z.array(z.string()) }) + +export const s_traffic = z.object({ + timestamp: z.string().datetime({ offset: true }), + uniques: z.coerce.number(), + count: z.coerce.number(), +}) + +export const s_validation_error = z.object({ + message: z.string(), + documentation_url: z.string(), + errors: z + .array( + z.object({ + resource: z.string().optional(), + field: z.string().optional(), + message: z.string().optional(), + code: z.string(), + index: z.coerce.number().optional(), + value: z + .union([ + z.string().nullable(), + z.coerce.number().nullable(), + z.array(z.string()).nullable(), + ]) + .optional(), + }), + ) + .optional(), +}) + +export const s_validation_error_simple = z.object({ + message: z.string(), + documentation_url: z.string(), + errors: z.array(z.string()).optional(), +}) + +export const s_verification = z.object({ + verified: PermissiveBoolean, + reason: z.string(), + payload: z.string().nullable(), + signature: z.string().nullable(), + verified_at: z.string().nullable(), +}) + +export const s_wait_timer = z.coerce.number() + +export const s_webhook_config_content_type = z.string() + +export const s_webhook_config_insecure_ssl = z.union([ + z.string(), + z.coerce.number(), +]) + +export const s_webhook_config_secret = z.string() + +export const s_webhook_config_url = z.string() + +export const s_workflow = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + path: z.string(), + state: z.enum([ + "active", + "deleted", + "disabled_fork", + "disabled_inactivity", + "disabled_manually", + ]), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + url: z.string(), + html_url: z.string(), + badge_url: z.string(), + deleted_at: z.string().datetime({ offset: true }).optional(), +}) + +export const s_workflow_run_usage = z.object({ + billable: z.object({ + UBUNTU: z + .object({ + total_ms: z.coerce.number(), + jobs: z.coerce.number(), + job_runs: z + .array( + z.object({ + job_id: z.coerce.number(), + duration_ms: z.coerce.number(), + }), + ) + .optional(), + }) + .optional(), + MACOS: z + .object({ + total_ms: z.coerce.number(), + jobs: z.coerce.number(), + job_runs: z + .array( + z.object({ + job_id: z.coerce.number(), + duration_ms: z.coerce.number(), + }), + ) + .optional(), + }) + .optional(), + WINDOWS: z + .object({ + total_ms: z.coerce.number(), + jobs: z.coerce.number(), + job_runs: z + .array( + z.object({ + job_id: z.coerce.number(), + duration_ms: z.coerce.number(), + }), + ) + .optional(), + }) + .optional(), + }), + run_duration_ms: z.coerce.number().optional(), +}) + +export const s_workflow_usage = z.object({ + billable: z.object({ + UBUNTU: z.object({ total_ms: z.coerce.number().optional() }).optional(), + MACOS: z.object({ total_ms: z.coerce.number().optional() }).optional(), + WINDOWS: z.object({ total_ms: z.coerce.number().optional() }).optional(), + }), +}) + +export const s_actions_get_default_workflow_permissions = z.object({ + default_workflow_permissions: s_actions_default_workflow_permissions, + can_approve_pull_request_reviews: s_actions_can_approve_pull_request_reviews, +}) + +export const s_actions_hosted_runner = z.object({ + id: z.coerce.number(), + name: z.string(), + runner_group_id: z.coerce.number().optional(), + image_details: s_nullable_actions_hosted_runner_pool_image, + machine_size_details: s_actions_hosted_runner_machine_spec, + status: z.enum(["Ready", "Provisioning", "Shutdown", "Deleting", "Stuck"]), + platform: z.string(), + maximum_runners: z.coerce.number().optional().default(10), + public_ip_enabled: PermissiveBoolean, + public_ips: z.array(s_public_ip).optional(), + last_active_on: z.string().datetime({ offset: true }).nullable().optional(), +}) + +export const s_actions_organization_permissions = z.object({ + enabled_repositories: s_enabled_repositories, + selected_repositories_url: z.string().optional(), + allowed_actions: s_allowed_actions.optional(), + selected_actions_url: s_selected_actions_url.optional(), +}) + +export const s_actions_repository_permissions = z.object({ + enabled: s_actions_enabled, + allowed_actions: s_allowed_actions.optional(), + selected_actions_url: s_selected_actions_url.optional(), +}) + +export const s_actions_set_default_workflow_permissions = z.object({ + default_workflow_permissions: + s_actions_default_workflow_permissions.optional(), + can_approve_pull_request_reviews: + s_actions_can_approve_pull_request_reviews.optional(), +}) + +export const s_activity = z.object({ + id: z.coerce.number(), + node_id: z.string(), + before: z.string(), + after: z.string(), + ref: z.string(), + timestamp: z.string().datetime({ offset: true }), + activity_type: z.enum([ + "push", + "force_push", + "branch_deletion", + "branch_creation", + "pr_merge", + "merge_queue_merge", + ]), + actor: s_nullable_simple_user, +}) + +export const s_auto_merge = z + .object({ + enabled_by: s_simple_user, + merge_method: z.enum(["merge", "squash", "rebase"]), + commit_title: z.string(), + commit_message: z.string(), + }) + .nullable() + +export const s_base_gist = z.object({ + url: z.string(), + forks_url: z.string(), + commits_url: z.string(), + id: z.string(), + node_id: z.string(), + git_pull_url: z.string(), + git_push_url: z.string(), + html_url: z.string(), + files: z.record( + z.object({ + filename: z.string().optional(), + type: z.string().optional(), + language: z.string().optional(), + raw_url: z.string().optional(), + size: z.coerce.number().optional(), + encoding: z.string().optional().default("utf-8"), + }), + ), + public: PermissiveBoolean, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + description: z.string().nullable(), + comments: z.coerce.number(), + comments_enabled: PermissiveBoolean.optional(), + user: s_nullable_simple_user, + comments_url: z.string(), + owner: s_simple_user.optional(), + truncated: PermissiveBoolean.optional(), + forks: z.array(z.unknown()).optional(), + history: z.array(z.unknown()).optional(), +}) + +export const s_classroom = z.object({ + id: z.coerce.number(), + name: z.string(), + archived: PermissiveBoolean, + organization: s_simple_classroom_organization, + url: z.string(), +}) + +export const s_clone_traffic = z.object({ + count: z.coerce.number(), + uniques: z.coerce.number(), + clones: z.array(s_traffic), +}) + +export const s_code_scanning_alert_instance = z.object({ + ref: s_code_scanning_ref.optional(), + analysis_key: s_code_scanning_analysis_analysis_key.optional(), + environment: s_code_scanning_alert_environment.optional(), + category: s_code_scanning_analysis_category.optional(), + state: s_code_scanning_alert_state.optional(), + commit_sha: z.string().optional(), + message: z.object({ text: z.string().optional() }).optional(), + location: s_code_scanning_alert_location.optional(), + html_url: z.string().optional(), + classifications: z.array(s_code_scanning_alert_classification).optional(), +}) + +export const s_code_scanning_analysis_tool = z.object({ + name: s_code_scanning_analysis_tool_name.optional(), + version: s_code_scanning_analysis_tool_version.optional(), + guid: s_code_scanning_analysis_tool_guid.optional(), +}) + +export const s_code_scanning_autofix = z.object({ + status: s_code_scanning_autofix_status, + description: s_code_scanning_autofix_description, + started_at: s_code_scanning_autofix_started_at, +}) + +export const s_code_scanning_codeql_database = z.object({ + id: z.coerce.number(), + name: z.string(), + language: z.string(), + uploader: s_simple_user, + content_type: z.string(), + size: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + url: z.string(), + commit_oid: z.string().nullable().optional(), +}) + +export const s_code_scanning_sarifs_receipt = z.object({ + id: s_code_scanning_analysis_sarif_id.optional(), + url: z.string().optional(), +}) + +export const s_code_scanning_variant_analysis_skipped_repo_group = z.object({ + repository_count: z.coerce.number(), + repositories: z.array(s_code_scanning_variant_analysis_repository), +}) + +export const s_code_security_configuration_for_repository = z.object({ + status: z + .enum([ + "attached", + "attaching", + "detached", + "removed", + "enforced", + "failed", + "updating", + "removed_by_enterprise", + ]) + .optional(), + configuration: s_code_security_configuration.optional(), +}) + +export const s_commit = z.object({ + url: z.string(), + sha: z.string(), + node_id: z.string(), + html_url: z.string(), + comments_url: z.string(), + commit: z.object({ + url: z.string(), + author: s_nullable_git_user, + committer: s_nullable_git_user, + message: z.string(), + comment_count: z.coerce.number(), + tree: z.object({ sha: z.string(), url: z.string() }), + verification: s_verification.optional(), + }), + author: z.union([s_simple_user, s_empty_object]).nullable(), + committer: z.union([s_simple_user, s_empty_object]).nullable(), + parents: z.array( + z.object({ + sha: z.string(), + url: z.string(), + html_url: z.string().optional(), + }), + ), + stats: z + .object({ + additions: z.coerce.number().optional(), + deletions: z.coerce.number().optional(), + total: z.coerce.number().optional(), + }) + .optional(), + files: z.array(s_diff_entry).optional(), +}) + +export const s_commit_comment = z.object({ + html_url: z.string(), + url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + body: z.string(), + path: z.string().nullable(), + position: z.coerce.number().nullable(), + line: z.coerce.number().nullable(), + commit_id: z.string(), + user: s_nullable_simple_user, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + author_association: s_author_association, + reactions: s_reaction_rollup.optional(), +}) + +export const s_community_profile = z.object({ + health_percentage: z.coerce.number(), + description: z.string().nullable(), + documentation: z.string().nullable(), + files: z.object({ + code_of_conduct: s_nullable_code_of_conduct_simple, + code_of_conduct_file: s_nullable_community_health_file, + license: s_nullable_license_simple, + contributing: s_nullable_community_health_file, + readme: s_nullable_community_health_file, + issue_template: s_nullable_community_health_file, + pull_request_template: s_nullable_community_health_file, + }), + updated_at: z.string().datetime({ offset: true }).nullable(), + content_reports_enabled: PermissiveBoolean.optional(), +}) + +export const s_contributor_activity = z.object({ + author: s_nullable_simple_user, + total: z.coerce.number(), + weeks: z.array( + z.object({ + w: z.coerce.number().optional(), + a: z.coerce.number().optional(), + d: z.coerce.number().optional(), + c: z.coerce.number().optional(), + }), + ), +}) + +export const s_copilot_organization_details = z.intersection( + z.object({ + seat_breakdown: s_copilot_organization_seat_breakdown, + public_code_suggestions: z.enum(["allow", "block", "unconfigured"]), + ide_chat: z.enum(["enabled", "disabled", "unconfigured"]).optional(), + platform_chat: z.enum(["enabled", "disabled", "unconfigured"]).optional(), + cli: z.enum(["enabled", "disabled", "unconfigured"]).optional(), + seat_management_setting: z.enum([ + "assign_all", + "assign_selected", + "disabled", + "unconfigured", + ]), + plan_type: z.enum(["business", "enterprise"]).optional(), + }), + z.record(z.unknown()), +) + +export const s_copilot_usage_metrics_day = z.intersection( + z.object({ + date: z.string(), + total_active_users: z.coerce.number().optional(), + total_engaged_users: z.coerce.number().optional(), + copilot_ide_code_completions: s_copilot_ide_code_completions.optional(), + copilot_ide_chat: s_copilot_ide_chat.optional(), + copilot_dotcom_chat: s_copilot_dotcom_chat.optional(), + copilot_dotcom_pull_requests: s_copilot_dotcom_pull_requests.optional(), + }), + z.record(z.unknown()), +) + +export const s_dependabot_alert_security_vulnerability = z.object({ + package: s_dependabot_alert_package, + severity: z.enum(["low", "medium", "high", "critical"]), + vulnerable_version_range: z.string(), + first_patched_version: z.object({ identifier: z.string() }).nullable(), +}) + +export const s_dependency = z.object({ + package_url: z.string().regex(new RegExp("^pkg")).optional(), + metadata: s_metadata.optional(), + relationship: z.enum(["direct", "indirect"]).optional(), + scope: z.enum(["runtime", "development"]).optional(), + dependencies: z.array(z.string()).optional(), +}) + +export const s_deployment_protection_rule = z.object({ + id: z.coerce.number(), + node_id: z.string(), + enabled: PermissiveBoolean, + app: s_custom_deployment_rule_app, +}) + +export const s_environment_approvals = z.object({ + environments: z.array( + z.object({ + id: z.coerce.number().optional(), + node_id: z.string().optional(), + name: z.string().optional(), + url: z.string().optional(), + html_url: z.string().optional(), + created_at: z.string().datetime({ offset: true }).optional(), + updated_at: z.string().datetime({ offset: true }).optional(), + }), + ), + state: z.enum(["approved", "rejected", "pending"]), + user: s_simple_user, + comment: z.string(), +}) + +export const s_feed = z.object({ + timeline_url: z.string(), + user_url: z.string(), + current_user_public_url: z.string().optional(), + current_user_url: z.string().optional(), + current_user_actor_url: z.string().optional(), + current_user_organization_url: z.string().optional(), + current_user_organization_urls: z.array(z.string()).optional(), + security_advisories_url: z.string().optional(), + repository_discussions_url: z.string().optional(), + repository_discussions_category_url: z.string().optional(), + _links: z.object({ + timeline: s_link_with_type, + user: s_link_with_type, + security_advisories: s_link_with_type.optional(), + current_user: s_link_with_type.optional(), + current_user_public: s_link_with_type.optional(), + current_user_actor: s_link_with_type.optional(), + current_user_organization: s_link_with_type.optional(), + current_user_organizations: z.array(s_link_with_type).optional(), + repository_discussions: s_link_with_type.optional(), + repository_discussions_category: s_link_with_type.optional(), + }), +}) + +export const s_gist_comment = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + body: z.string().max(65535), + user: s_nullable_simple_user, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + author_association: s_author_association, +}) + +export const s_gist_commit = z.object({ + url: z.string(), + version: z.string(), + user: s_nullable_simple_user, + change_status: z.object({ + total: z.coerce.number().optional(), + additions: z.coerce.number().optional(), + deletions: z.coerce.number().optional(), + }), + committed_at: z.string().datetime({ offset: true }), +}) + +export const s_gist_history = z.object({ + user: s_nullable_simple_user.optional(), + version: z.string().optional(), + committed_at: z.string().datetime({ offset: true }).optional(), + change_status: z + .object({ + total: z.coerce.number().optional(), + additions: z.coerce.number().optional(), + deletions: z.coerce.number().optional(), + }) + .optional(), + url: z.string().optional(), +}) + +export const s_git_tag = z.object({ + node_id: z.string(), + tag: z.string(), + sha: z.string(), + url: z.string(), + message: z.string(), + tagger: z.object({ date: z.string(), email: z.string(), name: z.string() }), + object: z.object({ sha: z.string(), type: z.string(), url: z.string() }), + verification: s_verification.optional(), +}) + +export const s_installation = z.object({ + id: z.coerce.number(), + account: z.union([s_simple_user, s_enterprise]).nullable(), + repository_selection: z.enum(["all", "selected"]), + access_tokens_url: z.string(), + repositories_url: z.string(), + html_url: z.string(), + app_id: z.coerce.number(), + target_id: z.coerce.number(), + target_type: z.string(), + permissions: s_app_permissions, + events: z.array(z.string()), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + single_file_name: z.string().nullable(), + has_multiple_single_files: PermissiveBoolean.optional(), + single_file_paths: z.array(z.string()).optional(), + app_slug: z.string(), + suspended_by: s_nullable_simple_user, + suspended_at: z.string().datetime({ offset: true }).nullable(), + contact_email: z.string().nullable().optional(), +}) + +export const s_integration = z + .object({ + id: z.coerce.number(), + slug: z.string().optional(), + node_id: z.string(), + client_id: z.string().optional(), + owner: z.union([s_simple_user, s_enterprise]), + name: z.string(), + description: z.string().nullable(), + external_url: z.string(), + html_url: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + permissions: z.intersection( + z.object({ + issues: z.string().optional(), + checks: z.string().optional(), + metadata: z.string().optional(), + contents: z.string().optional(), + deployments: z.string().optional(), + }), + z.record(z.string()), + ), + events: z.array(z.string()), + installations_count: z.coerce.number().optional(), + client_secret: z.string().optional(), + webhook_secret: z.string().nullable().optional(), + pem: z.string().optional(), + }) + .nullable() + +export const s_integration_installation_request = z.object({ + id: z.coerce.number(), + node_id: z.string().optional(), + account: z.union([s_simple_user, s_enterprise]), + requester: s_simple_user, + created_at: z.string().datetime({ offset: true }), +}) + +export const s_interaction_limit = z.object({ + limit: s_interaction_group, + expiry: s_interaction_expiry.optional(), +}) + +export const s_interaction_limit_response = z.object({ + limit: s_interaction_group, + origin: z.string(), + expires_at: z.string().datetime({ offset: true }), +}) + +export const s_label_search_result_item = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + name: z.string(), + color: z.string(), + default: PermissiveBoolean, + description: z.string().nullable(), + score: z.coerce.number(), + text_matches: s_search_result_text_matches.optional(), +}) + +export const s_license_content = z.object({ + name: z.string(), + path: z.string(), + sha: z.string(), + size: z.coerce.number(), + url: z.string(), + html_url: z.string().nullable(), + git_url: z.string().nullable(), + download_url: z.string().nullable(), + type: z.string(), + content: z.string(), + encoding: z.string(), + _links: z.object({ + git: z.string().nullable(), + html: z.string().nullable(), + self: z.string(), + }), + license: s_nullable_license_simple, +}) + +export const s_marketplace_purchase = z.object({ + url: z.string(), + type: z.string(), + id: z.coerce.number(), + login: z.string(), + organization_billing_email: z.string().optional(), + email: z.string().nullable().optional(), + marketplace_pending_change: z + .object({ + is_installed: PermissiveBoolean.optional(), + effective_date: z.string().optional(), + unit_count: z.coerce.number().nullable().optional(), + id: z.coerce.number().optional(), + plan: s_marketplace_listing_plan.optional(), + }) + .nullable() + .optional(), + marketplace_purchase: z.object({ + billing_cycle: z.string().optional(), + next_billing_date: z.string().nullable().optional(), + is_installed: PermissiveBoolean.optional(), + unit_count: z.coerce.number().nullable().optional(), + on_free_trial: PermissiveBoolean.optional(), + free_trial_ends_on: z.string().nullable().optional(), + updated_at: z.string().optional(), + plan: s_marketplace_listing_plan.optional(), + }), +}) + +export const s_milestone = z.object({ + url: z.string(), + html_url: z.string(), + labels_url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + number: z.coerce.number(), + state: z.enum(["open", "closed"]).default("open"), + title: z.string(), + description: z.string().nullable(), + creator: s_nullable_simple_user, + open_issues: z.coerce.number(), + closed_issues: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + closed_at: z.string().datetime({ offset: true }).nullable(), + due_on: z.string().datetime({ offset: true }).nullable(), +}) + +export const s_minimal_repository = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + full_name: z.string(), + owner: s_simple_user, + private: PermissiveBoolean, + html_url: z.string(), + description: z.string().nullable(), + fork: PermissiveBoolean, + url: z.string(), + archive_url: z.string(), + assignees_url: z.string(), + blobs_url: z.string(), + branches_url: z.string(), + collaborators_url: z.string(), + comments_url: z.string(), + commits_url: z.string(), + compare_url: z.string(), + contents_url: z.string(), + contributors_url: z.string(), + deployments_url: z.string(), + downloads_url: z.string(), + events_url: z.string(), + forks_url: z.string(), + git_commits_url: z.string(), + git_refs_url: z.string(), + git_tags_url: z.string(), + git_url: z.string().optional(), + issue_comment_url: z.string(), + issue_events_url: z.string(), + issues_url: z.string(), + keys_url: z.string(), + labels_url: z.string(), + languages_url: z.string(), + merges_url: z.string(), + milestones_url: z.string(), + notifications_url: z.string(), + pulls_url: z.string(), + releases_url: z.string(), + ssh_url: z.string().optional(), + stargazers_url: z.string(), + statuses_url: z.string(), + subscribers_url: z.string(), + subscription_url: z.string(), + tags_url: z.string(), + teams_url: z.string(), + trees_url: z.string(), + clone_url: z.string().optional(), + mirror_url: z.string().nullable().optional(), + hooks_url: z.string(), + svn_url: z.string().optional(), + homepage: z.string().nullable().optional(), + language: z.string().nullable().optional(), + forks_count: z.coerce.number().optional(), + stargazers_count: z.coerce.number().optional(), + watchers_count: z.coerce.number().optional(), + size: z.coerce.number().optional(), + default_branch: z.string().optional(), + open_issues_count: z.coerce.number().optional(), + is_template: PermissiveBoolean.optional(), + topics: z.array(z.string()).optional(), + has_issues: PermissiveBoolean.optional(), + has_projects: PermissiveBoolean.optional(), + has_wiki: PermissiveBoolean.optional(), + has_pages: PermissiveBoolean.optional(), + has_downloads: PermissiveBoolean.optional(), + has_discussions: PermissiveBoolean.optional(), + archived: PermissiveBoolean.optional(), + disabled: PermissiveBoolean.optional(), + visibility: z.string().optional(), + pushed_at: z.string().datetime({ offset: true }).nullable().optional(), + created_at: z.string().datetime({ offset: true }).nullable().optional(), + updated_at: z.string().datetime({ offset: true }).nullable().optional(), + permissions: z + .object({ + admin: PermissiveBoolean.optional(), + maintain: PermissiveBoolean.optional(), + push: PermissiveBoolean.optional(), + triage: PermissiveBoolean.optional(), + pull: PermissiveBoolean.optional(), + }) + .optional(), + role_name: z.string().optional(), + temp_clone_token: z.string().optional(), + delete_branch_on_merge: PermissiveBoolean.optional(), + subscribers_count: z.coerce.number().optional(), + network_count: z.coerce.number().optional(), + code_of_conduct: s_code_of_conduct.optional(), + license: z + .object({ + key: z.string().optional(), + name: z.string().optional(), + spdx_id: z.string().optional(), + url: z.string().optional(), + node_id: z.string().optional(), + }) + .nullable() + .optional(), + forks: z.coerce.number().optional(), + open_issues: z.coerce.number().optional(), + watchers: z.coerce.number().optional(), + allow_forking: PermissiveBoolean.optional(), + web_commit_signoff_required: PermissiveBoolean.optional(), + security_and_analysis: s_security_and_analysis.optional(), +}) + +export const s_nullable_integration = z + .object({ + id: z.coerce.number(), + slug: z.string().optional(), + node_id: z.string(), + client_id: z.string().optional(), + owner: z.union([s_simple_user, s_enterprise]), + name: z.string(), + description: z.string().nullable(), + external_url: z.string(), + html_url: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + permissions: z.intersection( + z.object({ + issues: z.string().optional(), + checks: z.string().optional(), + metadata: z.string().optional(), + contents: z.string().optional(), + deployments: z.string().optional(), + }), + z.record(z.string()), + ), + events: z.array(z.string()), + installations_count: z.coerce.number().optional(), + client_secret: z.string().optional(), + webhook_secret: z.string().nullable().optional(), + pem: z.string().optional(), + }) + .nullable() + +export const s_nullable_milestone = z + .object({ + url: z.string(), + html_url: z.string(), + labels_url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + number: z.coerce.number(), + state: z.enum(["open", "closed"]).default("open"), + title: z.string(), + description: z.string().nullable(), + creator: s_nullable_simple_user, + open_issues: z.coerce.number(), + closed_issues: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + closed_at: z.string().datetime({ offset: true }).nullable(), + due_on: z.string().datetime({ offset: true }).nullable(), + }) + .nullable() + +export const s_nullable_minimal_repository = z + .object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + full_name: z.string(), + owner: s_simple_user, + private: PermissiveBoolean, + html_url: z.string(), + description: z.string().nullable(), + fork: PermissiveBoolean, + url: z.string(), + archive_url: z.string(), + assignees_url: z.string(), + blobs_url: z.string(), + branches_url: z.string(), + collaborators_url: z.string(), + comments_url: z.string(), + commits_url: z.string(), + compare_url: z.string(), + contents_url: z.string(), + contributors_url: z.string(), + deployments_url: z.string(), + downloads_url: z.string(), + events_url: z.string(), + forks_url: z.string(), + git_commits_url: z.string(), + git_refs_url: z.string(), + git_tags_url: z.string(), + git_url: z.string().optional(), + issue_comment_url: z.string(), + issue_events_url: z.string(), + issues_url: z.string(), + keys_url: z.string(), + labels_url: z.string(), + languages_url: z.string(), + merges_url: z.string(), + milestones_url: z.string(), + notifications_url: z.string(), + pulls_url: z.string(), + releases_url: z.string(), + ssh_url: z.string().optional(), + stargazers_url: z.string(), + statuses_url: z.string(), + subscribers_url: z.string(), + subscription_url: z.string(), + tags_url: z.string(), + teams_url: z.string(), + trees_url: z.string(), + clone_url: z.string().optional(), + mirror_url: z.string().nullable().optional(), + hooks_url: z.string(), + svn_url: z.string().optional(), + homepage: z.string().nullable().optional(), + language: z.string().nullable().optional(), + forks_count: z.coerce.number().optional(), + stargazers_count: z.coerce.number().optional(), + watchers_count: z.coerce.number().optional(), + size: z.coerce.number().optional(), + default_branch: z.string().optional(), + open_issues_count: z.coerce.number().optional(), + is_template: PermissiveBoolean.optional(), + topics: z.array(z.string()).optional(), + has_issues: PermissiveBoolean.optional(), + has_projects: PermissiveBoolean.optional(), + has_wiki: PermissiveBoolean.optional(), + has_pages: PermissiveBoolean.optional(), + has_downloads: PermissiveBoolean.optional(), + has_discussions: PermissiveBoolean.optional(), + archived: PermissiveBoolean.optional(), + disabled: PermissiveBoolean.optional(), + visibility: z.string().optional(), + pushed_at: z.string().datetime({ offset: true }).nullable().optional(), + created_at: z.string().datetime({ offset: true }).nullable().optional(), + updated_at: z.string().datetime({ offset: true }).nullable().optional(), + permissions: z + .object({ + admin: PermissiveBoolean.optional(), + maintain: PermissiveBoolean.optional(), + push: PermissiveBoolean.optional(), + triage: PermissiveBoolean.optional(), + pull: PermissiveBoolean.optional(), + }) + .optional(), + role_name: z.string().optional(), + temp_clone_token: z.string().optional(), + delete_branch_on_merge: PermissiveBoolean.optional(), + subscribers_count: z.coerce.number().optional(), + network_count: z.coerce.number().optional(), + code_of_conduct: s_code_of_conduct.optional(), + license: z + .object({ + key: z.string().optional(), + name: z.string().optional(), + spdx_id: z.string().optional(), + url: z.string().optional(), + node_id: z.string().optional(), + }) + .nullable() + .optional(), + forks: z.coerce.number().optional(), + open_issues: z.coerce.number().optional(), + watchers: z.coerce.number().optional(), + allow_forking: PermissiveBoolean.optional(), + web_commit_signoff_required: PermissiveBoolean.optional(), + security_and_analysis: s_security_and_analysis.optional(), + }) + .nullable() + +export const s_nullable_repository = z + .object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + full_name: z.string(), + license: s_nullable_license_simple, + forks: z.coerce.number(), + permissions: z + .object({ + admin: PermissiveBoolean, + pull: PermissiveBoolean, + triage: PermissiveBoolean.optional(), + push: PermissiveBoolean, + maintain: PermissiveBoolean.optional(), + }) + .optional(), + owner: s_simple_user, + private: PermissiveBoolean.default(false), + html_url: z.string(), + description: z.string().nullable(), + fork: PermissiveBoolean, + url: z.string(), + archive_url: z.string(), + assignees_url: z.string(), + blobs_url: z.string(), + branches_url: z.string(), + collaborators_url: z.string(), + comments_url: z.string(), + commits_url: z.string(), + compare_url: z.string(), + contents_url: z.string(), + contributors_url: z.string(), + deployments_url: z.string(), + downloads_url: z.string(), + events_url: z.string(), + forks_url: z.string(), + git_commits_url: z.string(), + git_refs_url: z.string(), + git_tags_url: z.string(), + git_url: z.string(), + issue_comment_url: z.string(), + issue_events_url: z.string(), + issues_url: z.string(), + keys_url: z.string(), + labels_url: z.string(), + languages_url: z.string(), + merges_url: z.string(), + milestones_url: z.string(), + notifications_url: z.string(), + pulls_url: z.string(), + releases_url: z.string(), + ssh_url: z.string(), + stargazers_url: z.string(), + statuses_url: z.string(), + subscribers_url: z.string(), + subscription_url: z.string(), + tags_url: z.string(), + teams_url: z.string(), + trees_url: z.string(), + clone_url: z.string(), + mirror_url: z.string().nullable(), + hooks_url: z.string(), + svn_url: z.string(), + homepage: z.string().nullable(), + language: z.string().nullable(), + forks_count: z.coerce.number(), + stargazers_count: z.coerce.number(), + watchers_count: z.coerce.number(), + size: z.coerce.number(), + default_branch: z.string(), + open_issues_count: z.coerce.number(), + is_template: PermissiveBoolean.optional().default(false), + topics: z.array(z.string()).optional(), + has_issues: PermissiveBoolean.default(true), + has_projects: PermissiveBoolean.default(true), + has_wiki: PermissiveBoolean.default(true), + has_pages: PermissiveBoolean, + has_downloads: PermissiveBoolean.default(true), + has_discussions: PermissiveBoolean.optional().default(false), + archived: PermissiveBoolean.default(false), + disabled: PermissiveBoolean, + visibility: z.string().optional().default("public"), + pushed_at: z.string().datetime({ offset: true }).nullable(), + created_at: z.string().datetime({ offset: true }).nullable(), + updated_at: z.string().datetime({ offset: true }).nullable(), + allow_rebase_merge: PermissiveBoolean.optional().default(true), + temp_clone_token: z.string().optional(), + allow_squash_merge: PermissiveBoolean.optional().default(true), + allow_auto_merge: PermissiveBoolean.optional().default(false), + delete_branch_on_merge: PermissiveBoolean.optional().default(false), + allow_update_branch: PermissiveBoolean.optional().default(false), + use_squash_pr_title_as_default: PermissiveBoolean.optional().default(false), + squash_merge_commit_title: z + .enum(["PR_TITLE", "COMMIT_OR_PR_TITLE"]) + .optional(), + squash_merge_commit_message: z + .enum(["PR_BODY", "COMMIT_MESSAGES", "BLANK"]) + .optional(), + merge_commit_title: z.enum(["PR_TITLE", "MERGE_MESSAGE"]).optional(), + merge_commit_message: z.enum(["PR_BODY", "PR_TITLE", "BLANK"]).optional(), + allow_merge_commit: PermissiveBoolean.optional().default(true), + allow_forking: PermissiveBoolean.optional(), + web_commit_signoff_required: PermissiveBoolean.optional().default(false), + open_issues: z.coerce.number(), + watchers: z.coerce.number(), + master_branch: z.string().optional(), + starred_at: z.string().optional(), + anonymous_access_enabled: PermissiveBoolean.optional(), + }) + .nullable() + +export const s_nullable_scoped_installation = z + .object({ + permissions: s_app_permissions, + repository_selection: z.enum(["all", "selected"]), + single_file_name: z.string().nullable(), + has_multiple_single_files: PermissiveBoolean.optional(), + single_file_paths: z.array(z.string()).optional(), + repositories_url: z.string(), + account: s_simple_user, + }) + .nullable() + +export const s_org_membership = z.object({ + url: z.string(), + state: z.enum(["active", "pending"]), + role: z.enum(["admin", "member", "billing_manager"]), + organization_url: z.string(), + organization: s_organization_simple, + user: s_nullable_simple_user, + permissions: z + .object({ can_create_repository: PermissiveBoolean }) + .optional(), +}) + +export const s_org_repo_custom_property_values = z.object({ + repository_id: z.coerce.number(), + repository_name: z.string(), + repository_full_name: z.string(), + properties: z.array(s_custom_property_value), +}) + +export const s_organization_invitation = z.object({ + id: z.coerce.number(), + login: z.string().nullable(), + email: z.string().nullable(), + role: z.string(), + created_at: z.string(), + failed_at: z.string().nullable().optional(), + failed_reason: z.string().nullable().optional(), + inviter: s_simple_user, + team_count: z.coerce.number(), + node_id: z.string(), + invitation_teams_url: z.string(), + invitation_source: z.string().optional(), +}) + +export const s_organization_programmatic_access_grant = z.object({ + id: z.coerce.number(), + owner: s_simple_user, + repository_selection: z.enum(["none", "all", "subset"]), + repositories_url: z.string(), + permissions: z.object({ + organization: z.record(z.string()).optional(), + repository: z.record(z.string()).optional(), + other: z.record(z.string()).optional(), + }), + access_granted_at: z.string(), + token_id: z.coerce.number(), + token_name: z.string(), + token_expired: PermissiveBoolean, + token_expires_at: z.string().nullable(), + token_last_used_at: z.string().nullable(), +}) + +export const s_organization_programmatic_access_grant_request = z.object({ + id: z.coerce.number(), + reason: z.string().nullable(), + owner: s_simple_user, + repository_selection: z.enum(["none", "all", "subset"]), + repositories_url: z.string(), + permissions: z.object({ + organization: z.record(z.string()).optional(), + repository: z.record(z.string()).optional(), + other: z.record(z.string()).optional(), + }), + created_at: z.string(), + token_id: z.coerce.number(), + token_name: z.string(), + token_expired: PermissiveBoolean, + token_expires_at: z.string().nullable(), + token_last_used_at: z.string().nullable(), +}) + +export const s_organization_role = z.object({ + id: z.coerce.number(), + name: z.string(), + description: z.string().nullable().optional(), + base_role: z + .enum(["read", "triage", "write", "maintain", "admin"]) + .nullable() + .optional(), + source: z + .enum(["Organization", "Enterprise", "Predefined"]) + .nullable() + .optional(), + permissions: z.array(z.string()), + organization: s_nullable_simple_user, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_page = z.object({ + url: z.string(), + status: z.enum(["built", "building", "errored"]).nullable(), + cname: z.string().nullable(), + protected_domain_state: z + .enum(["pending", "verified", "unverified"]) + .nullable() + .optional(), + pending_domain_unverified_at: z + .string() + .datetime({ offset: true }) + .nullable() + .optional(), + custom_404: PermissiveBoolean.default(false), + html_url: z.string().optional(), + build_type: z.enum(["legacy", "workflow"]).nullable().optional(), + source: s_pages_source_hash.optional(), + public: PermissiveBoolean, + https_certificate: s_pages_https_certificate.optional(), + https_enforced: PermissiveBoolean.optional(), +}) + +export const s_page_build = z.object({ + url: z.string(), + status: z.string(), + error: z.object({ message: z.string().nullable() }), + pusher: s_nullable_simple_user, + commit: z.string(), + duration: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_private_vulnerability_report_create = z.object({ + summary: z.string().max(1024), + description: z.string().max(65535), + vulnerabilities: z + .array( + z.object({ + package: z.object({ + ecosystem: s_security_advisory_ecosystems, + name: z.string().nullable().optional(), + }), + vulnerable_version_range: z.string().nullable().optional(), + patched_versions: z.string().nullable().optional(), + vulnerable_functions: z.array(z.string()).nullable().optional(), + }), + ) + .nullable() + .optional(), + cwe_ids: z.array(z.string()).nullable().optional(), + severity: z.enum(["critical", "high", "medium", "low"]).nullable().optional(), + cvss_vector_string: z.string().nullable().optional(), + start_private_fork: PermissiveBoolean.optional().default(false), +}) + +export const s_project = z.object({ + owner_url: z.string(), + url: z.string(), + html_url: z.string(), + columns_url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + body: z.string().nullable(), + number: z.coerce.number(), + state: z.string(), + creator: s_nullable_simple_user, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + organization_permission: z + .enum(["read", "write", "admin", "none"]) + .optional(), + private: PermissiveBoolean.optional(), +}) + +export const s_project_card = z.object({ + url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + note: z.string().nullable(), + creator: s_nullable_simple_user, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + archived: PermissiveBoolean.optional(), + column_name: z.string().optional(), + project_id: z.string().optional(), + column_url: z.string(), + content_url: z.string().optional(), + project_url: z.string(), +}) + +export const s_project_collaborator_permission = z.object({ + permission: z.string(), + user: s_nullable_simple_user, +}) + +export const s_pull_request_review = z.object({ + id: z.coerce.number(), + node_id: z.string(), + user: s_nullable_simple_user, + body: z.string(), + state: z.string(), + html_url: z.string(), + pull_request_url: z.string(), + _links: z.object({ + html: z.object({ href: z.string() }), + pull_request: z.object({ href: z.string() }), + }), + submitted_at: z.string().datetime({ offset: true }).optional(), + commit_id: z.string().nullable(), + body_html: z.string().optional(), + body_text: z.string().optional(), + author_association: s_author_association, +}) + +export const s_pull_request_review_comment = z.object({ + url: z.string(), + pull_request_review_id: z.coerce.number().nullable(), + id: z.coerce.number(), + node_id: z.string(), + diff_hunk: z.string(), + path: z.string(), + position: z.coerce.number().optional(), + original_position: z.coerce.number().optional(), + commit_id: z.string(), + original_commit_id: z.string(), + in_reply_to_id: z.coerce.number().optional(), + user: s_simple_user, + body: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + html_url: z.string(), + pull_request_url: z.string(), + author_association: s_author_association, + _links: z.object({ + self: z.object({ href: z.string() }), + html: z.object({ href: z.string() }), + pull_request: z.object({ href: z.string() }), + }), + start_line: z.coerce.number().nullable().optional(), + original_start_line: z.coerce.number().nullable().optional(), + start_side: z.enum(["LEFT", "RIGHT"]).nullable().optional().default("RIGHT"), + line: z.coerce.number().optional(), + original_line: z.coerce.number().optional(), + side: z.enum(["LEFT", "RIGHT"]).optional().default("RIGHT"), + subject_type: z.enum(["line", "file"]).optional(), + reactions: s_reaction_rollup.optional(), + body_html: z.string().optional(), + body_text: z.string().optional(), +}) + +export const s_rate_limit_overview = z.object({ + resources: z.object({ + core: s_rate_limit, + graphql: s_rate_limit.optional(), + search: s_rate_limit, + code_search: s_rate_limit.optional(), + source_import: s_rate_limit.optional(), + integration_manifest: s_rate_limit.optional(), + code_scanning_upload: s_rate_limit.optional(), + actions_runner_registration: s_rate_limit.optional(), + scim: s_rate_limit.optional(), + dependency_snapshots: s_rate_limit.optional(), + code_scanning_autofix: s_rate_limit.optional(), + }), + rate: s_rate_limit, +}) + +export const s_reaction = z.object({ + id: z.coerce.number(), + node_id: z.string(), + user: s_nullable_simple_user, + content: z.enum([ + "+1", + "-1", + "laugh", + "confused", + "heart", + "hooray", + "rocket", + "eyes", + ]), + created_at: z.string().datetime({ offset: true }), +}) + +export const s_release_asset = z.object({ + url: z.string(), + browser_download_url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + label: z.string().nullable(), + state: z.enum(["uploaded", "open"]), + content_type: z.string(), + size: z.coerce.number(), + download_count: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + uploader: s_nullable_simple_user, +}) + +export const s_repo_search_result_item = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + full_name: z.string(), + owner: s_nullable_simple_user, + private: PermissiveBoolean, + html_url: z.string(), + description: z.string().nullable(), + fork: PermissiveBoolean, + url: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + pushed_at: z.string().datetime({ offset: true }), + homepage: z.string().nullable(), + size: z.coerce.number(), + stargazers_count: z.coerce.number(), + watchers_count: z.coerce.number(), + language: z.string().nullable(), + forks_count: z.coerce.number(), + open_issues_count: z.coerce.number(), + master_branch: z.string().optional(), + default_branch: z.string(), + score: z.coerce.number(), + forks_url: z.string(), + keys_url: z.string(), + collaborators_url: z.string(), + teams_url: z.string(), + hooks_url: z.string(), + issue_events_url: z.string(), + events_url: z.string(), + assignees_url: z.string(), + branches_url: z.string(), + tags_url: z.string(), + blobs_url: z.string(), + git_tags_url: z.string(), + git_refs_url: z.string(), + trees_url: z.string(), + statuses_url: z.string(), + languages_url: z.string(), + stargazers_url: z.string(), + contributors_url: z.string(), + subscribers_url: z.string(), + subscription_url: z.string(), + commits_url: z.string(), + git_commits_url: z.string(), + comments_url: z.string(), + issue_comment_url: z.string(), + contents_url: z.string(), + compare_url: z.string(), + merges_url: z.string(), + archive_url: z.string(), + downloads_url: z.string(), + issues_url: z.string(), + pulls_url: z.string(), + milestones_url: z.string(), + notifications_url: z.string(), + labels_url: z.string(), + releases_url: z.string(), + deployments_url: z.string(), + git_url: z.string(), + ssh_url: z.string(), + clone_url: z.string(), + svn_url: z.string(), + forks: z.coerce.number(), + open_issues: z.coerce.number(), + watchers: z.coerce.number(), + topics: z.array(z.string()).optional(), + mirror_url: z.string().nullable(), + has_issues: PermissiveBoolean, + has_projects: PermissiveBoolean, + has_pages: PermissiveBoolean, + has_wiki: PermissiveBoolean, + has_downloads: PermissiveBoolean, + has_discussions: PermissiveBoolean.optional(), + archived: PermissiveBoolean, + disabled: PermissiveBoolean, + visibility: z.string().optional(), + license: s_nullable_license_simple, + permissions: z + .object({ + admin: PermissiveBoolean, + maintain: PermissiveBoolean.optional(), + push: PermissiveBoolean, + triage: PermissiveBoolean.optional(), + pull: PermissiveBoolean, + }) + .optional(), + text_matches: s_search_result_text_matches.optional(), + temp_clone_token: z.string().optional(), + allow_merge_commit: PermissiveBoolean.optional(), + allow_squash_merge: PermissiveBoolean.optional(), + allow_rebase_merge: PermissiveBoolean.optional(), + allow_auto_merge: PermissiveBoolean.optional(), + delete_branch_on_merge: PermissiveBoolean.optional(), + allow_forking: PermissiveBoolean.optional(), + is_template: PermissiveBoolean.optional(), + web_commit_signoff_required: PermissiveBoolean.optional(), +}) + +export const s_repository = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + full_name: z.string(), + license: s_nullable_license_simple, + forks: z.coerce.number(), + permissions: z + .object({ + admin: PermissiveBoolean, + pull: PermissiveBoolean, + triage: PermissiveBoolean.optional(), + push: PermissiveBoolean, + maintain: PermissiveBoolean.optional(), + }) + .optional(), + owner: s_simple_user, + private: PermissiveBoolean.default(false), + html_url: z.string(), + description: z.string().nullable(), + fork: PermissiveBoolean, + url: z.string(), + archive_url: z.string(), + assignees_url: z.string(), + blobs_url: z.string(), + branches_url: z.string(), + collaborators_url: z.string(), + comments_url: z.string(), + commits_url: z.string(), + compare_url: z.string(), + contents_url: z.string(), + contributors_url: z.string(), + deployments_url: z.string(), + downloads_url: z.string(), + events_url: z.string(), + forks_url: z.string(), + git_commits_url: z.string(), + git_refs_url: z.string(), + git_tags_url: z.string(), + git_url: z.string(), + issue_comment_url: z.string(), + issue_events_url: z.string(), + issues_url: z.string(), + keys_url: z.string(), + labels_url: z.string(), + languages_url: z.string(), + merges_url: z.string(), + milestones_url: z.string(), + notifications_url: z.string(), + pulls_url: z.string(), + releases_url: z.string(), + ssh_url: z.string(), + stargazers_url: z.string(), + statuses_url: z.string(), + subscribers_url: z.string(), + subscription_url: z.string(), + tags_url: z.string(), + teams_url: z.string(), + trees_url: z.string(), + clone_url: z.string(), + mirror_url: z.string().nullable(), + hooks_url: z.string(), + svn_url: z.string(), + homepage: z.string().nullable(), + language: z.string().nullable(), + forks_count: z.coerce.number(), + stargazers_count: z.coerce.number(), + watchers_count: z.coerce.number(), + size: z.coerce.number(), + default_branch: z.string(), + open_issues_count: z.coerce.number(), + is_template: PermissiveBoolean.optional().default(false), + topics: z.array(z.string()).optional(), + has_issues: PermissiveBoolean.default(true), + has_projects: PermissiveBoolean.default(true), + has_wiki: PermissiveBoolean.default(true), + has_pages: PermissiveBoolean, + has_downloads: PermissiveBoolean.default(true), + has_discussions: PermissiveBoolean.optional().default(false), + archived: PermissiveBoolean.default(false), + disabled: PermissiveBoolean, + visibility: z.string().optional().default("public"), + pushed_at: z.string().datetime({ offset: true }).nullable(), + created_at: z.string().datetime({ offset: true }).nullable(), + updated_at: z.string().datetime({ offset: true }).nullable(), + allow_rebase_merge: PermissiveBoolean.optional().default(true), + temp_clone_token: z.string().optional(), + allow_squash_merge: PermissiveBoolean.optional().default(true), + allow_auto_merge: PermissiveBoolean.optional().default(false), + delete_branch_on_merge: PermissiveBoolean.optional().default(false), + allow_update_branch: PermissiveBoolean.optional().default(false), + use_squash_pr_title_as_default: PermissiveBoolean.optional().default(false), + squash_merge_commit_title: z + .enum(["PR_TITLE", "COMMIT_OR_PR_TITLE"]) + .optional(), + squash_merge_commit_message: z + .enum(["PR_BODY", "COMMIT_MESSAGES", "BLANK"]) + .optional(), + merge_commit_title: z.enum(["PR_TITLE", "MERGE_MESSAGE"]).optional(), + merge_commit_message: z.enum(["PR_BODY", "PR_TITLE", "BLANK"]).optional(), + allow_merge_commit: PermissiveBoolean.optional().default(true), + allow_forking: PermissiveBoolean.optional(), + web_commit_signoff_required: PermissiveBoolean.optional().default(false), + open_issues: z.coerce.number(), + watchers: z.coerce.number(), + master_branch: z.string().optional(), + starred_at: z.string().optional(), + anonymous_access_enabled: PermissiveBoolean.optional(), +}) + +export const s_repository_advisory_create = z.object({ + summary: z.string().max(1024), + description: z.string().max(65535), + cve_id: z.string().nullable().optional(), + vulnerabilities: z.array( + z.object({ + package: z.object({ + ecosystem: s_security_advisory_ecosystems, + name: z.string().nullable().optional(), + }), + vulnerable_version_range: z.string().nullable().optional(), + patched_versions: z.string().nullable().optional(), + vulnerable_functions: z.array(z.string()).nullable().optional(), + }), + ), + cwe_ids: z.array(z.string()).nullable().optional(), + credits: z + .array( + z.object({ login: z.string(), type: s_security_advisory_credit_types }), + ) + .nullable() + .optional(), + severity: z.enum(["critical", "high", "medium", "low"]).nullable().optional(), + cvss_vector_string: z.string().nullable().optional(), + start_private_fork: PermissiveBoolean.optional().default(false), +}) + +export const s_repository_advisory_credit = z.object({ + user: s_simple_user, + type: s_security_advisory_credit_types, + state: z.enum(["accepted", "declined", "pending"]), +}) + +export const s_repository_advisory_update = z.object({ + summary: z.string().max(1024).optional(), + description: z.string().max(65535).optional(), + cve_id: z.string().nullable().optional(), + vulnerabilities: z + .array( + z.object({ + package: z.object({ + ecosystem: s_security_advisory_ecosystems, + name: z.string().nullable().optional(), + }), + vulnerable_version_range: z.string().nullable().optional(), + patched_versions: z.string().nullable().optional(), + vulnerable_functions: z.array(z.string()).nullable().optional(), + }), + ) + .optional(), + cwe_ids: z.array(z.string()).nullable().optional(), + credits: z + .array( + z.object({ login: z.string(), type: s_security_advisory_credit_types }), + ) + .nullable() + .optional(), + severity: z.enum(["critical", "high", "medium", "low"]).nullable().optional(), + cvss_vector_string: z.string().nullable().optional(), + state: z.enum(["published", "closed", "draft"]).optional(), + collaborating_users: z.array(z.string()).nullable().optional(), + collaborating_teams: z.array(z.string()).nullable().optional(), +}) + +export const s_repository_advisory_vulnerability = z.object({ + package: z + .object({ + ecosystem: s_security_advisory_ecosystems, + name: z.string().nullable(), + }) + .nullable(), + vulnerable_version_range: z.string().nullable(), + patched_versions: z.string().nullable(), + vulnerable_functions: z.array(z.string()).nullable(), +}) + +export const s_repository_collaborator_permission = z.object({ + permission: z.string(), + role_name: z.string(), + user: s_nullable_collaborator, +}) + +export const s_repository_rule_code_scanning = z.object({ + type: z.enum(["code_scanning"]), + parameters: z + .object({ + code_scanning_tools: z.array(s_repository_rule_params_code_scanning_tool), + }) + .optional(), +}) + +export const s_repository_rule_required_status_checks = z.object({ + type: z.enum(["required_status_checks"]), + parameters: z + .object({ + do_not_enforce_on_create: PermissiveBoolean.optional(), + required_status_checks: z.array( + s_repository_rule_params_status_check_configuration, + ), + strict_required_status_checks_policy: PermissiveBoolean, + }) + .optional(), +}) + +export const s_repository_rule_violation_error = z.object({ + message: z.string().optional(), + documentation_url: z.string().optional(), + status: z.string().optional(), + metadata: z + .object({ + secret_scanning: z + .object({ + bypass_placeholders: z + .array( + z.object({ + placeholder_id: + s_secret_scanning_push_protection_bypass_placeholder_id.optional(), + token_type: z.string().optional(), + }), + ) + .optional(), + }) + .optional(), + }) + .optional(), +}) + +export const s_repository_rule_workflows = z.object({ + type: z.enum(["workflows"]), + parameters: z + .object({ + do_not_enforce_on_create: PermissiveBoolean.optional(), + workflows: z.array(s_repository_rule_params_workflow_file_reference), + }) + .optional(), +}) + +export const s_repository_ruleset_conditions_repository_property_target = + z.object({ + repository_property: z.object({ + include: z + .array(s_repository_ruleset_conditions_repository_property_spec) + .optional(), + exclude: z + .array(s_repository_ruleset_conditions_repository_property_spec) + .optional(), + }), + }) + +export const s_review_comment = z.object({ + url: z.string(), + pull_request_review_id: z.coerce.number().nullable(), + id: z.coerce.number(), + node_id: z.string(), + diff_hunk: z.string(), + path: z.string(), + position: z.coerce.number().nullable(), + original_position: z.coerce.number(), + commit_id: z.string(), + original_commit_id: z.string(), + in_reply_to_id: z.coerce.number().optional(), + user: s_nullable_simple_user, + body: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + html_url: z.string(), + pull_request_url: z.string(), + author_association: s_author_association, + _links: z.object({ self: s_link, html: s_link, pull_request: s_link }), + body_text: z.string().optional(), + body_html: z.string().optional(), + reactions: s_reaction_rollup.optional(), + side: z.enum(["LEFT", "RIGHT"]).optional().default("RIGHT"), + start_side: z.enum(["LEFT", "RIGHT"]).nullable().optional().default("RIGHT"), + line: z.coerce.number().optional(), + original_line: z.coerce.number().optional(), + start_line: z.coerce.number().nullable().optional(), + original_start_line: z.coerce.number().nullable().optional(), +}) + +export const s_ruleset_version_with_state = s_ruleset_version.merge( + z.object({ state: z.object({}) }), +) + +export const s_runner = z.object({ + id: z.coerce.number(), + runner_group_id: z.coerce.number().optional(), + name: z.string(), + os: z.string(), + status: z.string(), + busy: PermissiveBoolean, + labels: z.array(s_runner_label), + ephemeral: PermissiveBoolean.optional(), +}) + +export const s_secret_scanning_alert = z.object({ + number: s_alert_number.optional(), + created_at: s_alert_created_at.optional(), + updated_at: s_nullable_alert_updated_at.optional(), + url: s_alert_url.optional(), + html_url: s_alert_html_url.optional(), + locations_url: z.string().optional(), + state: s_secret_scanning_alert_state.optional(), + resolution: s_secret_scanning_alert_resolution.optional(), + resolved_at: z.string().datetime({ offset: true }).nullable().optional(), + resolved_by: s_nullable_simple_user.optional(), + resolution_comment: z.string().nullable().optional(), + secret_type: z.string().optional(), + secret_type_display_name: z.string().optional(), + secret: z.string().optional(), + push_protection_bypassed: PermissiveBoolean.nullable().optional(), + push_protection_bypassed_by: s_nullable_simple_user.optional(), + push_protection_bypassed_at: z + .string() + .datetime({ offset: true }) + .nullable() + .optional(), + push_protection_bypass_request_reviewer: s_nullable_simple_user.optional(), + push_protection_bypass_request_reviewer_comment: z + .string() + .nullable() + .optional(), + push_protection_bypass_request_comment: z.string().nullable().optional(), + push_protection_bypass_request_html_url: z.string().nullable().optional(), + validity: z.enum(["active", "inactive", "unknown"]).optional(), + publicly_leaked: PermissiveBoolean.nullable().optional(), + multi_repo: PermissiveBoolean.nullable().optional(), + is_base64_encoded: PermissiveBoolean.nullable().optional(), +}) + +export const s_secret_scanning_location = z.object({ + type: z + .enum([ + "commit", + "wiki_commit", + "issue_title", + "issue_body", + "issue_comment", + "discussion_title", + "discussion_body", + "discussion_comment", + "pull_request_title", + "pull_request_body", + "pull_request_comment", + "pull_request_review", + "pull_request_review_comment", + ]) + .optional(), + details: z + .union([ + s_secret_scanning_location_commit, + s_secret_scanning_location_wiki_commit, + s_secret_scanning_location_issue_title, + s_secret_scanning_location_issue_body, + s_secret_scanning_location_issue_comment, + s_secret_scanning_location_discussion_title, + s_secret_scanning_location_discussion_body, + s_secret_scanning_location_discussion_comment, + s_secret_scanning_location_pull_request_title, + s_secret_scanning_location_pull_request_body, + s_secret_scanning_location_pull_request_comment, + s_secret_scanning_location_pull_request_review, + s_secret_scanning_location_pull_request_review_comment, + ]) + .optional(), +}) + +export const s_secret_scanning_push_protection_bypass = z.object({ + reason: s_secret_scanning_push_protection_bypass_reason.optional(), + expire_at: z.string().datetime({ offset: true }).nullable().optional(), + token_type: z.string().optional(), +}) + +export const s_secret_scanning_scan_history = z.object({ + incremental_scans: z.array(s_secret_scanning_scan).optional(), + pattern_update_scans: z.array(s_secret_scanning_scan).optional(), + backfill_scans: z.array(s_secret_scanning_scan).optional(), + custom_pattern_backfill_scans: z + .array( + s_secret_scanning_scan.merge( + z.object({ + pattern_name: z.string().optional(), + pattern_scope: z.string().optional(), + }), + ), + ) + .optional(), +}) + +export const s_simple_classroom_assignment = z.object({ + id: z.coerce.number(), + public_repo: PermissiveBoolean, + title: z.string(), + type: z.enum(["individual", "group"]), + invite_link: z.string(), + invitations_enabled: PermissiveBoolean, + slug: z.string(), + students_are_repo_admins: PermissiveBoolean, + feedback_pull_requests_enabled: PermissiveBoolean, + max_teams: z.coerce.number().nullable().optional(), + max_members: z.coerce.number().nullable().optional(), + editor: z.string(), + accepted: z.coerce.number(), + submitted: z.coerce.number(), + passing: z.coerce.number(), + language: z.string(), + deadline: z.string().datetime({ offset: true }).nullable(), + classroom: s_simple_classroom, +}) + +export const s_simple_repository = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + full_name: z.string(), + owner: s_simple_user, + private: PermissiveBoolean, + html_url: z.string(), + description: z.string().nullable(), + fork: PermissiveBoolean, + url: z.string(), + archive_url: z.string(), + assignees_url: z.string(), + blobs_url: z.string(), + branches_url: z.string(), + collaborators_url: z.string(), + comments_url: z.string(), + commits_url: z.string(), + compare_url: z.string(), + contents_url: z.string(), + contributors_url: z.string(), + deployments_url: z.string(), + downloads_url: z.string(), + events_url: z.string(), + forks_url: z.string(), + git_commits_url: z.string(), + git_refs_url: z.string(), + git_tags_url: z.string(), + issue_comment_url: z.string(), + issue_events_url: z.string(), + issues_url: z.string(), + keys_url: z.string(), + labels_url: z.string(), + languages_url: z.string(), + merges_url: z.string(), + milestones_url: z.string(), + notifications_url: z.string(), + pulls_url: z.string(), + releases_url: z.string(), + stargazers_url: z.string(), + statuses_url: z.string(), + subscribers_url: z.string(), + subscription_url: z.string(), + tags_url: z.string(), + teams_url: z.string(), + trees_url: z.string(), + hooks_url: z.string(), +}) + +export const s_stargazer = z.object({ + starred_at: z.string().datetime({ offset: true }), + user: s_nullable_simple_user, +}) + +export const s_status = z.object({ + url: z.string(), + avatar_url: z.string().nullable(), + id: z.coerce.number(), + node_id: z.string(), + state: z.string(), + description: z.string().nullable(), + target_url: z.string().nullable(), + context: z.string(), + created_at: z.string(), + updated_at: z.string(), + creator: s_nullable_simple_user, +}) + +export const s_team = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + slug: z.string(), + description: z.string().nullable(), + privacy: z.string().optional(), + notification_setting: z.string().optional(), + permission: z.string(), + permissions: z + .object({ + pull: PermissiveBoolean, + triage: PermissiveBoolean, + push: PermissiveBoolean, + maintain: PermissiveBoolean, + admin: PermissiveBoolean, + }) + .optional(), + url: z.string(), + html_url: z.string(), + members_url: z.string(), + repositories_url: z.string(), + parent: s_nullable_team_simple, +}) + +export const s_team_discussion = z.object({ + author: s_nullable_simple_user, + body: z.string(), + body_html: z.string(), + body_version: z.string(), + comments_count: z.coerce.number(), + comments_url: z.string(), + created_at: z.string().datetime({ offset: true }), + last_edited_at: z.string().datetime({ offset: true }).nullable(), + html_url: z.string(), + node_id: z.string(), + number: z.coerce.number(), + pinned: PermissiveBoolean, + private: PermissiveBoolean, + team_url: z.string(), + title: z.string(), + updated_at: z.string().datetime({ offset: true }), + url: z.string(), + reactions: s_reaction_rollup.optional(), +}) + +export const s_team_discussion_comment = z.object({ + author: s_nullable_simple_user, + body: z.string(), + body_html: z.string(), + body_version: z.string(), + created_at: z.string().datetime({ offset: true }), + last_edited_at: z.string().datetime({ offset: true }).nullable(), + discussion_url: z.string(), + html_url: z.string(), + node_id: z.string(), + number: z.coerce.number(), + updated_at: z.string().datetime({ offset: true }), + url: z.string(), + reactions: s_reaction_rollup.optional(), +}) + +export const s_team_full = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + html_url: z.string(), + name: z.string(), + slug: z.string(), + description: z.string().nullable(), + privacy: z.enum(["closed", "secret"]).optional(), + notification_setting: z + .enum(["notifications_enabled", "notifications_disabled"]) + .optional(), + permission: z.string(), + members_url: z.string(), + repositories_url: z.string(), + parent: s_nullable_team_simple.optional(), + members_count: z.coerce.number(), + repos_count: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + organization: s_team_organization, + ldap_dn: z.string().optional(), +}) + +export const s_team_project = z.object({ + owner_url: z.string(), + url: z.string(), + html_url: z.string(), + columns_url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + body: z.string().nullable(), + number: z.coerce.number(), + state: z.string(), + creator: s_simple_user, + created_at: z.string(), + updated_at: z.string(), + organization_permission: z.string().optional(), + private: PermissiveBoolean.optional(), + permissions: z.object({ + read: PermissiveBoolean, + write: PermissiveBoolean, + admin: PermissiveBoolean, + }), +}) + +export const s_team_repository = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + full_name: z.string(), + license: s_nullable_license_simple, + forks: z.coerce.number(), + permissions: z + .object({ + admin: PermissiveBoolean, + pull: PermissiveBoolean, + triage: PermissiveBoolean.optional(), + push: PermissiveBoolean, + maintain: PermissiveBoolean.optional(), + }) + .optional(), + role_name: z.string().optional(), + owner: s_nullable_simple_user, + private: PermissiveBoolean.default(false), + html_url: z.string(), + description: z.string().nullable(), + fork: PermissiveBoolean, + url: z.string(), + archive_url: z.string(), + assignees_url: z.string(), + blobs_url: z.string(), + branches_url: z.string(), + collaborators_url: z.string(), + comments_url: z.string(), + commits_url: z.string(), + compare_url: z.string(), + contents_url: z.string(), + contributors_url: z.string(), + deployments_url: z.string(), + downloads_url: z.string(), + events_url: z.string(), + forks_url: z.string(), + git_commits_url: z.string(), + git_refs_url: z.string(), + git_tags_url: z.string(), + git_url: z.string(), + issue_comment_url: z.string(), + issue_events_url: z.string(), + issues_url: z.string(), + keys_url: z.string(), + labels_url: z.string(), + languages_url: z.string(), + merges_url: z.string(), + milestones_url: z.string(), + notifications_url: z.string(), + pulls_url: z.string(), + releases_url: z.string(), + ssh_url: z.string(), + stargazers_url: z.string(), + statuses_url: z.string(), + subscribers_url: z.string(), + subscription_url: z.string(), + tags_url: z.string(), + teams_url: z.string(), + trees_url: z.string(), + clone_url: z.string(), + mirror_url: z.string().nullable(), + hooks_url: z.string(), + svn_url: z.string(), + homepage: z.string().nullable(), + language: z.string().nullable(), + forks_count: z.coerce.number(), + stargazers_count: z.coerce.number(), + watchers_count: z.coerce.number(), + size: z.coerce.number(), + default_branch: z.string(), + open_issues_count: z.coerce.number(), + is_template: PermissiveBoolean.optional().default(false), + topics: z.array(z.string()).optional(), + has_issues: PermissiveBoolean.default(true), + has_projects: PermissiveBoolean.default(true), + has_wiki: PermissiveBoolean.default(true), + has_pages: PermissiveBoolean, + has_downloads: PermissiveBoolean.default(true), + archived: PermissiveBoolean.default(false), + disabled: PermissiveBoolean, + visibility: z.string().optional().default("public"), + pushed_at: z.string().datetime({ offset: true }).nullable(), + created_at: z.string().datetime({ offset: true }).nullable(), + updated_at: z.string().datetime({ offset: true }).nullable(), + allow_rebase_merge: PermissiveBoolean.optional().default(true), + temp_clone_token: z.string().optional(), + allow_squash_merge: PermissiveBoolean.optional().default(true), + allow_auto_merge: PermissiveBoolean.optional().default(false), + delete_branch_on_merge: PermissiveBoolean.optional().default(false), + allow_merge_commit: PermissiveBoolean.optional().default(true), + allow_forking: PermissiveBoolean.optional().default(false), + web_commit_signoff_required: PermissiveBoolean.optional().default(false), + subscribers_count: z.coerce.number().optional(), + network_count: z.coerce.number().optional(), + open_issues: z.coerce.number(), + watchers: z.coerce.number(), + master_branch: z.string().optional(), +}) + +export const s_team_role_assignment = z.object({ + assignment: z.enum(["direct", "indirect", "mixed"]).optional(), + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + slug: z.string(), + description: z.string().nullable(), + privacy: z.string().optional(), + notification_setting: z.string().optional(), + permission: z.string(), + permissions: z + .object({ + pull: PermissiveBoolean, + triage: PermissiveBoolean, + push: PermissiveBoolean, + maintain: PermissiveBoolean, + admin: PermissiveBoolean, + }) + .optional(), + url: z.string(), + html_url: z.string(), + members_url: z.string(), + repositories_url: z.string(), + parent: s_nullable_team_simple, +}) + +export const s_timeline_reviewed_event = z.object({ + event: z.string(), + id: z.coerce.number(), + node_id: z.string(), + user: s_simple_user, + body: z.string().nullable(), + state: z.string(), + html_url: z.string(), + pull_request_url: z.string(), + _links: z.object({ + html: z.object({ href: z.string() }), + pull_request: z.object({ href: z.string() }), + }), + submitted_at: z.string().datetime({ offset: true }).optional(), + commit_id: z.string(), + body_html: z.string().optional(), + body_text: z.string().optional(), + author_association: s_author_association, +}) + +export const s_topic_search_result_item = z.object({ + name: z.string(), + display_name: z.string().nullable(), + short_description: z.string().nullable(), + description: z.string().nullable(), + created_by: z.string().nullable(), + released: z.string().nullable(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + featured: PermissiveBoolean, + curated: PermissiveBoolean, + score: z.coerce.number(), + repository_count: z.coerce.number().nullable().optional(), + logo_url: z.string().nullable().optional(), + text_matches: s_search_result_text_matches.optional(), + related: z + .array( + z.object({ + topic_relation: z + .object({ + id: z.coerce.number().optional(), + name: z.string().optional(), + topic_id: z.coerce.number().optional(), + relation_type: z.string().optional(), + }) + .optional(), + }), + ) + .nullable() + .optional(), + aliases: z + .array( + z.object({ + topic_relation: z + .object({ + id: z.coerce.number().optional(), + name: z.string().optional(), + topic_id: z.coerce.number().optional(), + relation_type: z.string().optional(), + }) + .optional(), + }), + ) + .nullable() + .optional(), +}) + +export const s_user_marketplace_purchase = z.object({ + billing_cycle: z.string(), + next_billing_date: z.string().datetime({ offset: true }).nullable(), + unit_count: z.coerce.number().nullable(), + on_free_trial: PermissiveBoolean, + free_trial_ends_on: z.string().datetime({ offset: true }).nullable(), + updated_at: z.string().datetime({ offset: true }).nullable(), + account: s_marketplace_account, + plan: s_marketplace_listing_plan, +}) + +export const s_user_role_assignment = z.object({ + assignment: z.enum(["direct", "indirect", "mixed"]).optional(), + inherited_from: z.array(s_team_simple).optional(), + name: z.string().nullable().optional(), + email: z.string().nullable().optional(), + login: z.string(), + id: z.coerce.number(), + node_id: z.string(), + avatar_url: z.string(), + gravatar_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + followers_url: z.string(), + following_url: z.string(), + gists_url: z.string(), + starred_url: z.string(), + subscriptions_url: z.string(), + organizations_url: z.string(), + repos_url: z.string(), + events_url: z.string(), + received_events_url: z.string(), + type: z.string(), + site_admin: PermissiveBoolean, + starred_at: z.string().optional(), + user_view_type: z.string().optional(), +}) + +export const s_user_search_result_item = z.object({ + login: z.string(), + id: z.coerce.number(), + node_id: z.string(), + avatar_url: z.string(), + gravatar_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + followers_url: z.string(), + subscriptions_url: z.string(), + organizations_url: z.string(), + repos_url: z.string(), + received_events_url: z.string(), + type: z.string(), + score: z.coerce.number(), + following_url: z.string(), + gists_url: z.string(), + starred_url: z.string(), + events_url: z.string(), + public_repos: z.coerce.number().optional(), + public_gists: z.coerce.number().optional(), + followers: z.coerce.number().optional(), + following: z.coerce.number().optional(), + created_at: z.string().datetime({ offset: true }).optional(), + updated_at: z.string().datetime({ offset: true }).optional(), + name: z.string().nullable().optional(), + bio: z.string().nullable().optional(), + email: z.string().email().nullable().optional(), + location: z.string().nullable().optional(), + site_admin: PermissiveBoolean, + hireable: PermissiveBoolean.nullable().optional(), + text_matches: s_search_result_text_matches.optional(), + blog: z.string().nullable().optional(), + company: z.string().nullable().optional(), + suspended_at: z.string().datetime({ offset: true }).nullable().optional(), + user_view_type: z.string().optional(), +}) + +export const s_view_traffic = z.object({ + count: z.coerce.number(), + uniques: z.coerce.number(), + views: z.array(s_traffic), +}) + +export const s_vulnerability = z.object({ + package: z + .object({ + ecosystem: s_security_advisory_ecosystems, + name: z.string().nullable(), + }) + .nullable(), + vulnerable_version_range: z.string().nullable(), + first_patched_version: z.string().nullable(), + vulnerable_functions: z.array(z.string()).nullable(), +}) + +export const s_webhook_config = z.object({ + url: s_webhook_config_url.optional(), + content_type: s_webhook_config_content_type.optional(), + secret: s_webhook_config_secret.optional(), + insecure_ssl: s_webhook_config_insecure_ssl.optional(), +}) + +export const s_added_to_project_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + project_card: z + .object({ + id: z.coerce.number(), + url: z.string(), + project_id: z.coerce.number(), + project_url: z.string(), + column_name: z.string(), + previous_column_name: z.string().optional(), + }) + .optional(), +}) + +export const s_assigned_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_integration, + assignee: s_simple_user, + assigner: s_simple_user, +}) + +export const s_authentication_token = z.object({ + token: z.string(), + expires_at: z.string().datetime({ offset: true }), + permissions: z.object({}).optional(), + repositories: z.array(s_repository).optional(), + single_file: z.string().nullable().optional(), + repository_selection: z.enum(["all", "selected"]).optional(), +}) + +export const s_authorization = z.object({ + id: z.coerce.number(), + url: z.string(), + scopes: z.array(z.string()).nullable(), + token: z.string(), + token_last_eight: z.string().nullable(), + hashed_token: z.string().nullable(), + app: z.object({ client_id: z.string(), name: z.string(), url: z.string() }), + note: z.string().nullable(), + note_url: z.string().nullable(), + updated_at: z.string().datetime({ offset: true }), + created_at: z.string().datetime({ offset: true }), + fingerprint: z.string().nullable(), + user: s_nullable_simple_user.optional(), + installation: s_nullable_scoped_installation.optional(), + expires_at: z.string().datetime({ offset: true }).nullable(), +}) + +export const s_campaign_summary = z.object({ + number: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + name: z.string().optional(), + description: z.string(), + managers: z.array(s_simple_user), + team_managers: z.array(s_team).optional(), + published_at: z.string().datetime({ offset: true }).optional(), + ends_at: z.string().datetime({ offset: true }), + closed_at: z.string().datetime({ offset: true }).nullable().optional(), + state: s_campaign_state, + contact_link: z.string().nullable(), + alert_stats: z + .object({ + open_count: z.coerce.number(), + closed_count: z.coerce.number(), + in_progress_count: z.coerce.number(), + }) + .optional(), +}) + +export const s_check_suite = z.object({ + id: z.coerce.number(), + node_id: z.string(), + head_branch: z.string().nullable(), + head_sha: z.string(), + status: z + .enum([ + "queued", + "in_progress", + "completed", + "waiting", + "requested", + "pending", + ]) + .nullable(), + conclusion: z + .enum([ + "success", + "failure", + "neutral", + "cancelled", + "skipped", + "timed_out", + "action_required", + "startup_failure", + "stale", + ]) + .nullable(), + url: z.string().nullable(), + before: z.string().nullable(), + after: z.string().nullable(), + pull_requests: z.array(s_pull_request_minimal).nullable(), + app: s_nullable_integration, + repository: s_minimal_repository, + created_at: z.string().datetime({ offset: true }).nullable(), + updated_at: z.string().datetime({ offset: true }).nullable(), + head_commit: s_simple_commit, + latest_check_runs_count: z.coerce.number(), + check_runs_url: z.string(), + rerequestable: PermissiveBoolean.optional(), + runs_rerequestable: PermissiveBoolean.optional(), +}) + +export const s_check_suite_preference = z.object({ + preferences: z.object({ + auto_trigger_checks: z + .array( + z.object({ app_id: z.coerce.number(), setting: PermissiveBoolean }), + ) + .optional(), + }), + repository: s_minimal_repository, +}) + +export const s_classroom_accepted_assignment = z.object({ + id: z.coerce.number(), + submitted: PermissiveBoolean, + passing: PermissiveBoolean, + commit_count: z.coerce.number(), + grade: z.string(), + students: z.array(s_simple_classroom_user), + repository: s_simple_classroom_repository, + assignment: s_simple_classroom_assignment, +}) + +export const s_classroom_assignment = z.object({ + id: z.coerce.number(), + public_repo: PermissiveBoolean, + title: z.string(), + type: z.enum(["individual", "group"]), + invite_link: z.string(), + invitations_enabled: PermissiveBoolean, + slug: z.string(), + students_are_repo_admins: PermissiveBoolean, + feedback_pull_requests_enabled: PermissiveBoolean, + max_teams: z.coerce.number().nullable(), + max_members: z.coerce.number().nullable(), + editor: z.string(), + accepted: z.coerce.number(), + submitted: z.coerce.number(), + passing: z.coerce.number(), + language: z.string(), + deadline: z.string().datetime({ offset: true }).nullable(), + starter_code_repository: s_simple_classroom_repository, + classroom: s_classroom, +}) + +export const s_code_scanning_alert = z.object({ + number: s_alert_number, + created_at: s_alert_created_at, + updated_at: s_alert_updated_at.optional(), + url: s_alert_url, + html_url: s_alert_html_url, + instances_url: s_alert_instances_url, + state: s_code_scanning_alert_state, + fixed_at: s_alert_fixed_at.optional(), + dismissed_by: s_nullable_simple_user, + dismissed_at: s_alert_dismissed_at, + dismissed_reason: s_code_scanning_alert_dismissed_reason, + dismissed_comment: s_code_scanning_alert_dismissed_comment.optional(), + rule: s_code_scanning_alert_rule, + tool: s_code_scanning_analysis_tool, + most_recent_instance: s_code_scanning_alert_instance, + dismissal_approved_by: s_nullable_simple_user.optional(), +}) + +export const s_code_scanning_alert_items = z.object({ + number: s_alert_number, + created_at: s_alert_created_at, + updated_at: s_alert_updated_at.optional(), + url: s_alert_url, + html_url: s_alert_html_url, + instances_url: s_alert_instances_url, + state: s_code_scanning_alert_state, + fixed_at: s_alert_fixed_at.optional(), + dismissed_by: s_nullable_simple_user, + dismissed_at: s_alert_dismissed_at, + dismissed_reason: s_code_scanning_alert_dismissed_reason, + dismissed_comment: s_code_scanning_alert_dismissed_comment.optional(), + rule: s_code_scanning_alert_rule_summary, + tool: s_code_scanning_analysis_tool, + most_recent_instance: s_code_scanning_alert_instance, + dismissal_approved_by: s_nullable_simple_user.optional(), +}) + +export const s_code_scanning_analysis = z.object({ + ref: s_code_scanning_ref, + commit_sha: s_code_scanning_analysis_commit_sha, + analysis_key: s_code_scanning_analysis_analysis_key, + environment: s_code_scanning_analysis_environment, + category: s_code_scanning_analysis_category.optional(), + error: z.string(), + created_at: s_code_scanning_analysis_created_at, + results_count: z.coerce.number(), + rules_count: z.coerce.number(), + id: z.coerce.number(), + url: s_code_scanning_analysis_url, + sarif_id: s_code_scanning_analysis_sarif_id, + tool: s_code_scanning_analysis_tool, + deletable: PermissiveBoolean, + warning: z.string(), +}) + +export const s_code_scanning_organization_alert_items = z.object({ + number: s_alert_number, + created_at: s_alert_created_at, + updated_at: s_alert_updated_at.optional(), + url: s_alert_url, + html_url: s_alert_html_url, + instances_url: s_alert_instances_url, + state: s_code_scanning_alert_state, + fixed_at: s_alert_fixed_at.optional(), + dismissed_by: s_nullable_simple_user, + dismissed_at: s_alert_dismissed_at, + dismissed_reason: s_code_scanning_alert_dismissed_reason, + dismissed_comment: s_code_scanning_alert_dismissed_comment.optional(), + rule: s_code_scanning_alert_rule_summary, + tool: s_code_scanning_analysis_tool, + most_recent_instance: s_code_scanning_alert_instance, + repository: s_simple_repository, + dismissal_approved_by: s_nullable_simple_user.optional(), +}) + +export const s_code_scanning_variant_analysis = z.object({ + id: z.coerce.number(), + controller_repo: s_simple_repository, + actor: s_simple_user, + query_language: s_code_scanning_variant_analysis_language, + query_pack_url: z.string(), + created_at: z.string().datetime({ offset: true }).optional(), + updated_at: z.string().datetime({ offset: true }).optional(), + completed_at: z.string().datetime({ offset: true }).nullable().optional(), + status: z.enum(["in_progress", "succeeded", "failed", "cancelled"]), + actions_workflow_run_id: z.coerce.number().optional(), + failure_reason: z + .enum(["no_repos_queried", "actions_workflow_run_failed", "internal_error"]) + .optional(), + scanned_repositories: z + .array( + z.object({ + repository: s_code_scanning_variant_analysis_repository, + analysis_status: s_code_scanning_variant_analysis_status, + result_count: z.coerce.number().optional(), + artifact_size_in_bytes: z.coerce.number().optional(), + failure_message: z.string().optional(), + }), + ) + .optional(), + skipped_repositories: z + .object({ + access_mismatch_repos: + s_code_scanning_variant_analysis_skipped_repo_group, + not_found_repos: z.object({ + repository_count: z.coerce.number(), + repository_full_names: z.array(z.string()), + }), + no_codeql_db_repos: s_code_scanning_variant_analysis_skipped_repo_group, + over_limit_repos: s_code_scanning_variant_analysis_skipped_repo_group, + }) + .optional(), +}) + +export const s_code_scanning_variant_analysis_repo_task = z.object({ + repository: s_simple_repository, + analysis_status: s_code_scanning_variant_analysis_status, + artifact_size_in_bytes: z.coerce.number().optional(), + result_count: z.coerce.number().optional(), + failure_message: z.string().optional(), + database_commit_sha: z.string().optional(), + source_location_prefix: z.string().optional(), + artifact_url: z.string().optional(), +}) + +export const s_code_search_result_item = z.object({ + name: z.string(), + path: z.string(), + sha: z.string(), + url: z.string(), + git_url: z.string(), + html_url: z.string(), + repository: s_minimal_repository, + score: z.coerce.number(), + file_size: z.coerce.number().optional(), + language: z.string().nullable().optional(), + last_modified_at: z.string().datetime({ offset: true }).optional(), + line_numbers: z.array(z.string()).optional(), + text_matches: s_search_result_text_matches.optional(), +}) + +export const s_code_security_configuration_repositories = z.object({ + status: z + .enum([ + "attached", + "attaching", + "detached", + "removed", + "enforced", + "failed", + "updating", + "removed_by_enterprise", + ]) + .optional(), + repository: s_simple_repository.optional(), +}) + +export const s_codespace = z.object({ + id: z.coerce.number(), + name: z.string(), + display_name: z.string().nullable().optional(), + environment_id: z.string().nullable(), + owner: s_simple_user, + billable_owner: s_simple_user, + repository: s_minimal_repository, + machine: s_nullable_codespace_machine, + devcontainer_path: z.string().nullable().optional(), + prebuild: PermissiveBoolean.nullable(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + last_used_at: z.string().datetime({ offset: true }), + state: z.enum([ + "Unknown", + "Created", + "Queued", + "Provisioning", + "Available", + "Awaiting", + "Unavailable", + "Deleted", + "Moved", + "Shutdown", + "Archived", + "Starting", + "ShuttingDown", + "Failed", + "Exporting", + "Updating", + "Rebuilding", + ]), + url: z.string(), + git_status: z.object({ + ahead: z.coerce.number().optional(), + behind: z.coerce.number().optional(), + has_unpushed_changes: PermissiveBoolean.optional(), + has_uncommitted_changes: PermissiveBoolean.optional(), + ref: z.string().optional(), + }), + location: z.enum(["EastUs", "SouthEastAsia", "WestEurope", "WestUs2"]), + idle_timeout_minutes: z.coerce.number().nullable(), + web_url: z.string(), + machines_url: z.string(), + start_url: z.string(), + stop_url: z.string(), + publish_url: z.string().nullable().optional(), + pulls_url: z.string().nullable(), + recent_folders: z.array(z.string()), + runtime_constraints: z + .object({ + allowed_port_privacy_settings: z.array(z.string()).nullable().optional(), + }) + .optional(), + pending_operation: PermissiveBoolean.nullable().optional(), + pending_operation_disabled_reason: z.string().nullable().optional(), + idle_timeout_notice: z.string().nullable().optional(), + retention_period_minutes: z.coerce.number().nullable().optional(), + retention_expires_at: z + .string() + .datetime({ offset: true }) + .nullable() + .optional(), + last_known_stop_notice: z.string().nullable().optional(), +}) + +export const s_combined_commit_status = z.object({ + state: z.string(), + statuses: z.array(s_simple_commit_status), + sha: z.string(), + total_count: z.coerce.number(), + repository: s_minimal_repository, + commit_url: z.string(), + url: z.string(), +}) + +export const s_commit_comparison = z.object({ + url: z.string(), + html_url: z.string(), + permalink_url: z.string(), + diff_url: z.string(), + patch_url: z.string(), + base_commit: s_commit, + merge_base_commit: s_commit, + status: z.enum(["diverged", "ahead", "behind", "identical"]), + ahead_by: z.coerce.number(), + behind_by: z.coerce.number(), + total_commits: z.coerce.number(), + commits: z.array(s_commit), + files: z.array(s_diff_entry).optional(), +}) + +export const s_commit_search_result_item = z.object({ + url: z.string(), + sha: z.string(), + html_url: z.string(), + comments_url: z.string(), + commit: z.object({ + author: z.object({ + name: z.string(), + email: z.string(), + date: z.string().datetime({ offset: true }), + }), + committer: s_nullable_git_user, + comment_count: z.coerce.number(), + message: z.string(), + tree: z.object({ sha: z.string(), url: z.string() }), + url: z.string(), + verification: s_verification.optional(), + }), + author: s_nullable_simple_user, + committer: s_nullable_git_user, + parents: z.array( + z.object({ + url: z.string().optional(), + html_url: z.string().optional(), + sha: z.string().optional(), + }), + ), + repository: s_minimal_repository, + score: z.coerce.number(), + node_id: z.string(), + text_matches: s_search_result_text_matches.optional(), +}) + +export const s_converted_note_to_issue_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_integration, + project_card: z + .object({ + id: z.coerce.number(), + url: z.string(), + project_id: z.coerce.number(), + project_url: z.string(), + column_name: z.string(), + previous_column_name: z.string().optional(), + }) + .optional(), +}) + +export const s_copilot_seat_details = z.object({ + assignee: s_nullable_simple_user.optional(), + organization: s_nullable_organization_simple.optional(), + assigning_team: z.union([s_team, s_enterprise_team]).nullable().optional(), + pending_cancellation_date: z.string().nullable().optional(), + last_activity_at: z.string().datetime({ offset: true }).nullable().optional(), + last_activity_editor: z.string().nullable().optional(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }).optional(), + plan_type: z.enum(["business", "enterprise", "unknown"]).optional(), +}) + +export const s_demilestoned_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + milestone: z.object({ title: z.string() }), +}) + +export const s_dependabot_alert_security_advisory = z.object({ + ghsa_id: z.string(), + cve_id: z.string().nullable(), + summary: z.string().max(1024), + description: z.string(), + vulnerabilities: z.array(s_dependabot_alert_security_vulnerability), + severity: z.enum(["low", "medium", "high", "critical"]), + cvss: z.object({ + score: z.coerce.number().min(0).max(10), + vector_string: z.string().nullable(), + }), + cvss_severities: s_cvss_severities.optional(), + epss: s_security_advisory_epss.optional(), + cwes: z.array(z.object({ cwe_id: z.string(), name: z.string() })), + identifiers: z.array( + z.object({ type: z.enum(["CVE", "GHSA"]), value: z.string() }), + ), + references: z.array(z.object({ url: z.string() })), + published_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + withdrawn_at: z.string().datetime({ offset: true }).nullable(), +}) + +export const s_deployment = z.object({ + url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + sha: z.string(), + ref: z.string(), + task: z.string(), + payload: z.union([z.record(z.unknown()), z.string()]), + original_environment: z.string().optional(), + environment: z.string(), + description: z.string().nullable(), + creator: s_nullable_simple_user, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + statuses_url: z.string(), + repository_url: z.string(), + transient_environment: PermissiveBoolean.optional(), + production_environment: PermissiveBoolean.optional(), + performed_via_github_app: s_nullable_integration.optional(), +}) + +export const s_deployment_simple = z.object({ + url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + task: z.string(), + original_environment: z.string().optional(), + environment: z.string(), + description: z.string().nullable(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + statuses_url: z.string(), + repository_url: z.string(), + transient_environment: PermissiveBoolean.optional(), + production_environment: PermissiveBoolean.optional(), + performed_via_github_app: s_nullable_integration.optional(), +}) + +export const s_deployment_status = z.object({ + url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + state: z.enum([ + "error", + "failure", + "inactive", + "pending", + "success", + "queued", + "in_progress", + ]), + creator: s_nullable_simple_user, + description: z.string().max(140).default(""), + environment: z.string().optional().default(""), + target_url: z.string().default(""), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + deployment_url: z.string(), + repository_url: z.string(), + environment_url: z.string().optional().default(""), + log_url: z.string().optional().default(""), + performed_via_github_app: s_nullable_integration.optional(), +}) + +export const s_environment = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + url: z.string(), + html_url: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + protection_rules: z + .array( + z.union([ + z.object({ + id: z.coerce.number(), + node_id: z.string(), + type: z.string(), + wait_timer: s_wait_timer.optional(), + }), + z.object({ + id: z.coerce.number(), + node_id: z.string(), + prevent_self_review: PermissiveBoolean.optional(), + type: z.string(), + reviewers: z + .array( + z.object({ + type: s_deployment_reviewer_type.optional(), + reviewer: z.union([s_simple_user, s_team]).optional(), + }), + ) + .optional(), + }), + z.object({ + id: z.coerce.number(), + node_id: z.string(), + type: z.string(), + }), + ]), + ) + .optional(), + deployment_branch_policy: s_deployment_branch_policy_settings.optional(), +}) + +export const s_full_repository = z.object({ + id: z.coerce.number(), + node_id: z.string(), + name: z.string(), + full_name: z.string(), + owner: s_simple_user, + private: PermissiveBoolean, + html_url: z.string(), + description: z.string().nullable(), + fork: PermissiveBoolean, + url: z.string(), + archive_url: z.string(), + assignees_url: z.string(), + blobs_url: z.string(), + branches_url: z.string(), + collaborators_url: z.string(), + comments_url: z.string(), + commits_url: z.string(), + compare_url: z.string(), + contents_url: z.string(), + contributors_url: z.string(), + deployments_url: z.string(), + downloads_url: z.string(), + events_url: z.string(), + forks_url: z.string(), + git_commits_url: z.string(), + git_refs_url: z.string(), + git_tags_url: z.string(), + git_url: z.string(), + issue_comment_url: z.string(), + issue_events_url: z.string(), + issues_url: z.string(), + keys_url: z.string(), + labels_url: z.string(), + languages_url: z.string(), + merges_url: z.string(), + milestones_url: z.string(), + notifications_url: z.string(), + pulls_url: z.string(), + releases_url: z.string(), + ssh_url: z.string(), + stargazers_url: z.string(), + statuses_url: z.string(), + subscribers_url: z.string(), + subscription_url: z.string(), + tags_url: z.string(), + teams_url: z.string(), + trees_url: z.string(), + clone_url: z.string(), + mirror_url: z.string().nullable(), + hooks_url: z.string(), + svn_url: z.string(), + homepage: z.string().nullable(), + language: z.string().nullable(), + forks_count: z.coerce.number(), + stargazers_count: z.coerce.number(), + watchers_count: z.coerce.number(), + size: z.coerce.number(), + default_branch: z.string(), + open_issues_count: z.coerce.number(), + is_template: PermissiveBoolean.optional(), + topics: z.array(z.string()).optional(), + has_issues: PermissiveBoolean, + has_projects: PermissiveBoolean, + has_wiki: PermissiveBoolean, + has_pages: PermissiveBoolean, + has_downloads: PermissiveBoolean.optional(), + has_discussions: PermissiveBoolean, + archived: PermissiveBoolean, + disabled: PermissiveBoolean, + visibility: z.string().optional(), + pushed_at: z.string().datetime({ offset: true }), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + permissions: z + .object({ + admin: PermissiveBoolean, + maintain: PermissiveBoolean.optional(), + push: PermissiveBoolean, + triage: PermissiveBoolean.optional(), + pull: PermissiveBoolean, + }) + .optional(), + allow_rebase_merge: PermissiveBoolean.optional(), + template_repository: s_nullable_repository.optional(), + temp_clone_token: z.string().nullable().optional(), + allow_squash_merge: PermissiveBoolean.optional(), + allow_auto_merge: PermissiveBoolean.optional(), + delete_branch_on_merge: PermissiveBoolean.optional(), + allow_merge_commit: PermissiveBoolean.optional(), + allow_update_branch: PermissiveBoolean.optional(), + use_squash_pr_title_as_default: PermissiveBoolean.optional(), + squash_merge_commit_title: z + .enum(["PR_TITLE", "COMMIT_OR_PR_TITLE"]) + .optional(), + squash_merge_commit_message: z + .enum(["PR_BODY", "COMMIT_MESSAGES", "BLANK"]) + .optional(), + merge_commit_title: z.enum(["PR_TITLE", "MERGE_MESSAGE"]).optional(), + merge_commit_message: z.enum(["PR_BODY", "PR_TITLE", "BLANK"]).optional(), + allow_forking: PermissiveBoolean.optional(), + web_commit_signoff_required: PermissiveBoolean.optional(), + subscribers_count: z.coerce.number(), + network_count: z.coerce.number(), + license: s_nullable_license_simple, + organization: s_nullable_simple_user.optional(), + parent: s_repository.optional(), + source: s_repository.optional(), + forks: z.coerce.number(), + master_branch: z.string().optional(), + open_issues: z.coerce.number(), + watchers: z.coerce.number(), + anonymous_access_enabled: PermissiveBoolean.optional().default(true), + code_of_conduct: s_code_of_conduct_simple.optional(), + security_and_analysis: s_security_and_analysis.optional(), + custom_properties: z.record(z.unknown()).optional(), +}) + +export const s_gist_simple = z.object({ + forks: z + .array( + z.object({ + id: z.string().optional(), + url: z.string().optional(), + user: s_public_user.optional(), + created_at: z.string().datetime({ offset: true }).optional(), + updated_at: z.string().datetime({ offset: true }).optional(), + }), + ) + .nullable() + .optional(), + history: z.array(s_gist_history).nullable().optional(), + fork_of: z + .object({ + url: z.string(), + forks_url: z.string(), + commits_url: z.string(), + id: z.string(), + node_id: z.string(), + git_pull_url: z.string(), + git_push_url: z.string(), + html_url: z.string(), + files: z.record( + z.object({ + filename: z.string().optional(), + type: z.string().optional(), + language: z.string().optional(), + raw_url: z.string().optional(), + size: z.coerce.number().optional(), + }), + ), + public: PermissiveBoolean, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + description: z.string().nullable(), + comments: z.coerce.number(), + comments_enabled: PermissiveBoolean.optional(), + user: s_nullable_simple_user, + comments_url: z.string(), + owner: s_nullable_simple_user.optional(), + truncated: PermissiveBoolean.optional(), + forks: z.array(z.unknown()).optional(), + history: z.array(z.unknown()).optional(), + }) + .nullable() + .optional(), + url: z.string().optional(), + forks_url: z.string().optional(), + commits_url: z.string().optional(), + id: z.string().optional(), + node_id: z.string().optional(), + git_pull_url: z.string().optional(), + git_push_url: z.string().optional(), + html_url: z.string().optional(), + files: z + .record( + z + .object({ + filename: z.string().optional(), + type: z.string().optional(), + language: z.string().optional(), + raw_url: z.string().optional(), + size: z.coerce.number().optional(), + truncated: PermissiveBoolean.optional(), + content: z.string().optional(), + encoding: z.string().optional().default("utf-8"), + }) + .nullable(), + ) + .optional(), + public: PermissiveBoolean.optional(), + created_at: z.string().optional(), + updated_at: z.string().optional(), + description: z.string().nullable().optional(), + comments: z.coerce.number().optional(), + comments_enabled: PermissiveBoolean.optional(), + user: z.string().nullable().optional(), + comments_url: z.string().optional(), + owner: s_simple_user.optional(), + truncated: PermissiveBoolean.optional(), +}) + +export const s_global_advisory = z.object({ + ghsa_id: z.string(), + cve_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + repository_advisory_url: z.string().nullable(), + summary: z.string().max(1024), + description: z.string().max(65535).nullable(), + type: z.enum(["reviewed", "unreviewed", "malware"]), + severity: z.enum(["critical", "high", "medium", "low", "unknown"]), + source_code_location: z.string().nullable(), + identifiers: z + .array(z.object({ type: z.enum(["CVE", "GHSA"]), value: z.string() })) + .nullable(), + references: z.array(z.string()).nullable(), + published_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + github_reviewed_at: z.string().datetime({ offset: true }).nullable(), + nvd_published_at: z.string().datetime({ offset: true }).nullable(), + withdrawn_at: z.string().datetime({ offset: true }).nullable(), + vulnerabilities: z.array(s_vulnerability).nullable(), + cvss: z + .object({ + vector_string: z.string().nullable(), + score: z.coerce.number().min(0).max(10).nullable(), + }) + .nullable(), + cvss_severities: s_cvss_severities.optional(), + epss: s_security_advisory_epss.optional(), + cwes: z.array(z.object({ cwe_id: z.string(), name: z.string() })).nullable(), + credits: z + .array( + z.object({ user: s_simple_user, type: s_security_advisory_credit_types }), + ) + .nullable(), +}) + +export const s_hook = z.object({ + type: z.string(), + id: z.coerce.number(), + name: z.string(), + active: PermissiveBoolean, + events: z.array(z.string()), + config: s_webhook_config, + updated_at: z.string().datetime({ offset: true }), + created_at: z.string().datetime({ offset: true }), + url: z.string(), + test_url: z.string(), + ping_url: z.string(), + deliveries_url: z.string().optional(), + last_response: s_hook_response, +}) + +export const s_installation_token = z.object({ + token: z.string(), + expires_at: z.string(), + permissions: s_app_permissions.optional(), + repository_selection: z.enum(["all", "selected"]).optional(), + repositories: z.array(s_repository).optional(), + single_file: z.string().optional(), + has_multiple_single_files: PermissiveBoolean.optional(), + single_file_paths: z.array(z.string()).optional(), +}) + +export const s_issue = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + repository_url: z.string(), + labels_url: z.string(), + comments_url: z.string(), + events_url: z.string(), + html_url: z.string(), + number: z.coerce.number(), + state: z.string(), + state_reason: z + .enum(["completed", "reopened", "not_planned"]) + .nullable() + .optional(), + title: z.string(), + body: z.string().nullable().optional(), + user: s_nullable_simple_user, + labels: z.array( + z.union([ + z.string(), + z.object({ + id: z.coerce.number().optional(), + node_id: z.string().optional(), + url: z.string().optional(), + name: z.string().optional(), + description: z.string().nullable().optional(), + color: z.string().nullable().optional(), + default: PermissiveBoolean.optional(), + }), + ]), + ), + assignee: s_nullable_simple_user, + assignees: z.array(s_simple_user).nullable().optional(), + milestone: s_nullable_milestone, + locked: PermissiveBoolean, + active_lock_reason: z.string().nullable().optional(), + comments: z.coerce.number(), + pull_request: z + .object({ + merged_at: z.string().datetime({ offset: true }).nullable().optional(), + diff_url: z.string().nullable(), + html_url: z.string().nullable(), + patch_url: z.string().nullable(), + url: z.string().nullable(), + }) + .optional(), + closed_at: z.string().datetime({ offset: true }).nullable(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + draft: PermissiveBoolean.optional(), + closed_by: s_nullable_simple_user.optional(), + body_html: z.string().optional(), + body_text: z.string().optional(), + timeline_url: z.string().optional(), + type: s_issue_type.optional(), + repository: s_repository.optional(), + performed_via_github_app: s_nullable_integration.optional(), + author_association: s_author_association, + reactions: s_reaction_rollup.optional(), + sub_issues_summary: s_sub_issues_summary.optional(), +}) + +export const s_issue_comment = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + body: z.string().optional(), + body_text: z.string().optional(), + body_html: z.string().optional(), + html_url: z.string(), + user: s_nullable_simple_user, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + issue_url: z.string(), + author_association: s_author_association, + performed_via_github_app: s_nullable_integration.optional(), + reactions: s_reaction_rollup.optional(), +}) + +export const s_issue_search_result_item = z.object({ + url: z.string(), + repository_url: z.string(), + labels_url: z.string(), + comments_url: z.string(), + events_url: z.string(), + html_url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + number: z.coerce.number(), + title: z.string(), + locked: PermissiveBoolean, + active_lock_reason: z.string().nullable().optional(), + assignees: z.array(s_simple_user).nullable().optional(), + user: s_nullable_simple_user, + labels: z.array( + z.object({ + id: z.coerce.number().optional(), + node_id: z.string().optional(), + url: z.string().optional(), + name: z.string().optional(), + color: z.string().optional(), + default: PermissiveBoolean.optional(), + description: z.string().nullable().optional(), + }), + ), + sub_issues_summary: z + .object({ + total: z.coerce.number(), + completed: z.coerce.number(), + percent_completed: z.coerce.number(), + }) + .optional(), + state: z.string(), + state_reason: z.string().nullable().optional(), + assignee: s_nullable_simple_user, + milestone: s_nullable_milestone, + comments: z.coerce.number(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + closed_at: z.string().datetime({ offset: true }).nullable(), + text_matches: s_search_result_text_matches.optional(), + pull_request: z + .object({ + merged_at: z.string().datetime({ offset: true }).nullable().optional(), + diff_url: z.string().nullable(), + html_url: z.string().nullable(), + patch_url: z.string().nullable(), + url: z.string().nullable(), + }) + .optional(), + body: z.string().optional(), + score: z.coerce.number(), + author_association: s_author_association, + draft: PermissiveBoolean.optional(), + repository: s_repository.optional(), + body_html: z.string().optional(), + body_text: z.string().optional(), + timeline_url: z.string().optional(), + type: s_issue_type.optional(), + performed_via_github_app: s_nullable_integration.optional(), + reactions: s_reaction_rollup.optional(), +}) + +export const s_labeled_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + label: z.object({ name: z.string(), color: z.string() }), +}) + +export const s_locked_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + lock_reason: z.string().nullable(), +}) + +export const s_manifest = z.object({ + name: z.string(), + file: z.object({ source_location: z.string().optional() }).optional(), + metadata: s_metadata.optional(), + resolved: z.record(s_dependency).optional(), +}) + +export const s_migration = z.object({ + id: z.coerce.number(), + owner: s_nullable_simple_user, + guid: z.string(), + state: z.string(), + lock_repositories: PermissiveBoolean, + exclude_metadata: PermissiveBoolean, + exclude_git_data: PermissiveBoolean, + exclude_attachments: PermissiveBoolean, + exclude_releases: PermissiveBoolean, + exclude_owner_projects: PermissiveBoolean, + org_metadata_only: PermissiveBoolean, + repositories: z.array(s_repository), + url: z.string(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + node_id: z.string(), + archive_url: z.string().optional(), + exclude: z.array(z.string()).optional(), +}) + +export const s_milestoned_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + milestone: z.object({ title: z.string() }), +}) + +export const s_moved_column_in_project_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + project_card: z + .object({ + id: z.coerce.number(), + url: z.string(), + project_id: z.coerce.number(), + project_url: z.string(), + column_name: z.string(), + previous_column_name: z.string().optional(), + }) + .optional(), +}) + +export const s_nullable_issue = z + .object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + repository_url: z.string(), + labels_url: z.string(), + comments_url: z.string(), + events_url: z.string(), + html_url: z.string(), + number: z.coerce.number(), + state: z.string(), + state_reason: z + .enum(["completed", "reopened", "not_planned"]) + .nullable() + .optional(), + title: z.string(), + body: z.string().nullable().optional(), + user: s_nullable_simple_user, + labels: z.array( + z.union([ + z.string(), + z.object({ + id: z.coerce.number().optional(), + node_id: z.string().optional(), + url: z.string().optional(), + name: z.string().optional(), + description: z.string().nullable().optional(), + color: z.string().nullable().optional(), + default: PermissiveBoolean.optional(), + }), + ]), + ), + assignee: s_nullable_simple_user, + assignees: z.array(s_simple_user).nullable().optional(), + milestone: s_nullable_milestone, + locked: PermissiveBoolean, + active_lock_reason: z.string().nullable().optional(), + comments: z.coerce.number(), + pull_request: z + .object({ + merged_at: z.string().datetime({ offset: true }).nullable().optional(), + diff_url: z.string().nullable(), + html_url: z.string().nullable(), + patch_url: z.string().nullable(), + url: z.string().nullable(), + }) + .optional(), + closed_at: z.string().datetime({ offset: true }).nullable(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + draft: PermissiveBoolean.optional(), + closed_by: s_nullable_simple_user.optional(), + body_html: z.string().optional(), + body_text: z.string().optional(), + timeline_url: z.string().optional(), + type: s_issue_type.optional(), + repository: s_repository.optional(), + performed_via_github_app: s_nullable_integration.optional(), + author_association: s_author_association, + reactions: s_reaction_rollup.optional(), + sub_issues_summary: s_sub_issues_summary.optional(), + }) + .nullable() + +export const s_org_ruleset_conditions = z.union([ + s_repository_ruleset_conditions.merge( + s_repository_ruleset_conditions_repository_name_target, + ), + s_repository_ruleset_conditions.merge( + s_repository_ruleset_conditions_repository_id_target, + ), + s_repository_ruleset_conditions.merge( + s_repository_ruleset_conditions_repository_property_target, + ), +]) + +export const s_organization_secret_scanning_alert = z.object({ + number: s_alert_number.optional(), + created_at: s_alert_created_at.optional(), + updated_at: s_nullable_alert_updated_at.optional(), + url: s_alert_url.optional(), + html_url: s_alert_html_url.optional(), + locations_url: z.string().optional(), + state: s_secret_scanning_alert_state.optional(), + resolution: s_secret_scanning_alert_resolution.optional(), + resolved_at: z.string().datetime({ offset: true }).nullable().optional(), + resolved_by: s_nullable_simple_user.optional(), + secret_type: z.string().optional(), + secret_type_display_name: z.string().optional(), + secret: z.string().optional(), + repository: s_simple_repository.optional(), + push_protection_bypassed: PermissiveBoolean.nullable().optional(), + push_protection_bypassed_by: s_nullable_simple_user.optional(), + push_protection_bypassed_at: z + .string() + .datetime({ offset: true }) + .nullable() + .optional(), + push_protection_bypass_request_reviewer: s_nullable_simple_user.optional(), + push_protection_bypass_request_reviewer_comment: z + .string() + .nullable() + .optional(), + push_protection_bypass_request_comment: z.string().nullable().optional(), + push_protection_bypass_request_html_url: z.string().nullable().optional(), + resolution_comment: z.string().nullable().optional(), + validity: z.enum(["active", "inactive", "unknown"]).optional(), + publicly_leaked: PermissiveBoolean.nullable().optional(), + multi_repo: PermissiveBoolean.nullable().optional(), + is_base64_encoded: PermissiveBoolean.nullable().optional(), +}) + +export const s_package = z.object({ + id: z.coerce.number(), + name: z.string(), + package_type: z.enum([ + "npm", + "maven", + "rubygems", + "docker", + "nuget", + "container", + ]), + url: z.string(), + html_url: z.string(), + version_count: z.coerce.number(), + visibility: z.enum(["private", "public"]), + owner: s_nullable_simple_user.optional(), + repository: s_nullable_minimal_repository.optional(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), +}) + +export const s_pending_deployment = z.object({ + environment: z.object({ + id: z.coerce.number().optional(), + node_id: z.string().optional(), + name: z.string().optional(), + url: z.string().optional(), + html_url: z.string().optional(), + }), + wait_timer: z.coerce.number(), + wait_timer_started_at: z.string().datetime({ offset: true }).nullable(), + current_user_can_approve: PermissiveBoolean, + reviewers: z.array( + z.object({ + type: s_deployment_reviewer_type.optional(), + reviewer: z.union([s_simple_user, s_team]).optional(), + }), + ), +}) + +export const s_protected_branch = z.object({ + url: z.string(), + required_status_checks: s_status_check_policy.optional(), + required_pull_request_reviews: z + .object({ + url: z.string(), + dismiss_stale_reviews: PermissiveBoolean.optional(), + require_code_owner_reviews: PermissiveBoolean.optional(), + required_approving_review_count: z.coerce.number().optional(), + require_last_push_approval: PermissiveBoolean.optional().default(false), + dismissal_restrictions: z + .object({ + url: z.string(), + users_url: z.string(), + teams_url: z.string(), + users: z.array(s_simple_user), + teams: z.array(s_team), + apps: z.array(s_integration).optional(), + }) + .optional(), + bypass_pull_request_allowances: z + .object({ + users: z.array(s_simple_user), + teams: z.array(s_team), + apps: z.array(s_integration).optional(), + }) + .optional(), + }) + .optional(), + required_signatures: z + .object({ url: z.string(), enabled: PermissiveBoolean }) + .optional(), + enforce_admins: z + .object({ url: z.string(), enabled: PermissiveBoolean }) + .optional(), + required_linear_history: z.object({ enabled: PermissiveBoolean }).optional(), + allow_force_pushes: z.object({ enabled: PermissiveBoolean }).optional(), + allow_deletions: z.object({ enabled: PermissiveBoolean }).optional(), + restrictions: s_branch_restriction_policy.optional(), + required_conversation_resolution: z + .object({ enabled: PermissiveBoolean.optional() }) + .optional(), + block_creations: z.object({ enabled: PermissiveBoolean }).optional(), + lock_branch: z + .object({ enabled: PermissiveBoolean.optional().default(false) }) + .optional(), + allow_fork_syncing: z + .object({ enabled: PermissiveBoolean.optional().default(false) }) + .optional(), +}) + +export const s_protected_branch_pull_request_review = z.object({ + url: z.string().optional(), + dismissal_restrictions: z + .object({ + users: z.array(s_simple_user).optional(), + teams: z.array(s_team).optional(), + apps: z.array(s_integration).optional(), + url: z.string().optional(), + users_url: z.string().optional(), + teams_url: z.string().optional(), + }) + .optional(), + bypass_pull_request_allowances: z + .object({ + users: z.array(s_simple_user).optional(), + teams: z.array(s_team).optional(), + apps: z.array(s_integration).optional(), + }) + .optional(), + dismiss_stale_reviews: PermissiveBoolean, + require_code_owner_reviews: PermissiveBoolean, + required_approving_review_count: z.coerce.number().min(0).max(6).optional(), + require_last_push_approval: PermissiveBoolean.optional().default(false), +}) + +export const s_pull_request = z.object({ + url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + html_url: z.string(), + diff_url: z.string(), + patch_url: z.string(), + issue_url: z.string(), + commits_url: z.string(), + review_comments_url: z.string(), + review_comment_url: z.string(), + comments_url: z.string(), + statuses_url: z.string(), + number: z.coerce.number(), + state: z.enum(["open", "closed"]), + locked: PermissiveBoolean, + title: z.string(), + user: s_simple_user, + body: z.string().nullable(), + labels: z.array( + z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + name: z.string(), + description: z.string().nullable(), + color: z.string(), + default: PermissiveBoolean, + }), + ), + milestone: s_nullable_milestone, + active_lock_reason: z.string().nullable().optional(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + closed_at: z.string().datetime({ offset: true }).nullable(), + merged_at: z.string().datetime({ offset: true }).nullable(), + merge_commit_sha: z.string().nullable(), + assignee: s_nullable_simple_user, + assignees: z.array(s_simple_user).nullable().optional(), + requested_reviewers: z.array(s_simple_user).nullable().optional(), + requested_teams: z.array(s_team_simple).nullable().optional(), + head: z.object({ + label: z.string(), + ref: z.string(), + repo: s_repository, + sha: z.string(), + user: s_simple_user, + }), + base: z.object({ + label: z.string(), + ref: z.string(), + repo: s_repository, + sha: z.string(), + user: s_simple_user, + }), + _links: z.object({ + comments: s_link, + commits: s_link, + statuses: s_link, + html: s_link, + issue: s_link, + review_comments: s_link, + review_comment: s_link, + self: s_link, + }), + author_association: s_author_association, + auto_merge: s_auto_merge, + draft: PermissiveBoolean.optional(), + merged: PermissiveBoolean, + mergeable: PermissiveBoolean.nullable(), + rebaseable: PermissiveBoolean.nullable().optional(), + mergeable_state: z.string(), + merged_by: s_nullable_simple_user, + comments: z.coerce.number(), + review_comments: z.coerce.number(), + maintainer_can_modify: PermissiveBoolean, + commits: z.coerce.number(), + additions: z.coerce.number(), + deletions: z.coerce.number(), + changed_files: z.coerce.number(), +}) + +export const s_pull_request_review_request = z.object({ + users: z.array(s_simple_user), + teams: z.array(s_team), +}) + +export const s_pull_request_simple = z.object({ + url: z.string(), + id: z.coerce.number(), + node_id: z.string(), + html_url: z.string(), + diff_url: z.string(), + patch_url: z.string(), + issue_url: z.string(), + commits_url: z.string(), + review_comments_url: z.string(), + review_comment_url: z.string(), + comments_url: z.string(), + statuses_url: z.string(), + number: z.coerce.number(), + state: z.string(), + locked: PermissiveBoolean, + title: z.string(), + user: s_nullable_simple_user, + body: z.string().nullable(), + labels: z.array( + z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + name: z.string(), + description: z.string(), + color: z.string(), + default: PermissiveBoolean, + }), + ), + milestone: s_nullable_milestone, + active_lock_reason: z.string().nullable().optional(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + closed_at: z.string().datetime({ offset: true }).nullable(), + merged_at: z.string().datetime({ offset: true }).nullable(), + merge_commit_sha: z.string().nullable(), + assignee: s_nullable_simple_user, + assignees: z.array(s_simple_user).nullable().optional(), + requested_reviewers: z.array(s_simple_user).nullable().optional(), + requested_teams: z.array(s_team).nullable().optional(), + head: z.object({ + label: z.string(), + ref: z.string(), + repo: s_repository, + sha: z.string(), + user: s_nullable_simple_user, + }), + base: z.object({ + label: z.string(), + ref: z.string(), + repo: s_repository, + sha: z.string(), + user: s_nullable_simple_user, + }), + _links: z.object({ + comments: s_link, + commits: s_link, + statuses: s_link, + html: s_link, + issue: s_link, + review_comments: s_link, + review_comment: s_link, + self: s_link, + }), + author_association: s_author_association, + auto_merge: s_auto_merge, + draft: PermissiveBoolean.optional(), +}) + +export const s_release = z.object({ + url: z.string(), + html_url: z.string(), + assets_url: z.string(), + upload_url: z.string(), + tarball_url: z.string().nullable(), + zipball_url: z.string().nullable(), + id: z.coerce.number(), + node_id: z.string(), + tag_name: z.string(), + target_commitish: z.string(), + name: z.string().nullable(), + body: z.string().nullable().optional(), + draft: PermissiveBoolean, + prerelease: PermissiveBoolean, + created_at: z.string().datetime({ offset: true }), + published_at: z.string().datetime({ offset: true }).nullable(), + author: s_simple_user, + assets: z.array(s_release_asset), + body_html: z.string().optional(), + body_text: z.string().optional(), + mentions_count: z.coerce.number().optional(), + discussion_url: z.string().optional(), + reactions: s_reaction_rollup.optional(), +}) + +export const s_removed_from_project_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + project_card: z + .object({ + id: z.coerce.number(), + url: z.string(), + project_id: z.coerce.number(), + project_url: z.string(), + column_name: z.string(), + previous_column_name: z.string().optional(), + }) + .optional(), +}) + +export const s_renamed_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + rename: z.object({ from: z.string(), to: z.string() }), +}) + +export const s_repository_advisory = z.object({ + ghsa_id: z.string(), + cve_id: z.string().nullable(), + url: z.string(), + html_url: z.string(), + summary: z.string().max(1024), + description: z.string().max(65535).nullable(), + severity: z.enum(["critical", "high", "medium", "low"]).nullable(), + author: s_simple_user.nullable(), + publisher: s_simple_user.nullable(), + identifiers: z.array( + z.object({ type: z.enum(["CVE", "GHSA"]), value: z.string() }), + ), + state: z.enum(["published", "closed", "withdrawn", "draft", "triage"]), + created_at: z.string().datetime({ offset: true }).nullable(), + updated_at: z.string().datetime({ offset: true }).nullable(), + published_at: z.string().datetime({ offset: true }).nullable(), + closed_at: z.string().datetime({ offset: true }).nullable(), + withdrawn_at: z.string().datetime({ offset: true }).nullable(), + submission: z.object({ accepted: PermissiveBoolean }).nullable(), + vulnerabilities: z.array(s_repository_advisory_vulnerability).nullable(), + cvss: z + .object({ + vector_string: z.string().nullable(), + score: z.coerce.number().min(0).max(10).nullable(), + }) + .nullable(), + cvss_severities: s_cvss_severities.optional(), + cwes: z.array(z.object({ cwe_id: z.string(), name: z.string() })).nullable(), + cwe_ids: z.array(z.string()).nullable(), + credits: z + .array( + z.object({ + login: z.string().optional(), + type: s_security_advisory_credit_types.optional(), + }), + ) + .nullable(), + credits_detailed: z.array(s_repository_advisory_credit).nullable(), + collaborating_users: z.array(s_simple_user).nullable(), + collaborating_teams: z.array(s_team).nullable(), + private_fork: s_simple_repository.nullable(), +}) + +export const s_repository_invitation = z.object({ + id: z.coerce.number(), + repository: s_minimal_repository, + invitee: s_nullable_simple_user, + inviter: s_nullable_simple_user, + permissions: z.enum(["read", "write", "admin", "triage", "maintain"]), + created_at: z.string().datetime({ offset: true }), + expired: PermissiveBoolean.optional(), + url: z.string(), + html_url: z.string(), + node_id: z.string(), +}) + +export const s_repository_rule = z.union([ + s_repository_rule_creation, + s_repository_rule_update, + s_repository_rule_deletion, + s_repository_rule_required_linear_history, + s_repository_rule_merge_queue, + s_repository_rule_required_deployments, + s_repository_rule_required_signatures, + s_repository_rule_pull_request, + s_repository_rule_required_status_checks, + s_repository_rule_non_fast_forward, + s_repository_rule_commit_message_pattern, + s_repository_rule_commit_author_email_pattern, + s_repository_rule_committer_email_pattern, + s_repository_rule_branch_name_pattern, + s_repository_rule_tag_name_pattern, + s_repository_rule_file_path_restriction, + s_repository_rule_max_file_path_length, + s_repository_rule_file_extension_restriction, + s_repository_rule_max_file_size, + s_repository_rule_workflows, + s_repository_rule_code_scanning, +]) + +export const s_repository_rule_detailed = z.union([ + s_repository_rule_creation.merge(s_repository_rule_ruleset_info), + s_repository_rule_update.merge(s_repository_rule_ruleset_info), + s_repository_rule_deletion.merge(s_repository_rule_ruleset_info), + s_repository_rule_required_linear_history.merge( + s_repository_rule_ruleset_info, + ), + s_repository_rule_merge_queue.merge(s_repository_rule_ruleset_info), + s_repository_rule_required_deployments.merge(s_repository_rule_ruleset_info), + s_repository_rule_required_signatures.merge(s_repository_rule_ruleset_info), + s_repository_rule_pull_request.merge(s_repository_rule_ruleset_info), + s_repository_rule_required_status_checks.merge( + s_repository_rule_ruleset_info, + ), + s_repository_rule_non_fast_forward.merge(s_repository_rule_ruleset_info), + s_repository_rule_commit_message_pattern.merge( + s_repository_rule_ruleset_info, + ), + s_repository_rule_commit_author_email_pattern.merge( + s_repository_rule_ruleset_info, + ), + s_repository_rule_committer_email_pattern.merge( + s_repository_rule_ruleset_info, + ), + s_repository_rule_branch_name_pattern.merge(s_repository_rule_ruleset_info), + s_repository_rule_tag_name_pattern.merge(s_repository_rule_ruleset_info), + s_repository_rule_file_path_restriction.merge(s_repository_rule_ruleset_info), + s_repository_rule_max_file_path_length.merge(s_repository_rule_ruleset_info), + s_repository_rule_file_extension_restriction.merge( + s_repository_rule_ruleset_info, + ), + s_repository_rule_max_file_size.merge(s_repository_rule_ruleset_info), + s_repository_rule_workflows.merge(s_repository_rule_ruleset_info), + s_repository_rule_code_scanning.merge(s_repository_rule_ruleset_info), +]) + +export const s_review_dismissed_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + dismissed_review: z.object({ + state: z.string(), + review_id: z.coerce.number(), + dismissal_message: z.string().nullable(), + dismissal_commit_id: z.string().optional(), + }), +}) + +export const s_review_request_removed_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + review_requester: s_simple_user, + requested_team: s_team.optional(), + requested_reviewer: s_simple_user.optional(), +}) + +export const s_review_requested_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + review_requester: s_simple_user, + requested_team: s_team.optional(), + requested_reviewer: s_simple_user.optional(), +}) + +export const s_starred_repository = z.object({ + starred_at: z.string().datetime({ offset: true }), + repo: s_repository, +}) + +export const s_state_change_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + state_reason: z.string().nullable().optional(), +}) + +export const s_thread = z.object({ + id: z.string(), + repository: s_minimal_repository, + subject: z.object({ + title: z.string(), + url: z.string(), + latest_comment_url: z.string(), + type: z.string(), + }), + reason: z.string(), + unread: PermissiveBoolean, + updated_at: z.string(), + last_read_at: z.string().nullable(), + url: z.string(), + subscription_url: z.string(), +}) + +export const s_timeline_assigned_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + assignee: s_simple_user, +}) + +export const s_timeline_comment_event = z.object({ + event: z.string(), + actor: s_simple_user, + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + body: z.string().optional(), + body_text: z.string().optional(), + body_html: z.string().optional(), + html_url: z.string(), + user: s_simple_user, + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + issue_url: z.string(), + author_association: s_author_association, + performed_via_github_app: s_nullable_integration.optional(), + reactions: s_reaction_rollup.optional(), +}) + +export const s_timeline_commit_commented_event = z.object({ + event: z.string().optional(), + node_id: z.string().optional(), + commit_id: z.string().optional(), + comments: z.array(s_commit_comment).optional(), +}) + +export const s_timeline_line_commented_event = z.object({ + event: z.string().optional(), + node_id: z.string().optional(), + comments: z.array(s_pull_request_review_comment).optional(), +}) + +export const s_timeline_unassigned_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + assignee: s_simple_user, +}) + +export const s_unassigned_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + assignee: s_simple_user, + assigner: s_simple_user, +}) + +export const s_unlabeled_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string(), + performed_via_github_app: s_nullable_integration, + label: z.object({ name: z.string(), color: z.string() }), +}) + +export const s_workflow_run = z.object({ + id: z.coerce.number(), + name: z.string().nullable().optional(), + node_id: z.string(), + check_suite_id: z.coerce.number().optional(), + check_suite_node_id: z.string().optional(), + head_branch: z.string().nullable(), + head_sha: z.string(), + path: z.string(), + run_number: z.coerce.number(), + run_attempt: z.coerce.number().optional(), + referenced_workflows: z.array(s_referenced_workflow).nullable().optional(), + event: z.string(), + status: z.string().nullable(), + conclusion: z.string().nullable(), + workflow_id: z.coerce.number(), + url: z.string(), + html_url: z.string(), + pull_requests: z.array(s_pull_request_minimal).nullable(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + actor: s_simple_user.optional(), + triggering_actor: s_simple_user.optional(), + run_started_at: z.string().datetime({ offset: true }).optional(), + jobs_url: z.string(), + logs_url: z.string(), + check_suite_url: z.string(), + artifacts_url: z.string(), + cancel_url: z.string(), + rerun_url: z.string(), + previous_attempt_url: z.string().nullable().optional(), + workflow_url: z.string(), + head_commit: s_nullable_simple_commit, + repository: s_minimal_repository, + head_repository: s_minimal_repository, + head_repository_id: z.coerce.number().optional(), + display_title: z.string(), +}) + +export const s_branch_protection = z.object({ + url: z.string().optional(), + enabled: PermissiveBoolean.optional(), + required_status_checks: s_protected_branch_required_status_check.optional(), + enforce_admins: s_protected_branch_admin_enforced.optional(), + required_pull_request_reviews: + s_protected_branch_pull_request_review.optional(), + restrictions: s_branch_restriction_policy.optional(), + required_linear_history: z + .object({ enabled: PermissiveBoolean.optional() }) + .optional(), + allow_force_pushes: z + .object({ enabled: PermissiveBoolean.optional() }) + .optional(), + allow_deletions: z + .object({ enabled: PermissiveBoolean.optional() }) + .optional(), + block_creations: z + .object({ enabled: PermissiveBoolean.optional() }) + .optional(), + required_conversation_resolution: z + .object({ enabled: PermissiveBoolean.optional() }) + .optional(), + name: z.string().optional(), + protection_url: z.string().optional(), + required_signatures: z + .object({ url: z.string(), enabled: PermissiveBoolean }) + .optional(), + lock_branch: z + .object({ enabled: PermissiveBoolean.optional().default(false) }) + .optional(), + allow_fork_syncing: z + .object({ enabled: PermissiveBoolean.optional().default(false) }) + .optional(), +}) + +export const s_check_run = z.object({ + id: z.coerce.number(), + head_sha: z.string(), + node_id: z.string(), + external_id: z.string().nullable(), + url: z.string(), + html_url: z.string().nullable(), + details_url: z.string().nullable(), + status: z.enum([ + "queued", + "in_progress", + "completed", + "waiting", + "requested", + "pending", + ]), + conclusion: z + .enum([ + "success", + "failure", + "neutral", + "cancelled", + "skipped", + "timed_out", + "action_required", + ]) + .nullable(), + started_at: z.string().datetime({ offset: true }).nullable(), + completed_at: z.string().datetime({ offset: true }).nullable(), + output: z.object({ + title: z.string().nullable(), + summary: z.string().nullable(), + text: z.string().nullable(), + annotations_count: z.coerce.number(), + annotations_url: z.string(), + }), + name: z.string(), + check_suite: z.object({ id: z.coerce.number() }).nullable(), + app: s_nullable_integration, + pull_requests: z.array(s_pull_request_minimal), + deployment: s_deployment_simple.optional(), +}) + +export const s_codespace_with_full_repository = z.object({ + id: z.coerce.number(), + name: z.string(), + display_name: z.string().nullable().optional(), + environment_id: z.string().nullable(), + owner: s_simple_user, + billable_owner: s_simple_user, + repository: s_full_repository, + machine: s_nullable_codespace_machine, + devcontainer_path: z.string().nullable().optional(), + prebuild: PermissiveBoolean.nullable(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + last_used_at: z.string().datetime({ offset: true }), + state: z.enum([ + "Unknown", + "Created", + "Queued", + "Provisioning", + "Available", + "Awaiting", + "Unavailable", + "Deleted", + "Moved", + "Shutdown", + "Archived", + "Starting", + "ShuttingDown", + "Failed", + "Exporting", + "Updating", + "Rebuilding", + ]), + url: z.string(), + git_status: z.object({ + ahead: z.coerce.number().optional(), + behind: z.coerce.number().optional(), + has_unpushed_changes: PermissiveBoolean.optional(), + has_uncommitted_changes: PermissiveBoolean.optional(), + ref: z.string().optional(), + }), + location: z.enum(["EastUs", "SouthEastAsia", "WestEurope", "WestUs2"]), + idle_timeout_minutes: z.coerce.number().nullable(), + web_url: z.string(), + machines_url: z.string(), + start_url: z.string(), + stop_url: z.string(), + publish_url: z.string().nullable().optional(), + pulls_url: z.string().nullable(), + recent_folders: z.array(z.string()), + runtime_constraints: z + .object({ + allowed_port_privacy_settings: z.array(z.string()).nullable().optional(), + }) + .optional(), + pending_operation: PermissiveBoolean.nullable().optional(), + pending_operation_disabled_reason: z.string().nullable().optional(), + idle_timeout_notice: z.string().nullable().optional(), + retention_period_minutes: z.coerce.number().nullable().optional(), + retention_expires_at: z + .string() + .datetime({ offset: true }) + .nullable() + .optional(), +}) + +export const s_dependabot_alert = z.object({ + number: s_alert_number, + state: z.enum(["auto_dismissed", "dismissed", "fixed", "open"]), + dependency: z.object({ + package: s_dependabot_alert_package.optional(), + manifest_path: z.string().optional(), + scope: z.enum(["development", "runtime"]).nullable().optional(), + relationship: z + .enum(["unknown", "direct", "transitive"]) + .nullable() + .optional(), + }), + security_advisory: s_dependabot_alert_security_advisory, + security_vulnerability: s_dependabot_alert_security_vulnerability, + url: s_alert_url, + html_url: s_alert_html_url, + created_at: s_alert_created_at, + updated_at: s_alert_updated_at, + dismissed_at: s_alert_dismissed_at, + dismissed_by: s_nullable_simple_user, + dismissed_reason: z + .enum([ + "fix_started", + "inaccurate", + "no_bandwidth", + "not_used", + "tolerable_risk", + ]) + .nullable(), + dismissed_comment: z.string().max(280).nullable(), + fixed_at: s_alert_fixed_at, + auto_dismissed_at: s_alert_auto_dismissed_at.optional(), +}) + +export const s_dependabot_alert_with_repository = z.object({ + number: s_alert_number, + state: z.enum(["auto_dismissed", "dismissed", "fixed", "open"]), + dependency: z.object({ + package: s_dependabot_alert_package.optional(), + manifest_path: z.string().optional(), + scope: z.enum(["development", "runtime"]).nullable().optional(), + relationship: z + .enum(["unknown", "direct", "transitive"]) + .nullable() + .optional(), + }), + security_advisory: s_dependabot_alert_security_advisory, + security_vulnerability: s_dependabot_alert_security_vulnerability, + url: s_alert_url, + html_url: s_alert_html_url, + created_at: s_alert_created_at, + updated_at: s_alert_updated_at, + dismissed_at: s_alert_dismissed_at, + dismissed_by: s_nullable_simple_user, + dismissed_reason: z + .enum([ + "fix_started", + "inaccurate", + "no_bandwidth", + "not_used", + "tolerable_risk", + ]) + .nullable(), + dismissed_comment: z.string().max(280).nullable(), + fixed_at: s_alert_fixed_at, + auto_dismissed_at: s_alert_auto_dismissed_at.optional(), + repository: s_simple_repository, +}) + +export const s_event = z.object({ + id: z.string(), + type: z.string().nullable(), + actor: s_actor, + repo: z.object({ id: z.coerce.number(), name: z.string(), url: z.string() }), + org: s_actor.optional(), + payload: z.object({ + action: z.string().optional(), + issue: s_issue.optional(), + comment: s_issue_comment.optional(), + pages: z + .array( + z.object({ + page_name: z.string().optional(), + title: z.string().optional(), + summary: z.string().nullable().optional(), + action: z.string().optional(), + sha: z.string().optional(), + html_url: z.string().optional(), + }), + ) + .optional(), + }), + public: PermissiveBoolean, + created_at: z.string().datetime({ offset: true }).nullable(), +}) + +export const s_issue_event = z.object({ + id: z.coerce.number(), + node_id: z.string(), + url: z.string(), + actor: s_nullable_simple_user, + event: z.string(), + commit_id: z.string().nullable(), + commit_url: z.string().nullable(), + created_at: z.string().datetime({ offset: true }), + issue: s_nullable_issue.optional(), + label: s_issue_event_label.optional(), + assignee: s_nullable_simple_user.optional(), + assigner: s_nullable_simple_user.optional(), + review_requester: s_nullable_simple_user.optional(), + requested_reviewer: s_nullable_simple_user.optional(), + requested_team: s_team.optional(), + dismissed_review: s_issue_event_dismissed_review.optional(), + milestone: s_issue_event_milestone.optional(), + project_card: s_issue_event_project_card.optional(), + rename: s_issue_event_rename.optional(), + author_association: s_author_association.optional(), + lock_reason: z.string().nullable().optional(), + performed_via_github_app: s_nullable_integration.optional(), +}) + +export const s_issue_event_for_issue = z.union([ + s_labeled_issue_event, + s_unlabeled_issue_event, + s_assigned_issue_event, + s_unassigned_issue_event, + s_milestoned_issue_event, + s_demilestoned_issue_event, + s_renamed_issue_event, + s_review_requested_issue_event, + s_review_request_removed_issue_event, + s_review_dismissed_issue_event, + s_locked_issue_event, + s_added_to_project_issue_event, + s_moved_column_in_project_issue_event, + s_removed_from_project_issue_event, + s_converted_note_to_issue_issue_event, +]) + +export const s_repository_ruleset = z.object({ + id: z.coerce.number(), + name: z.string(), + target: z.enum(["branch", "tag", "push", "repository"]).optional(), + source_type: z.enum(["Repository", "Organization", "Enterprise"]).optional(), + source: z.string(), + enforcement: s_repository_rule_enforcement, + bypass_actors: z.array(s_repository_ruleset_bypass_actor).optional(), + current_user_can_bypass: z + .enum(["always", "pull_requests_only", "never"]) + .optional(), + node_id: z.string().optional(), + _links: z + .object({ + self: z.object({ href: z.string().optional() }).optional(), + html: z.object({ href: z.string().optional() }).nullable().optional(), + }) + .optional(), + conditions: z + .union([s_repository_ruleset_conditions, s_org_ruleset_conditions]) + .nullable() + .optional(), + rules: z.array(s_repository_rule).optional(), + created_at: z.string().datetime({ offset: true }).optional(), + updated_at: z.string().datetime({ offset: true }).optional(), +}) + +export const s_snapshot = z.object({ + version: z.coerce.number(), + job: z.object({ + id: z.string(), + correlator: z.string(), + html_url: z.string().optional(), + }), + sha: z.string().min(40).max(40), + ref: z.string().regex(new RegExp("^refs/")), + detector: z.object({ + name: z.string(), + version: z.string(), + url: z.string(), + }), + metadata: s_metadata.optional(), + manifests: z.record(s_manifest).optional(), + scanned: z.string().datetime({ offset: true }), +}) + +export const s_timeline_cross_referenced_event = z.object({ + event: z.string(), + actor: s_simple_user.optional(), + created_at: z.string().datetime({ offset: true }), + updated_at: z.string().datetime({ offset: true }), + source: z.object({ type: z.string().optional(), issue: s_issue.optional() }), +}) + +export const s_branch_with_protection = z.object({ + name: z.string(), + commit: s_commit, + _links: z.object({ html: z.string(), self: z.string() }), + protected: PermissiveBoolean, + protection: s_branch_protection, + protection_url: z.string(), + pattern: z.string().optional(), + required_approving_review_count: z.coerce.number().optional(), +}) + +export const s_short_branch = z.object({ + name: z.string(), + commit: z.object({ sha: z.string(), url: z.string() }), + protected: PermissiveBoolean, + protection: s_branch_protection.optional(), + protection_url: z.string().optional(), +}) + +export const s_timeline_issue_events = z.union([ + s_labeled_issue_event, + s_unlabeled_issue_event, + s_milestoned_issue_event, + s_demilestoned_issue_event, + s_renamed_issue_event, + s_review_requested_issue_event, + s_review_request_removed_issue_event, + s_review_dismissed_issue_event, + s_locked_issue_event, + s_added_to_project_issue_event, + s_moved_column_in_project_issue_event, + s_removed_from_project_issue_event, + s_converted_note_to_issue_issue_event, + s_timeline_comment_event, + s_timeline_cross_referenced_event, + s_timeline_committed_event, + s_timeline_reviewed_event, + s_timeline_line_commented_event, + s_timeline_commit_commented_event, + s_timeline_assigned_issue_event, + s_timeline_unassigned_issue_event, + s_state_change_issue_event, +]) diff --git a/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/generated.ts b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/generated.ts new file mode 100644 index 000000000..f856263e1 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/generated.ts @@ -0,0 +1,2677 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_Azure_Core_Foundations_OperationState, + t_GetServiceStatusQuerySchema, + t_GetServiceStatusRequestHeaderSchema, + t_Manufacturer, + t_ManufacturersCreateOrReplaceManufacturerParamSchema, + t_ManufacturersCreateOrReplaceManufacturerQuerySchema, + t_ManufacturersCreateOrReplaceManufacturerRequestBodySchema, + t_ManufacturersCreateOrReplaceManufacturerRequestHeaderSchema, + t_ManufacturersDeleteManufacturerParamSchema, + t_ManufacturersDeleteManufacturerQuerySchema, + t_ManufacturersDeleteManufacturerRequestHeaderSchema, + t_ManufacturersGetManufacturerOperationStatusParamSchema, + t_ManufacturersGetManufacturerOperationStatusQuerySchema, + t_ManufacturersGetManufacturerParamSchema, + t_ManufacturersGetManufacturerQuerySchema, + t_ManufacturersGetManufacturerRequestHeaderSchema, + t_ManufacturersListManufacturersQuerySchema, + t_ManufacturersListManufacturersRequestHeaderSchema, + t_PagedManufacturer, + t_PagedWidget, + t_PagedWidgetPart, + t_Widget, + t_WidgetAnalytics, + t_WidgetPart, + t_WidgetPartsCreateWidgetPartParamSchema, + t_WidgetPartsCreateWidgetPartQuerySchema, + t_WidgetPartsCreateWidgetPartRequestBodySchema, + t_WidgetPartsCreateWidgetPartRequestHeaderSchema, + t_WidgetPartsDeleteWidgetPartParamSchema, + t_WidgetPartsDeleteWidgetPartQuerySchema, + t_WidgetPartsDeleteWidgetPartRequestHeaderSchema, + t_WidgetPartsGetWidgetPartOperationStatusParamSchema, + t_WidgetPartsGetWidgetPartOperationStatusQuerySchema, + t_WidgetPartsGetWidgetPartParamSchema, + t_WidgetPartsGetWidgetPartQuerySchema, + t_WidgetPartsGetWidgetPartRequestHeaderSchema, + t_WidgetPartsListWidgetPartsParamSchema, + t_WidgetPartsListWidgetPartsQuerySchema, + t_WidgetPartsListWidgetPartsRequestHeaderSchema, + t_WidgetPartsReorderPartsParamSchema, + t_WidgetPartsReorderPartsQuerySchema, + t_WidgetPartsReorderPartsRequestBodySchema, + t_WidgetPartsReorderPartsRequestHeaderSchema, + t_WidgetRepairRequest, + t_WidgetRepairState, + t_WidgetsCreateOrUpdateWidgetParamSchema, + t_WidgetsCreateOrUpdateWidgetQuerySchema, + t_WidgetsCreateOrUpdateWidgetRequestBodySchema, + t_WidgetsCreateOrUpdateWidgetRequestHeaderSchema, + t_WidgetsDeleteWidgetParamSchema, + t_WidgetsDeleteWidgetQuerySchema, + t_WidgetsDeleteWidgetRequestHeaderSchema, + t_WidgetsGetAnalyticsParamSchema, + t_WidgetsGetAnalyticsQuerySchema, + t_WidgetsGetAnalyticsRequestHeaderSchema, + t_WidgetsGetRepairStatusParamSchema, + t_WidgetsGetRepairStatusQuerySchema, + t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema, + t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema, + t_WidgetsGetWidgetParamSchema, + t_WidgetsGetWidgetQuerySchema, + t_WidgetsGetWidgetRequestHeaderSchema, + t_WidgetsListWidgetsQuerySchema, + t_WidgetsListWidgetsRequestHeaderSchema, + t_WidgetsScheduleRepairsParamSchema, + t_WidgetsScheduleRepairsQuerySchema, + t_WidgetsScheduleRepairsRequestBodySchema, + t_WidgetsScheduleRepairsRequestHeaderSchema, + t_WidgetsUpdateAnalyticsParamSchema, + t_WidgetsUpdateAnalyticsQuerySchema, + t_WidgetsUpdateAnalyticsRequestBodySchema, + t_WidgetsUpdateAnalyticsRequestHeaderSchema, +} from "./models" +import { + s_Azure_Core_Foundations_Error, + s_Azure_Core_Foundations_ErrorResponse, + s_Azure_Core_Foundations_OperationState, + s_Azure_Core_uuid, + s_Manufacturer, + s_PagedManufacturer, + s_PagedWidget, + s_PagedWidgetPart, + s_Widget, + s_WidgetAnalytics, + s_WidgetAnalyticsCreateOrUpdate, + s_WidgetCreateOrUpdate, + s_WidgetPart, + s_WidgetPartReorderRequest, + s_WidgetRepairRequest, + s_WidgetRepairState, +} from "./schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + ServerConfig, + SkipResponse, + StatusCode, + startServer, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type GetServiceStatusResponder = { + with200(): ExpressRuntimeResponse<{ + statusString: string + }> + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetServiceStatus = ( + params: Params< + void, + t_GetServiceStatusQuerySchema, + void, + t_GetServiceStatusRequestHeaderSchema + >, + respond: GetServiceStatusResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusResponder = + { + with200(): ExpressRuntimeResponse< + | { + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: t_Widget | undefined + status: t_Azure_Core_Foundations_OperationState + } + | { + error?: t_Azure_Core_Foundations_Error | undefined + id: string + status: t_Azure_Core_Foundations_OperationState + } + > + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatus = + ( + params: Params< + t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema, + t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema, + void, + void + >, + respond: WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusResponder, + req: Request, + res: Response, + next: NextFunction, + ) => Promise | typeof SkipResponse> + +export type WidgetsCreateOrUpdateWidgetResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetsCreateOrUpdateWidget = ( + params: Params< + t_WidgetsCreateOrUpdateWidgetParamSchema, + t_WidgetsCreateOrUpdateWidgetQuerySchema, + t_WidgetsCreateOrUpdateWidgetRequestBodySchema, + t_WidgetsCreateOrUpdateWidgetRequestHeaderSchema + >, + respond: WidgetsCreateOrUpdateWidgetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetsGetWidgetResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetsGetWidget = ( + params: Params< + t_WidgetsGetWidgetParamSchema, + t_WidgetsGetWidgetQuerySchema, + void, + t_WidgetsGetWidgetRequestHeaderSchema + >, + respond: WidgetsGetWidgetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetsDeleteWidgetResponder = { + with202(): ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + status: t_Azure_Core_Foundations_OperationState + }> + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetsDeleteWidget = ( + params: Params< + t_WidgetsDeleteWidgetParamSchema, + t_WidgetsDeleteWidgetQuerySchema, + void, + t_WidgetsDeleteWidgetRequestHeaderSchema + >, + respond: WidgetsDeleteWidgetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetsListWidgetsResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetsListWidgets = ( + params: Params< + void, + t_WidgetsListWidgetsQuerySchema, + void, + t_WidgetsListWidgetsRequestHeaderSchema + >, + respond: WidgetsListWidgetsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetsGetAnalyticsResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetsGetAnalytics = ( + params: Params< + t_WidgetsGetAnalyticsParamSchema, + t_WidgetsGetAnalyticsQuerySchema, + void, + t_WidgetsGetAnalyticsRequestHeaderSchema + >, + respond: WidgetsGetAnalyticsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetsUpdateAnalyticsResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetsUpdateAnalytics = ( + params: Params< + t_WidgetsUpdateAnalyticsParamSchema, + t_WidgetsUpdateAnalyticsQuerySchema, + t_WidgetsUpdateAnalyticsRequestBodySchema, + t_WidgetsUpdateAnalyticsRequestHeaderSchema + >, + respond: WidgetsUpdateAnalyticsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetsGetRepairStatusResponder = { + with200(): ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: t_WidgetRepairRequest | undefined + status: t_Azure_Core_Foundations_OperationState + }> + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetsGetRepairStatus = ( + params: Params< + t_WidgetsGetRepairStatusParamSchema, + t_WidgetsGetRepairStatusQuerySchema, + void, + void + >, + respond: WidgetsGetRepairStatusResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetsScheduleRepairsResponder = { + with202(): ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: + | { + completedDateTime: string + createdDateTime: string + requestState: t_WidgetRepairState + scheduledDateTime: string + updatedDateTime: string + } + | undefined + status: t_Azure_Core_Foundations_OperationState + }> + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetsScheduleRepairs = ( + params: Params< + t_WidgetsScheduleRepairsParamSchema, + t_WidgetsScheduleRepairsQuerySchema, + t_WidgetsScheduleRepairsRequestBodySchema, + t_WidgetsScheduleRepairsRequestHeaderSchema + >, + respond: WidgetsScheduleRepairsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetPartsGetWidgetPartOperationStatusResponder = { + with200(): ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: t_WidgetPart | undefined + status: t_Azure_Core_Foundations_OperationState + }> + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetPartsGetWidgetPartOperationStatus = ( + params: Params< + t_WidgetPartsGetWidgetPartOperationStatusParamSchema, + t_WidgetPartsGetWidgetPartOperationStatusQuerySchema, + void, + void + >, + respond: WidgetPartsGetWidgetPartOperationStatusResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetPartsCreateWidgetPartResponder = { + with201(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetPartsCreateWidgetPart = ( + params: Params< + t_WidgetPartsCreateWidgetPartParamSchema, + t_WidgetPartsCreateWidgetPartQuerySchema, + t_WidgetPartsCreateWidgetPartRequestBodySchema, + t_WidgetPartsCreateWidgetPartRequestHeaderSchema + >, + respond: WidgetPartsCreateWidgetPartResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetPartsListWidgetPartsResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetPartsListWidgetParts = ( + params: Params< + t_WidgetPartsListWidgetPartsParamSchema, + t_WidgetPartsListWidgetPartsQuerySchema, + void, + t_WidgetPartsListWidgetPartsRequestHeaderSchema + >, + respond: WidgetPartsListWidgetPartsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetPartsGetWidgetPartResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetPartsGetWidgetPart = ( + params: Params< + t_WidgetPartsGetWidgetPartParamSchema, + t_WidgetPartsGetWidgetPartQuerySchema, + void, + t_WidgetPartsGetWidgetPartRequestHeaderSchema + >, + respond: WidgetPartsGetWidgetPartResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetPartsDeleteWidgetPartResponder = { + with204(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetPartsDeleteWidgetPart = ( + params: Params< + t_WidgetPartsDeleteWidgetPartParamSchema, + t_WidgetPartsDeleteWidgetPartQuerySchema, + void, + t_WidgetPartsDeleteWidgetPartRequestHeaderSchema + >, + respond: WidgetPartsDeleteWidgetPartResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type WidgetPartsReorderPartsResponder = { + with202(): ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + status: t_Azure_Core_Foundations_OperationState + }> + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type WidgetPartsReorderParts = ( + params: Params< + t_WidgetPartsReorderPartsParamSchema, + t_WidgetPartsReorderPartsQuerySchema, + t_WidgetPartsReorderPartsRequestBodySchema, + t_WidgetPartsReorderPartsRequestHeaderSchema + >, + respond: WidgetPartsReorderPartsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ManufacturersGetManufacturerOperationStatusResponder = { + with200(): ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: t_Manufacturer | undefined + status: t_Azure_Core_Foundations_OperationState + }> + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ManufacturersGetManufacturerOperationStatus = ( + params: Params< + t_ManufacturersGetManufacturerOperationStatusParamSchema, + t_ManufacturersGetManufacturerOperationStatusQuerySchema, + void, + void + >, + respond: ManufacturersGetManufacturerOperationStatusResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ManufacturersCreateOrReplaceManufacturerResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ManufacturersCreateOrReplaceManufacturer = ( + params: Params< + t_ManufacturersCreateOrReplaceManufacturerParamSchema, + t_ManufacturersCreateOrReplaceManufacturerQuerySchema, + t_ManufacturersCreateOrReplaceManufacturerRequestBodySchema, + t_ManufacturersCreateOrReplaceManufacturerRequestHeaderSchema + >, + respond: ManufacturersCreateOrReplaceManufacturerResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ManufacturersGetManufacturerResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ManufacturersGetManufacturer = ( + params: Params< + t_ManufacturersGetManufacturerParamSchema, + t_ManufacturersGetManufacturerQuerySchema, + void, + t_ManufacturersGetManufacturerRequestHeaderSchema + >, + respond: ManufacturersGetManufacturerResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ManufacturersDeleteManufacturerResponder = { + with202(): ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + status: t_Azure_Core_Foundations_OperationState + }> + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ManufacturersDeleteManufacturer = ( + params: Params< + t_ManufacturersDeleteManufacturerParamSchema, + t_ManufacturersDeleteManufacturerQuerySchema, + void, + t_ManufacturersDeleteManufacturerRequestHeaderSchema + >, + respond: ManufacturersDeleteManufacturerResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ManufacturersListManufacturersResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ManufacturersListManufacturers = ( + params: Params< + void, + t_ManufacturersListManufacturersQuerySchema, + void, + t_ManufacturersListManufacturersRequestHeaderSchema + >, + respond: ManufacturersListManufacturersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type Implementation = { + getServiceStatus: GetServiceStatus + widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatus: WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatus + widgetsCreateOrUpdateWidget: WidgetsCreateOrUpdateWidget + widgetsGetWidget: WidgetsGetWidget + widgetsDeleteWidget: WidgetsDeleteWidget + widgetsListWidgets: WidgetsListWidgets + widgetsGetAnalytics: WidgetsGetAnalytics + widgetsUpdateAnalytics: WidgetsUpdateAnalytics + widgetsGetRepairStatus: WidgetsGetRepairStatus + widgetsScheduleRepairs: WidgetsScheduleRepairs + widgetPartsGetWidgetPartOperationStatus: WidgetPartsGetWidgetPartOperationStatus + widgetPartsCreateWidgetPart: WidgetPartsCreateWidgetPart + widgetPartsListWidgetParts: WidgetPartsListWidgetParts + widgetPartsGetWidgetPart: WidgetPartsGetWidgetPart + widgetPartsDeleteWidgetPart: WidgetPartsDeleteWidgetPart + widgetPartsReorderParts: WidgetPartsReorderParts + manufacturersGetManufacturerOperationStatus: ManufacturersGetManufacturerOperationStatus + manufacturersCreateOrReplaceManufacturer: ManufacturersCreateOrReplaceManufacturer + manufacturersGetManufacturer: ManufacturersGetManufacturer + manufacturersDeleteManufacturer: ManufacturersDeleteManufacturer + manufacturersListManufacturers: ManufacturersListManufacturers +} + +export function createRouter(implementation: Implementation): Router { + const router = Router() + + const getServiceStatusQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const getServiceStatusRequestHeaderSchema = z.object({ + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const getServiceStatusResponseBodyValidator = responseValidationFactory( + [["200", z.object({ statusString: z.string() })]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // getServiceStatus + router.get( + `/service-status`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getServiceStatusQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + getServiceStatusRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + statusString: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getServiceStatus(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getServiceStatusResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema = + z.object({ widgetName: z.string(), operationId: z.string() }) + + const widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema = + z.object({ "api-version": z.string().min(1) }) + + const widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([ + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + result: s_Widget.optional(), + }), + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + }), + ]), + ], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatus + router.get( + `/widgets/:widgetName/operations/:operationId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + | { + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: t_Widget | undefined + status: t_Azure_Core_Foundations_OperationState + } + | { + error?: t_Azure_Core_Foundations_Error | undefined + id: string + status: t_Azure_Core_Foundations_OperationState + } + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatus( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + widgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsCreateOrUpdateWidgetParamSchema = z.object({ + widgetName: z.string(), + }) + + const widgetsCreateOrUpdateWidgetQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetsCreateOrUpdateWidgetRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetsCreateOrUpdateWidgetRequestBodySchema = s_WidgetCreateOrUpdate + + const widgetsCreateOrUpdateWidgetResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_Widget], + ["201", s_Widget], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsCreateOrUpdateWidget + router.patch( + `/widgets/:widgetName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetsCreateOrUpdateWidgetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetsCreateOrUpdateWidgetQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetsCreateOrUpdateWidgetRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: parseRequestInput( + widgetsCreateOrUpdateWidgetRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsCreateOrUpdateWidget(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + widgetsCreateOrUpdateWidgetResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsGetWidgetParamSchema = z.object({ widgetName: z.string() }) + + const widgetsGetWidgetQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetsGetWidgetRequestHeaderSchema = z.object({ + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetsGetWidgetResponseBodyValidator = responseValidationFactory( + [["200", s_Widget]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsGetWidget + router.get( + `/widgets/:widgetName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetsGetWidgetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetsGetWidgetQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + widgetsGetWidgetRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsGetWidget(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetsGetWidgetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsDeleteWidgetParamSchema = z.object({ widgetName: z.string() }) + + const widgetsDeleteWidgetQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetsDeleteWidgetRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetsDeleteWidgetResponseBodyValidator = responseValidationFactory( + [ + [ + "202", + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + }), + ], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsDeleteWidget + router.delete( + `/widgets/:widgetName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetsDeleteWidgetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetsDeleteWidgetQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + widgetsDeleteWidgetRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + status: t_Azure_Core_Foundations_OperationState + }>(202) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsDeleteWidget(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetsDeleteWidgetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsListWidgetsQuerySchema = z.object({ + "api-version": z.string().min(1), + top: z.coerce.number().optional(), + skip: z.coerce.number().optional().default(0), + maxpagesize: z.coerce.number().optional(), + select: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), + }) + + const widgetsListWidgetsRequestHeaderSchema = z.object({ + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetsListWidgetsResponseBodyValidator = responseValidationFactory( + [["200", s_PagedWidget]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsListWidgets + router.get( + `/widgets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + widgetsListWidgetsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + widgetsListWidgetsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsListWidgets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetsListWidgetsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsGetAnalyticsParamSchema = z.object({ widgetName: z.string() }) + + const widgetsGetAnalyticsQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetsGetAnalyticsRequestHeaderSchema = z.object({ + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetsGetAnalyticsResponseBodyValidator = responseValidationFactory( + [["200", s_WidgetAnalytics]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsGetAnalytics + router.get( + `/widgets/:widgetName/analytics/current`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetsGetAnalyticsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetsGetAnalyticsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + widgetsGetAnalyticsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsGetAnalytics(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetsGetAnalyticsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsUpdateAnalyticsParamSchema = z.object({ widgetName: z.string() }) + + const widgetsUpdateAnalyticsQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetsUpdateAnalyticsRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetsUpdateAnalyticsRequestBodySchema = + s_WidgetAnalyticsCreateOrUpdate + + const widgetsUpdateAnalyticsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_WidgetAnalytics], + ["201", s_WidgetAnalytics], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsUpdateAnalytics + router.patch( + `/widgets/:widgetName/analytics/current`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetsUpdateAnalyticsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetsUpdateAnalyticsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetsUpdateAnalyticsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: parseRequestInput( + widgetsUpdateAnalyticsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsUpdateAnalytics(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetsUpdateAnalyticsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsGetRepairStatusParamSchema = z.object({ + widgetId: z.string(), + operationId: z.string(), + }) + + const widgetsGetRepairStatusQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetsGetRepairStatusResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + result: s_WidgetRepairRequest.optional(), + }), + ], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsGetRepairStatus + router.get( + `/widgets/:widgetId/repairs/:operationId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetsGetRepairStatusParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetsGetRepairStatusQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: t_WidgetRepairRequest | undefined + status: t_Azure_Core_Foundations_OperationState + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsGetRepairStatus(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetsGetRepairStatusResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetsScheduleRepairsParamSchema = z.object({ widgetName: z.string() }) + + const widgetsScheduleRepairsQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetsScheduleRepairsRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetsScheduleRepairsRequestBodySchema = s_WidgetRepairRequest + + const widgetsScheduleRepairsResponseBodyValidator = responseValidationFactory( + [ + [ + "202", + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + result: z + .object({ + requestState: s_WidgetRepairState, + scheduledDateTime: z.string().datetime({ offset: true }), + createdDateTime: z.string().datetime({ offset: true }), + updatedDateTime: z.string().datetime({ offset: true }), + completedDateTime: z.string().datetime({ offset: true }), + }) + .optional(), + }), + ], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetsScheduleRepairs + router.post( + `/widgets/:widgetName:scheduleRepairs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetsScheduleRepairsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetsScheduleRepairsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetsScheduleRepairsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: parseRequestInput( + widgetsScheduleRepairsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: + | { + completedDateTime: string + createdDateTime: string + requestState: t_WidgetRepairState + scheduledDateTime: string + updatedDateTime: string + } + | undefined + status: t_Azure_Core_Foundations_OperationState + }>(202) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetsScheduleRepairs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetsScheduleRepairsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetPartsGetWidgetPartOperationStatusParamSchema = z.object({ + widgetName: z.string(), + widgetPartName: z.string(), + operationId: z.string(), + }) + + const widgetPartsGetWidgetPartOperationStatusQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetPartsGetWidgetPartOperationStatusResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + result: s_WidgetPart.optional(), + }), + ], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetPartsGetWidgetPartOperationStatus + router.get( + `/widgets/:widgetName/parts/:widgetPartName/operations/:operationId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetPartsGetWidgetPartOperationStatusParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetPartsGetWidgetPartOperationStatusQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: t_WidgetPart | undefined + status: t_Azure_Core_Foundations_OperationState + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetPartsGetWidgetPartOperationStatus( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + widgetPartsGetWidgetPartOperationStatusResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetPartsCreateWidgetPartParamSchema = z.object({ + widgetName: z.string(), + }) + + const widgetPartsCreateWidgetPartQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetPartsCreateWidgetPartRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetPartsCreateWidgetPartRequestBodySchema = s_WidgetPart + + const widgetPartsCreateWidgetPartResponseBodyValidator = + responseValidationFactory( + [["201", z.undefined()]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetPartsCreateWidgetPart + router.post( + `/widgets/:widgetName/parts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetPartsCreateWidgetPartParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetPartsCreateWidgetPartQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetPartsCreateWidgetPartRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: parseRequestInput( + widgetPartsCreateWidgetPartRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetPartsCreateWidgetPart(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + widgetPartsCreateWidgetPartResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetPartsListWidgetPartsParamSchema = z.object({ + widgetName: z.string(), + }) + + const widgetPartsListWidgetPartsQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetPartsListWidgetPartsRequestHeaderSchema = z.object({ + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetPartsListWidgetPartsResponseBodyValidator = + responseValidationFactory( + [["200", s_PagedWidgetPart]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetPartsListWidgetParts + router.get( + `/widgets/:widgetName/parts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetPartsListWidgetPartsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetPartsListWidgetPartsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + widgetPartsListWidgetPartsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetPartsListWidgetParts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + widgetPartsListWidgetPartsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetPartsGetWidgetPartParamSchema = z.object({ + widgetName: z.string(), + widgetPartName: z.string(), + }) + + const widgetPartsGetWidgetPartQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetPartsGetWidgetPartRequestHeaderSchema = z.object({ + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetPartsGetWidgetPartResponseBodyValidator = + responseValidationFactory( + [["200", s_WidgetPart]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetPartsGetWidgetPart + router.get( + `/widgets/:widgetName/parts/:widgetPartName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetPartsGetWidgetPartParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetPartsGetWidgetPartQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + widgetPartsGetWidgetPartRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetPartsGetWidgetPart(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetPartsGetWidgetPartResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetPartsDeleteWidgetPartParamSchema = z.object({ + widgetName: z.string(), + widgetPartName: z.string(), + }) + + const widgetPartsDeleteWidgetPartQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetPartsDeleteWidgetPartRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetPartsDeleteWidgetPartResponseBodyValidator = + responseValidationFactory( + [["204", z.undefined()]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetPartsDeleteWidgetPart + router.delete( + `/widgets/:widgetName/parts/:widgetPartName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetPartsDeleteWidgetPartParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetPartsDeleteWidgetPartQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + widgetPartsDeleteWidgetPartRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetPartsDeleteWidgetPart(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + widgetPartsDeleteWidgetPartResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const widgetPartsReorderPartsParamSchema = z.object({ + widgetName: z.string(), + }) + + const widgetPartsReorderPartsQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const widgetPartsReorderPartsRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const widgetPartsReorderPartsRequestBodySchema = s_WidgetPartReorderRequest + + const widgetPartsReorderPartsResponseBodyValidator = + responseValidationFactory( + [ + [ + "202", + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + }), + ], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // widgetPartsReorderParts + router.post( + `/widgets/:widgetName/parts:reorderParts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + widgetPartsReorderPartsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + widgetPartsReorderPartsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + widgetPartsReorderPartsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: parseRequestInput( + widgetPartsReorderPartsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + status: t_Azure_Core_Foundations_OperationState + }>(202) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .widgetPartsReorderParts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(widgetPartsReorderPartsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const manufacturersGetManufacturerOperationStatusParamSchema = z.object({ + manufacturerId: z.string(), + operationId: z.string(), + }) + + const manufacturersGetManufacturerOperationStatusQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const manufacturersGetManufacturerOperationStatusResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + result: s_Manufacturer.optional(), + }), + ], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // manufacturersGetManufacturerOperationStatus + router.get( + `/manufacturers/:manufacturerId/operations/:operationId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + manufacturersGetManufacturerOperationStatusParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + manufacturersGetManufacturerOperationStatusQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + result?: t_Manufacturer | undefined + status: t_Azure_Core_Foundations_OperationState + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .manufacturersGetManufacturerOperationStatus( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + manufacturersGetManufacturerOperationStatusResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const manufacturersCreateOrReplaceManufacturerParamSchema = z.object({ + manufacturerId: z.string(), + }) + + const manufacturersCreateOrReplaceManufacturerQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const manufacturersCreateOrReplaceManufacturerRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const manufacturersCreateOrReplaceManufacturerRequestBodySchema = + s_Manufacturer + + const manufacturersCreateOrReplaceManufacturerResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_Manufacturer], + ["201", s_Manufacturer], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // manufacturersCreateOrReplaceManufacturer + router.put( + `/manufacturers/:manufacturerId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + manufacturersCreateOrReplaceManufacturerParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + manufacturersCreateOrReplaceManufacturerQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + manufacturersCreateOrReplaceManufacturerRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: parseRequestInput( + manufacturersCreateOrReplaceManufacturerRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .manufacturersCreateOrReplaceManufacturer( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + manufacturersCreateOrReplaceManufacturerResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const manufacturersGetManufacturerParamSchema = z.object({ + manufacturerId: z.string(), + }) + + const manufacturersGetManufacturerQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const manufacturersGetManufacturerRequestHeaderSchema = z.object({ + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const manufacturersGetManufacturerResponseBodyValidator = + responseValidationFactory( + [["200", s_Manufacturer]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // manufacturersGetManufacturer + router.get( + `/manufacturers/:manufacturerId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + manufacturersGetManufacturerParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + manufacturersGetManufacturerQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + manufacturersGetManufacturerRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .manufacturersGetManufacturer(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + manufacturersGetManufacturerResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const manufacturersDeleteManufacturerParamSchema = z.object({ + manufacturerId: z.string(), + }) + + const manufacturersDeleteManufacturerQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const manufacturersDeleteManufacturerRequestHeaderSchema = z.object({ + "repeatability-request-id": z.string().optional(), + "repeatability-first-sent": z.string().optional(), + "if-match": z.string().optional(), + "if-none-match": z.string().optional(), + "if-unmodified-since": z.string().optional(), + "if-modified-since": z.string().optional(), + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const manufacturersDeleteManufacturerResponseBodyValidator = + responseValidationFactory( + [ + [ + "202", + z.object({ + id: z.string(), + status: s_Azure_Core_Foundations_OperationState, + error: z.lazy(() => s_Azure_Core_Foundations_Error.optional()), + }), + ], + ], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // manufacturersDeleteManufacturer + router.delete( + `/manufacturers/:manufacturerId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + manufacturersDeleteManufacturerParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + manufacturersDeleteManufacturerQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + manufacturersDeleteManufacturerRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with202() { + return new ExpressRuntimeResponse<{ + error?: t_Azure_Core_Foundations_Error | undefined + id: string + status: t_Azure_Core_Foundations_OperationState + }>(202) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .manufacturersDeleteManufacturer(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + manufacturersDeleteManufacturerResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const manufacturersListManufacturersQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const manufacturersListManufacturersRequestHeaderSchema = z.object({ + "x-ms-client-request-id": s_Azure_Core_uuid.optional(), + }) + + const manufacturersListManufacturersResponseBodyValidator = + responseValidationFactory( + [["200", s_PagedManufacturer]], + s_Azure_Core_Foundations_ErrorResponse, + ) + + // manufacturersListManufacturers + router.get( + `/manufacturers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + manufacturersListManufacturersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: parseRequestInput( + manufacturersListManufacturersRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .manufacturersListManufacturers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + manufacturersListManufacturersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export async function bootstrap(config: ServerConfig) { + // Contoso Widget Manager + return startServer(config) +} diff --git a/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/models.ts b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/models.ts new file mode 100644 index 000000000..4528dd101 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/models.ts @@ -0,0 +1,432 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type t_Azure_Core_Foundations_Error = { + code: string + details?: t_Azure_Core_Foundations_Error[] | undefined + innererror?: t_Azure_Core_Foundations_InnerError | undefined + message: string + target?: string | undefined +} + +export type t_Azure_Core_Foundations_ErrorResponse = { + error: t_Azure_Core_Foundations_Error +} + +export type t_Azure_Core_Foundations_InnerError = { + code?: string | undefined + innererror?: t_Azure_Core_Foundations_InnerError | undefined +} + +export type t_Azure_Core_Foundations_OperationState = + | "NotStarted" + | "Running" + | "Succeeded" + | "Failed" + | "Canceled" + | string + +export type t_Azure_Core_eTag = string + +export type t_Azure_Core_uuid = string + +export type t_Manufacturer = { + address: string + readonly etag: t_Azure_Core_eTag + readonly id: string + name: string +} + +export type t_PagedManufacturer = { + nextLink?: string | undefined + value: t_Manufacturer[] +} + +export type t_PagedWidget = { + nextLink?: string | undefined + value: t_Widget[] +} + +export type t_PagedWidgetPart = { + nextLink?: string | undefined + value: t_WidgetPart[] +} + +export type t_Widget = { + color: t_WidgetColor + readonly etag: t_Azure_Core_eTag + manufacturerId: string + readonly name: string +} + +export type t_WidgetAnalytics = { + readonly id: "current" + repairCount: number + useCount: number +} + +export type t_WidgetColor = + | string + | "Black" + | "White" + | "Red" + | "Green" + | "Blue" + +export type t_WidgetPart = { + readonly etag: t_Azure_Core_eTag + manufacturerId: string + readonly name: string + partId: string +} + +export type t_WidgetRepairRequest = { + completedDateTime: string + createdDateTime: string + requestState: t_WidgetRepairState + scheduledDateTime: string + updatedDateTime: string +} + +export type t_WidgetRepairState = + | string + | "Succeeded" + | "Failed" + | "Canceled" + | "SentToManufacturer" + +export type t_GetServiceStatusQuerySchema = { + "api-version": string +} + +export type t_GetServiceStatusRequestHeaderSchema = { + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_ManufacturersCreateOrReplaceManufacturerParamSchema = { + manufacturerId: string +} + +export type t_ManufacturersCreateOrReplaceManufacturerQuerySchema = { + "api-version": string +} + +export type t_ManufacturersCreateOrReplaceManufacturerRequestBodySchema = { + address: string + readonly etag: t_Azure_Core_eTag + readonly id: string + name: string +} + +export type t_ManufacturersCreateOrReplaceManufacturerRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_ManufacturersDeleteManufacturerParamSchema = { + manufacturerId: string +} + +export type t_ManufacturersDeleteManufacturerQuerySchema = { + "api-version": string +} + +export type t_ManufacturersDeleteManufacturerRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_ManufacturersGetManufacturerParamSchema = { + manufacturerId: string +} + +export type t_ManufacturersGetManufacturerQuerySchema = { + "api-version": string +} + +export type t_ManufacturersGetManufacturerRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_ManufacturersGetManufacturerOperationStatusParamSchema = { + manufacturerId: string + operationId: string +} + +export type t_ManufacturersGetManufacturerOperationStatusQuerySchema = { + "api-version": string +} + +export type t_ManufacturersListManufacturersQuerySchema = { + "api-version": string +} + +export type t_ManufacturersListManufacturersRequestHeaderSchema = { + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetPartsCreateWidgetPartParamSchema = { + widgetName: string +} + +export type t_WidgetPartsCreateWidgetPartQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsCreateWidgetPartRequestBodySchema = { + readonly etag: t_Azure_Core_eTag + manufacturerId: string + readonly name: string + partId: string +} + +export type t_WidgetPartsCreateWidgetPartRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetPartsDeleteWidgetPartParamSchema = { + widgetName: string + widgetPartName: string +} + +export type t_WidgetPartsDeleteWidgetPartQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsDeleteWidgetPartRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetPartsGetWidgetPartParamSchema = { + widgetName: string + widgetPartName: string +} + +export type t_WidgetPartsGetWidgetPartQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsGetWidgetPartRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetPartsGetWidgetPartOperationStatusParamSchema = { + operationId: string + widgetName: string + widgetPartName: string +} + +export type t_WidgetPartsGetWidgetPartOperationStatusQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsListWidgetPartsParamSchema = { + widgetName: string +} + +export type t_WidgetPartsListWidgetPartsQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsListWidgetPartsRequestHeaderSchema = { + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetPartsReorderPartsParamSchema = { + widgetName: string +} + +export type t_WidgetPartsReorderPartsQuerySchema = { + "api-version": string +} + +export type t_WidgetPartsReorderPartsRequestBodySchema = { + signedOffBy: string +} + +export type t_WidgetPartsReorderPartsRequestHeaderSchema = { + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetsCreateOrUpdateWidgetParamSchema = { + widgetName: string +} + +export type t_WidgetsCreateOrUpdateWidgetQuerySchema = { + "api-version": string +} + +export type t_WidgetsCreateOrUpdateWidgetRequestBodySchema = { + color?: t_WidgetColor | undefined + manufacturerId?: string | undefined +} + +export type t_WidgetsCreateOrUpdateWidgetRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetsDeleteWidgetParamSchema = { + widgetName: string +} + +export type t_WidgetsDeleteWidgetQuerySchema = { + "api-version": string +} + +export type t_WidgetsDeleteWidgetRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetsGetAnalyticsParamSchema = { + widgetName: string +} + +export type t_WidgetsGetAnalyticsQuerySchema = { + "api-version": string +} + +export type t_WidgetsGetAnalyticsRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetsGetRepairStatusParamSchema = { + operationId: string + widgetId: string +} + +export type t_WidgetsGetRepairStatusQuerySchema = { + "api-version": string +} + +export type t_WidgetsGetWidgetParamSchema = { + widgetName: string +} + +export type t_WidgetsGetWidgetQuerySchema = { + "api-version": string +} + +export type t_WidgetsGetWidgetRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusParamSchema = + { + operationId: string + widgetName: string + } + +export type t_WidgetsGetWidgetOperationStatusWidgetsGetWidgetDeleteOperationStatusQuerySchema = + { + "api-version": string + } + +export type t_WidgetsListWidgetsQuerySchema = { + "api-version": string + maxpagesize?: number | undefined + select?: string[] | undefined + skip?: number | undefined + top?: number | undefined +} + +export type t_WidgetsListWidgetsRequestHeaderSchema = { + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetsScheduleRepairsParamSchema = { + widgetName: string +} + +export type t_WidgetsScheduleRepairsQuerySchema = { + "api-version": string +} + +export type t_WidgetsScheduleRepairsRequestBodySchema = { + completedDateTime: string + createdDateTime: string + requestState: t_WidgetRepairState + scheduledDateTime: string + updatedDateTime: string +} + +export type t_WidgetsScheduleRepairsRequestHeaderSchema = { + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} + +export type t_WidgetsUpdateAnalyticsParamSchema = { + widgetName: string +} + +export type t_WidgetsUpdateAnalyticsQuerySchema = { + "api-version": string +} + +export type t_WidgetsUpdateAnalyticsRequestBodySchema = { + repairCount?: number | undefined + useCount?: number | undefined +} + +export type t_WidgetsUpdateAnalyticsRequestHeaderSchema = { + "if-match"?: string | undefined + "if-modified-since"?: string | undefined + "if-none-match"?: string | undefined + "if-unmodified-since"?: string | undefined + "repeatability-first-sent"?: string | undefined + "repeatability-request-id"?: string | undefined + "x-ms-client-request-id"?: t_Azure_Core_uuid | undefined +} diff --git a/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/schemas.ts b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/schemas.ts new file mode 100644 index 000000000..ebbff17bc --- /dev/null +++ b/integration-tests/typescript-express/src/generated/azure-core-data-plane-service.tsp/schemas.ts @@ -0,0 +1,118 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_Core_Foundations_Error, + t_Azure_Core_Foundations_ErrorResponse, + t_Azure_Core_Foundations_InnerError, +} from "./models" +import { z } from "zod" + +export const s_Azure_Core_Foundations_OperationState = z.union([ + z.enum(["NotStarted", "Running", "Succeeded", "Failed", "Canceled"]), + z.string(), +]) + +export const s_Azure_Core_eTag = z.string() + +export const s_Azure_Core_uuid = z.string() + +export const s_WidgetAnalytics = z.object({ + id: z.enum(["current"]), + useCount: z.coerce.number(), + repairCount: z.coerce.number(), +}) + +export const s_WidgetAnalyticsCreateOrUpdate = z.object({ + useCount: z.coerce.number().optional(), + repairCount: z.coerce.number().optional(), +}) + +export const s_WidgetColor = z.union([ + z.string(), + z.enum(["Black", "White", "Red", "Green", "Blue"]), +]) + +export const s_WidgetPartReorderRequest = z.object({ signedOffBy: z.string() }) + +export const s_WidgetRepairState = z.union([ + z.string(), + z.enum(["Succeeded", "Failed", "Canceled", "SentToManufacturer"]), +]) + +export const s_Manufacturer = z.object({ + id: z.string(), + name: z.string(), + address: z.string(), + etag: s_Azure_Core_eTag, +}) + +export const s_Widget = z.object({ + name: z.string(), + color: s_WidgetColor, + manufacturerId: z.string(), + etag: s_Azure_Core_eTag, +}) + +export const s_WidgetCreateOrUpdate = z.object({ + color: s_WidgetColor.optional(), + manufacturerId: z.string().optional(), +}) + +export const s_WidgetPart = z.object({ + name: z.string(), + partId: z.string(), + manufacturerId: z.string(), + etag: s_Azure_Core_eTag, +}) + +export const s_WidgetRepairRequest = z.object({ + requestState: s_WidgetRepairState, + scheduledDateTime: z.string().datetime({ offset: true }), + createdDateTime: z.string().datetime({ offset: true }), + updatedDateTime: z.string().datetime({ offset: true }), + completedDateTime: z.string().datetime({ offset: true }), +}) + +export const s_PagedManufacturer = z.object({ + value: z.array(s_Manufacturer), + nextLink: z.string().optional(), +}) + +export const s_PagedWidget = z.object({ + value: z.array(s_Widget), + nextLink: z.string().optional(), +}) + +export const s_PagedWidgetPart = z.object({ + value: z.array(s_WidgetPart), + nextLink: z.string().optional(), +}) + +export const s_Azure_Core_Foundations_ErrorResponse: z.ZodType< + t_Azure_Core_Foundations_ErrorResponse, + z.ZodTypeDef, + unknown +> = z.object({ error: z.lazy(() => s_Azure_Core_Foundations_Error) }) + +export const s_Azure_Core_Foundations_Error: z.ZodType< + t_Azure_Core_Foundations_Error, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.string(), + message: z.string(), + target: z.string().optional(), + details: z.array(z.lazy(() => s_Azure_Core_Foundations_Error)).optional(), + innererror: z.lazy(() => s_Azure_Core_Foundations_InnerError.optional()), +}) + +export const s_Azure_Core_Foundations_InnerError: z.ZodType< + t_Azure_Core_Foundations_InnerError, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.string().optional(), + innererror: z.lazy(() => s_Azure_Core_Foundations_InnerError.optional()), +}) diff --git a/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/generated.ts b/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/generated.ts new file mode 100644 index 000000000..0b11f11d4 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/generated.ts @@ -0,0 +1,1020 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_ResourceManager_CommonTypes_ErrorResponse, + t_Employee, + t_EmployeeListResult, + t_EmployeesCheckExistenceParamSchema, + t_EmployeesCheckExistenceQuerySchema, + t_EmployeesCreateOrUpdateParamSchema, + t_EmployeesCreateOrUpdateQuerySchema, + t_EmployeesCreateOrUpdateRequestBodySchema, + t_EmployeesDeleteParamSchema, + t_EmployeesDeleteQuerySchema, + t_EmployeesGetParamSchema, + t_EmployeesGetQuerySchema, + t_EmployeesListByResourceGroupParamSchema, + t_EmployeesListByResourceGroupQuerySchema, + t_EmployeesListBySubscriptionParamSchema, + t_EmployeesListBySubscriptionQuerySchema, + t_EmployeesMoveParamSchema, + t_EmployeesMoveQuerySchema, + t_EmployeesMoveRequestBodySchema, + t_EmployeesUpdateParamSchema, + t_EmployeesUpdateQuerySchema, + t_EmployeesUpdateRequestBodySchema, + t_MoveResponse, + t_OperationListResult, + t_OperationsListQuerySchema, +} from "./models" +import { + s_Azure_Core_uuid, + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + s_Employee, + s_EmployeeListResult, + s_EmployeeUpdate, + s_MoveRequest, + s_MoveResponse, + s_OperationListResult, +} from "./schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + ServerConfig, + SkipResponse, + StatusCode, + startServer, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type OperationsListResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OperationsList = ( + params: Params, + respond: OperationsListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmployeesGetResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmployeesGet = ( + params: Params< + t_EmployeesGetParamSchema, + t_EmployeesGetQuerySchema, + void, + void + >, + respond: EmployeesGetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmployeesCreateOrUpdateResponder = { + with200(): ExpressRuntimeResponse + with201(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmployeesCreateOrUpdate = ( + params: Params< + t_EmployeesCreateOrUpdateParamSchema, + t_EmployeesCreateOrUpdateQuerySchema, + t_EmployeesCreateOrUpdateRequestBodySchema, + void + >, + respond: EmployeesCreateOrUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmployeesUpdateResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmployeesUpdate = ( + params: Params< + t_EmployeesUpdateParamSchema, + t_EmployeesUpdateQuerySchema, + t_EmployeesUpdateRequestBodySchema, + void + >, + respond: EmployeesUpdateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmployeesDeleteResponder = { + with202(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmployeesDelete = ( + params: Params< + t_EmployeesDeleteParamSchema, + t_EmployeesDeleteQuerySchema, + void, + void + >, + respond: EmployeesDeleteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmployeesCheckExistenceResponder = { + with204(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmployeesCheckExistence = ( + params: Params< + t_EmployeesCheckExistenceParamSchema, + t_EmployeesCheckExistenceQuerySchema, + void, + void + >, + respond: EmployeesCheckExistenceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmployeesListByResourceGroupResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmployeesListByResourceGroup = ( + params: Params< + t_EmployeesListByResourceGroupParamSchema, + t_EmployeesListByResourceGroupQuerySchema, + void, + void + >, + respond: EmployeesListByResourceGroupResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmployeesListBySubscriptionResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmployeesListBySubscription = ( + params: Params< + t_EmployeesListBySubscriptionParamSchema, + t_EmployeesListBySubscriptionQuerySchema, + void, + void + >, + respond: EmployeesListBySubscriptionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type EmployeesMoveResponder = { + with200(): ExpressRuntimeResponse + withDefault( + status: StatusCode, + ): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type EmployeesMove = ( + params: Params< + t_EmployeesMoveParamSchema, + t_EmployeesMoveQuerySchema, + t_EmployeesMoveRequestBodySchema, + void + >, + respond: EmployeesMoveResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type Implementation = { + operationsList: OperationsList + employeesGet: EmployeesGet + employeesCreateOrUpdate: EmployeesCreateOrUpdate + employeesUpdate: EmployeesUpdate + employeesDelete: EmployeesDelete + employeesCheckExistence: EmployeesCheckExistence + employeesListByResourceGroup: EmployeesListByResourceGroup + employeesListBySubscription: EmployeesListBySubscription + employeesMove: EmployeesMove +} + +export function createRouter(implementation: Implementation): Router { + const router = Router() + + const operationsListQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const operationsListResponseBodyValidator = responseValidationFactory( + [["200", s_OperationListResult]], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // operationsList + router.get( + `/providers/Microsoft.ContosoProviderHub/operations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + operationsListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .operationsList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(operationsListResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const employeesGetParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, + resourceGroupName: z + .string() + .min(1) + .max(90) + .regex(new RegExp("^[-\\w\\._\\(\\)]+$")), + employeeName: z.string().regex(new RegExp("^[a-zA-Z0-9-]{3,24}$")), + }) + + const employeesGetQuerySchema = z.object({ "api-version": z.string().min(1) }) + + const employeesGetResponseBodyValidator = responseValidationFactory( + [["200", s_Employee]], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // employeesGet + router.get( + `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContosoProviderHub/employees/:employeeName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + employeesGetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + employeesGetQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .employeesGet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(employeesGetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const employeesCreateOrUpdateParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, + resourceGroupName: z + .string() + .min(1) + .max(90) + .regex(new RegExp("^[-\\w\\._\\(\\)]+$")), + employeeName: z.string().regex(new RegExp("^[a-zA-Z0-9-]{3,24}$")), + }) + + const employeesCreateOrUpdateQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const employeesCreateOrUpdateRequestBodySchema = s_Employee + + const employeesCreateOrUpdateResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_Employee], + ["201", s_Employee], + ], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // employeesCreateOrUpdate + router.put( + `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContosoProviderHub/employees/:employeeName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + employeesCreateOrUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + employeesCreateOrUpdateQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + employeesCreateOrUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with201() { + return new ExpressRuntimeResponse(201) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .employeesCreateOrUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(employeesCreateOrUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const employeesUpdateParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, + resourceGroupName: z + .string() + .min(1) + .max(90) + .regex(new RegExp("^[-\\w\\._\\(\\)]+$")), + employeeName: z.string().regex(new RegExp("^[a-zA-Z0-9-]{3,24}$")), + }) + + const employeesUpdateQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const employeesUpdateRequestBodySchema = s_EmployeeUpdate + + const employeesUpdateResponseBodyValidator = responseValidationFactory( + [["200", s_Employee]], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // employeesUpdate + router.patch( + `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContosoProviderHub/employees/:employeeName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + employeesUpdateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + employeesUpdateQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + employeesUpdateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .employeesUpdate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(employeesUpdateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const employeesDeleteParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, + resourceGroupName: z + .string() + .min(1) + .max(90) + .regex(new RegExp("^[-\\w\\._\\(\\)]+$")), + employeeName: z.string().regex(new RegExp("^[a-zA-Z0-9-]{3,24}$")), + }) + + const employeesDeleteQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const employeesDeleteResponseBodyValidator = responseValidationFactory( + [ + ["202", z.undefined()], + ["204", z.undefined()], + ], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // employeesDelete + router.delete( + `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContosoProviderHub/employees/:employeeName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + employeesDeleteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + employeesDeleteQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .employeesDelete(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(employeesDeleteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const employeesCheckExistenceParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, + resourceGroupName: z + .string() + .min(1) + .max(90) + .regex(new RegExp("^[-\\w\\._\\(\\)]+$")), + employeeName: z.string().regex(new RegExp("^[a-zA-Z0-9-]{3,24}$")), + }) + + const employeesCheckExistenceQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const employeesCheckExistenceResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["404", z.undefined()], + ], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // employeesCheckExistence + router.head( + `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContosoProviderHub/employees/:employeeName`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + employeesCheckExistenceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + employeesCheckExistenceQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .employeesCheckExistence(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(employeesCheckExistenceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const employeesListByResourceGroupParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, + resourceGroupName: z + .string() + .min(1) + .max(90) + .regex(new RegExp("^[-\\w\\._\\(\\)]+$")), + }) + + const employeesListByResourceGroupQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const employeesListByResourceGroupResponseBodyValidator = + responseValidationFactory( + [["200", s_EmployeeListResult]], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // employeesListByResourceGroup + router.get( + `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContosoProviderHub/employees`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + employeesListByResourceGroupParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + employeesListByResourceGroupQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .employeesListByResourceGroup(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + employeesListByResourceGroupResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const employeesListBySubscriptionParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, + }) + + const employeesListBySubscriptionQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const employeesListBySubscriptionResponseBodyValidator = + responseValidationFactory( + [["200", s_EmployeeListResult]], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // employeesListBySubscription + router.get( + `/subscriptions/:subscriptionId/providers/Microsoft.ContosoProviderHub/employees`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + employeesListBySubscriptionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + employeesListBySubscriptionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .employeesListBySubscription(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + employeesListBySubscriptionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const employeesMoveParamSchema = z.object({ + subscriptionId: s_Azure_Core_uuid, + resourceGroupName: z + .string() + .min(1) + .max(90) + .regex(new RegExp("^[-\\w\\._\\(\\)]+$")), + employeeName: z.string().regex(new RegExp("^[a-zA-Z0-9-]{3,24}$")), + }) + + const employeesMoveQuerySchema = z.object({ + "api-version": z.string().min(1), + }) + + const employeesMoveRequestBodySchema = s_MoveRequest + + const employeesMoveResponseBodyValidator = responseValidationFactory( + [["200", s_MoveResponse]], + s_Azure_ResourceManager_CommonTypes_ErrorResponse, + ) + + // employeesMove + router.post( + `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContosoProviderHub/employees/:employeeName/move`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + employeesMoveParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + employeesMoveQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + employeesMoveRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse( + status, + ) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .employeesMove(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(employeesMoveResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export async function bootstrap(config: ServerConfig) { + // ContosoProviderHubClient + return startServer(config) +} diff --git a/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/models.ts b/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/models.ts new file mode 100644 index 000000000..49df09397 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/models.ts @@ -0,0 +1,196 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type EmptyObject = { [key: string]: never } + +export type t_Azure_Core_armResourceType = string + +export type t_Azure_Core_uuid = string + +export type t_Azure_ResourceManager_CommonTypes_ActionType = "Internal" | string + +export type t_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo = { + readonly info?: EmptyObject | undefined + readonly type?: string | undefined +} + +export type t_Azure_ResourceManager_CommonTypes_ErrorDetail = { + readonly additionalInfo?: + | t_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo[] + | undefined + readonly code?: string | undefined + readonly details?: + | t_Azure_ResourceManager_CommonTypes_ErrorDetail[] + | undefined + readonly message?: string | undefined + readonly target?: string | undefined +} + +export type t_Azure_ResourceManager_CommonTypes_ErrorResponse = { + error?: t_Azure_ResourceManager_CommonTypes_ErrorDetail | undefined +} + +export type t_Azure_ResourceManager_CommonTypes_Operation = { + readonly actionType?: + | t_Azure_ResourceManager_CommonTypes_ActionType + | undefined + display?: t_Azure_ResourceManager_CommonTypes_OperationDisplay | undefined + readonly isDataAction?: boolean | undefined + readonly name?: string | undefined + readonly origin?: t_Azure_ResourceManager_CommonTypes_Origin | undefined +} + +export type t_Azure_ResourceManager_CommonTypes_OperationDisplay = { + readonly description?: string | undefined + readonly operation?: string | undefined + readonly provider?: string | undefined + readonly resource?: string | undefined +} + +export type t_Azure_ResourceManager_CommonTypes_Origin = + | "user" + | "system" + | "user,system" + | string + +export type t_Azure_ResourceManager_CommonTypes_Resource = { + readonly id?: string | undefined + readonly name?: string | undefined + readonly systemData?: + | t_Azure_ResourceManager_CommonTypes_SystemData + | undefined + readonly type?: t_Azure_Core_armResourceType | undefined +} + +export type t_Azure_ResourceManager_CommonTypes_SystemData = { + createdAt?: string | undefined + createdBy?: string | undefined + createdByType?: t_Azure_ResourceManager_CommonTypes_createdByType | undefined + lastModifiedAt?: string | undefined + lastModifiedBy?: string | undefined + lastModifiedByType?: + | t_Azure_ResourceManager_CommonTypes_createdByType + | undefined +} + +export type t_Azure_ResourceManager_CommonTypes_TrackedResource = + t_Azure_ResourceManager_CommonTypes_Resource + +export type t_Azure_ResourceManager_CommonTypes_TrackedResourceUpdate = + t_Azure_ResourceManager_CommonTypes_Resource + +export type t_Azure_ResourceManager_CommonTypes_createdByType = + | "User" + | "Application" + | "ManagedIdentity" + | "Key" + | string + +export type t_Employee = t_Azure_ResourceManager_CommonTypes_TrackedResource + +export type t_EmployeeListResult = { + nextLink?: string | undefined + value: t_Employee[] +} + +export type t_MoveResponse = { + movingStatus: string +} + +export type t_OperationListResult = { + nextLink?: string | undefined + value: t_Azure_ResourceManager_CommonTypes_Operation[] +} + +export type t_EmployeesCheckExistenceParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesCheckExistenceQuerySchema = { + "api-version": string +} + +export type t_EmployeesCreateOrUpdateParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesCreateOrUpdateQuerySchema = { + "api-version": string +} + +export type t_EmployeesCreateOrUpdateRequestBodySchema = + t_Azure_ResourceManager_CommonTypes_TrackedResource + +export type t_EmployeesDeleteParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesDeleteQuerySchema = { + "api-version": string +} + +export type t_EmployeesGetParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesGetQuerySchema = { + "api-version": string +} + +export type t_EmployeesListByResourceGroupParamSchema = { + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesListByResourceGroupQuerySchema = { + "api-version": string +} + +export type t_EmployeesListBySubscriptionParamSchema = { + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesListBySubscriptionQuerySchema = { + "api-version": string +} + +export type t_EmployeesMoveParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesMoveQuerySchema = { + "api-version": string +} + +export type t_EmployeesMoveRequestBodySchema = { + from: string + to: string +} + +export type t_EmployeesUpdateParamSchema = { + employeeName: string + resourceGroupName: string + subscriptionId: t_Azure_Core_uuid +} + +export type t_EmployeesUpdateQuerySchema = { + "api-version": string +} + +export type t_EmployeesUpdateRequestBodySchema = + t_Azure_ResourceManager_CommonTypes_TrackedResourceUpdate + +export type t_OperationsListQuerySchema = { + "api-version": string +} diff --git a/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/schemas.ts b/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/schemas.ts new file mode 100644 index 000000000..6d3815977 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/azure-resource-manager.tsp/schemas.ts @@ -0,0 +1,124 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_Azure_ResourceManager_CommonTypes_ErrorDetail, + t_Azure_ResourceManager_CommonTypes_ErrorResponse, +} from "./models" +import { z } from "zod" + +export const PermissiveBoolean = z.preprocess((value) => { + if (typeof value === "string" && (value === "true" || value === "false")) { + return value === "true" + } else if (typeof value === "number" && (value === 1 || value === 0)) { + return value === 1 + } + return value +}, z.boolean()) + +export const s_Azure_Core_armResourceType = z.string() + +export const s_Azure_Core_uuid = z.string() + +export const s_Azure_ResourceManager_CommonTypes_ActionType = z.union([ + z.enum(["Internal"]), + z.string(), +]) + +export const s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo = z.object( + { type: z.string().optional(), info: z.object({}).optional() }, +) + +export const s_Azure_ResourceManager_CommonTypes_OperationDisplay = z.object({ + provider: z.string().optional(), + resource: z.string().optional(), + operation: z.string().optional(), + description: z.string().optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_Origin = z.union([ + z.enum(["user", "system", "user,system"]), + z.string(), +]) + +export const s_Azure_ResourceManager_CommonTypes_createdByType = z.union([ + z.enum(["User", "Application", "ManagedIdentity", "Key"]), + z.string(), +]) + +export const s_MoveRequest = z.object({ from: z.string(), to: z.string() }) + +export const s_MoveResponse = z.object({ movingStatus: z.string() }) + +export const s_Azure_ResourceManager_CommonTypes_Operation = z.object({ + name: z.string().optional(), + isDataAction: PermissiveBoolean.optional(), + display: s_Azure_ResourceManager_CommonTypes_OperationDisplay.optional(), + origin: s_Azure_ResourceManager_CommonTypes_Origin.optional(), + actionType: s_Azure_ResourceManager_CommonTypes_ActionType.optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_SystemData = z.object({ + createdBy: z.string().optional(), + createdByType: s_Azure_ResourceManager_CommonTypes_createdByType.optional(), + createdAt: z.string().datetime({ offset: true }).optional(), + lastModifiedBy: z.string().optional(), + lastModifiedByType: + s_Azure_ResourceManager_CommonTypes_createdByType.optional(), + lastModifiedAt: z.string().datetime({ offset: true }).optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_Resource = z.object({ + id: z.string().optional(), + name: z.string().optional(), + type: s_Azure_Core_armResourceType.optional(), + systemData: s_Azure_ResourceManager_CommonTypes_SystemData.optional(), +}) + +export const s_OperationListResult = z.object({ + value: z.array(s_Azure_ResourceManager_CommonTypes_Operation), + nextLink: z.string().optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_TrackedResource = + s_Azure_ResourceManager_CommonTypes_Resource + +export const s_Azure_ResourceManager_CommonTypes_TrackedResourceUpdate = + s_Azure_ResourceManager_CommonTypes_Resource + +export const s_Employee = s_Azure_ResourceManager_CommonTypes_TrackedResource + +export const s_EmployeeUpdate = + s_Azure_ResourceManager_CommonTypes_TrackedResourceUpdate + +export const s_EmployeeListResult = z.object({ + value: z.array(s_Employee), + nextLink: z.string().optional(), +}) + +export const s_Azure_ResourceManager_CommonTypes_ErrorResponse: z.ZodType< + t_Azure_ResourceManager_CommonTypes_ErrorResponse, + z.ZodTypeDef, + unknown +> = z.object({ + error: z.lazy(() => + s_Azure_ResourceManager_CommonTypes_ErrorDetail.optional(), + ), +}) + +export const s_Azure_ResourceManager_CommonTypes_ErrorDetail: z.ZodType< + t_Azure_ResourceManager_CommonTypes_ErrorDetail, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.string().optional(), + message: z.string().optional(), + target: z.string().optional(), + details: z + .array(z.lazy(() => s_Azure_ResourceManager_CommonTypes_ErrorDetail)) + .optional(), + additionalInfo: z + .array(s_Azure_ResourceManager_CommonTypes_ErrorAdditionalInfo) + .optional(), +}) diff --git a/integration-tests/typescript-express/src/generated/okta.idp.yaml/generated.ts b/integration-tests/typescript-express/src/generated/okta.idp.yaml/generated.ts new file mode 100644 index 000000000..87761eb1e --- /dev/null +++ b/integration-tests/typescript-express/src/generated/okta.idp.yaml/generated.ts @@ -0,0 +1,3320 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_AppAuthenticatorEnrollment, + t_Authenticator, + t_AuthenticatorEnrollment, + t_CreateAppAuthenticatorEnrollmentRequestBodySchema, + t_CreateEmailRequestBodySchema, + t_CreatePasswordRequestBodySchema, + t_CreatePhoneRequestBodySchema, + t_DeleteAppAuthenticatorEnrollmentParamSchema, + t_DeleteEmailParamSchema, + t_DeletePhoneParamSchema, + t_Email, + t_Error, + t_GetAuthenticatorParamSchema, + t_GetAuthenticatorQuerySchema, + t_GetEmailParamSchema, + t_GetEnrollmentParamSchema, + t_GetPhoneParamSchema, + t_ListAppAuthenticatorPendingPushNotificationChallengesParamSchema, + t_ListAuthenticatorsQuerySchema, + t_ListEnrollmentsParamSchema, + t_OktaApplication, + t_Organization, + t_PasswordResponse, + t_Phone, + t_PollChallengeForEmailMagicLinkParamSchema, + t_Profile, + t_PushNotificationChallenge, + t_ReplacePasswordRequestBodySchema, + t_ReplaceProfileRequestBodySchema, + t_Schema, + t_SendEmailChallengeParamSchema, + t_SendEmailChallengeRequestBodySchema, + t_SendPhoneChallengeParamSchema, + t_SendPhoneChallengeRequestBodySchema, + t_UpdateAppAuthenticatorEnrollmentParamSchema, + t_UpdateAppAuthenticatorEnrollmentRequestBodySchema, + t_UpdateEnrollmentParamSchema, + t_UpdateEnrollmentRequestBodySchema, + t_VerifyAppAuthenticatorPushNotificationChallengeParamSchema, + t_VerifyAppAuthenticatorPushNotificationChallengeRequestBodySchema, + t_VerifyEmailOtpParamSchema, + t_VerifyEmailOtpRequestBodySchema, + t_VerifyPhoneChallengeParamSchema, + t_VerifyPhoneChallengeRequestBodySchema, +} from "./models" +import { + PermissiveBoolean, + s_AppAuthenticatorEnrollment, + s_AppAuthenticatorEnrollmentRequest, + s_Authenticator, + s_AuthenticatorEnrollment, + s_Email, + s_Error, + s_OktaApplication, + s_Organization, + s_PasswordResponse, + s_Phone, + s_Profile, + s_PushNotificationChallenge, + s_PushNotificationVerification, + s_Schema, + s_UpdateAppAuthenticatorEnrollmentRequest, + s_UpdateAuthenticatorEnrollmentRequest, +} from "./schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + ServerConfig, + SkipResponse, + StatusCode, + startServer, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type CreateAppAuthenticatorEnrollmentResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CreateAppAuthenticatorEnrollment = ( + params: Params< + void, + void, + t_CreateAppAuthenticatorEnrollmentRequestBodySchema, + void + >, + respond: CreateAppAuthenticatorEnrollmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type VerifyAppAuthenticatorPushNotificationChallengeResponder = { + with200(): ExpressRuntimeResponse + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type VerifyAppAuthenticatorPushNotificationChallenge = ( + params: Params< + t_VerifyAppAuthenticatorPushNotificationChallengeParamSchema, + void, + t_VerifyAppAuthenticatorPushNotificationChallengeRequestBodySchema, + void + >, + respond: VerifyAppAuthenticatorPushNotificationChallengeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UpdateAppAuthenticatorEnrollmentResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UpdateAppAuthenticatorEnrollment = ( + params: Params< + t_UpdateAppAuthenticatorEnrollmentParamSchema, + void, + t_UpdateAppAuthenticatorEnrollmentRequestBodySchema, + void + >, + respond: UpdateAppAuthenticatorEnrollmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteAppAuthenticatorEnrollmentResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteAppAuthenticatorEnrollment = ( + params: Params< + t_DeleteAppAuthenticatorEnrollmentParamSchema, + void, + void, + void + >, + respond: DeleteAppAuthenticatorEnrollmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ListAppAuthenticatorPendingPushNotificationChallengesResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ListAppAuthenticatorPendingPushNotificationChallenges = ( + params: Params< + t_ListAppAuthenticatorPendingPushNotificationChallengesParamSchema, + void, + void, + void + >, + respond: ListAppAuthenticatorPendingPushNotificationChallengesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ListAuthenticatorsResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ListAuthenticators = ( + params: Params, + respond: ListAuthenticatorsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAuthenticatorResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAuthenticator = ( + params: Params< + t_GetAuthenticatorParamSchema, + t_GetAuthenticatorQuerySchema, + void, + void + >, + respond: GetAuthenticatorResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ListEnrollmentsResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ListEnrollments = ( + params: Params, + respond: ListEnrollmentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetEnrollmentResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEnrollment = ( + params: Params, + respond: GetEnrollmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UpdateEnrollmentResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UpdateEnrollment = ( + params: Params< + t_UpdateEnrollmentParamSchema, + void, + t_UpdateEnrollmentRequestBodySchema, + void + >, + respond: UpdateEnrollmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ListEmailsResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ListEmails = ( + params: Params, + respond: ListEmailsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CreateEmailResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CreateEmail = ( + params: Params, + respond: CreateEmailResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetEmailResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEmail = ( + params: Params, + respond: GetEmailResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteEmailResponder = { + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteEmail = ( + params: Params, + respond: DeleteEmailResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SendEmailChallengeResponder = { + with201(): ExpressRuntimeResponse<{ + _links: { + poll: { + hints: { + allow: "GET"[] + } + href: string + } + verify: { + hints: { + allow: "POST"[] + } + href: string + } + } + expiresAt: string + id: string + profile: { + email: string + } + status: "VERIFIED" | "UNVERIFIED" + }> + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SendEmailChallenge = ( + params: Params< + t_SendEmailChallengeParamSchema, + void, + t_SendEmailChallengeRequestBodySchema, + void + >, + respond: SendEmailChallengeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PollChallengeForEmailMagicLinkResponder = { + with200(): ExpressRuntimeResponse<{ + _links: { + poll: { + hints: { + allow: ("DELETE" | "GET" | "POST" | "PUT")[] + } + href: string + } + verify: { + hints: { + allow: ("DELETE" | "GET" | "POST" | "PUT")[] + } + href: string + } + } + expiresAt: string + id: string + profile: { + email: string + } + status: "VERIFIED" | "UNVERIFIED" + }> + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PollChallengeForEmailMagicLink = ( + params: Params, + respond: PollChallengeForEmailMagicLinkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type VerifyEmailOtpResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type VerifyEmailOtp = ( + params: Params< + t_VerifyEmailOtpParamSchema, + void, + t_VerifyEmailOtpRequestBodySchema, + void + >, + respond: VerifyEmailOtpResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ListOktaApplicationsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ListOktaApplications = ( + params: Params, + respond: ListOktaApplicationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetOrganizationResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetOrganization = ( + params: Params, + respond: GetOrganizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPasswordResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPassword = ( + params: Params, + respond: GetPasswordResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CreatePasswordResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CreatePassword = ( + params: Params, + respond: CreatePasswordResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReplacePasswordResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReplacePassword = ( + params: Params, + respond: ReplacePasswordResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeletePasswordResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeletePassword = ( + params: Params, + respond: DeletePasswordResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ListPhonesResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ListPhones = ( + params: Params, + respond: ListPhonesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CreatePhoneResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CreatePhone = ( + params: Params, + respond: CreatePhoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPhoneResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPhone = ( + params: Params, + respond: GetPhoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeletePhoneResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeletePhone = ( + params: Params, + respond: DeletePhoneResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type SendPhoneChallengeResponder = { + with200(): ExpressRuntimeResponse<{ + _links?: + | { + verify?: + | { + hints: { + allow: "GET"[] + } + href: string + } + | undefined + } + | undefined + }> + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with500(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type SendPhoneChallenge = ( + params: Params< + t_SendPhoneChallengeParamSchema, + void, + t_SendPhoneChallengeRequestBodySchema, + void + >, + respond: SendPhoneChallengeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type VerifyPhoneChallengeResponder = { + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with409(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type VerifyPhoneChallenge = ( + params: Params< + t_VerifyPhoneChallengeParamSchema, + void, + t_VerifyPhoneChallengeRequestBodySchema, + void + >, + respond: VerifyPhoneChallengeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetProfileResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetProfile = ( + params: Params, + respond: GetProfileResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReplaceProfileResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReplaceProfile = ( + params: Params, + respond: ReplaceProfileResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetProfileSchemaResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetProfileSchema = ( + params: Params, + respond: GetProfileSchemaResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteSessionsResponder = { + with204(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteSessions = ( + params: Params, + respond: DeleteSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type Implementation = { + createAppAuthenticatorEnrollment: CreateAppAuthenticatorEnrollment + verifyAppAuthenticatorPushNotificationChallenge: VerifyAppAuthenticatorPushNotificationChallenge + updateAppAuthenticatorEnrollment: UpdateAppAuthenticatorEnrollment + deleteAppAuthenticatorEnrollment: DeleteAppAuthenticatorEnrollment + listAppAuthenticatorPendingPushNotificationChallenges: ListAppAuthenticatorPendingPushNotificationChallenges + listAuthenticators: ListAuthenticators + getAuthenticator: GetAuthenticator + listEnrollments: ListEnrollments + getEnrollment: GetEnrollment + updateEnrollment: UpdateEnrollment + listEmails: ListEmails + createEmail: CreateEmail + getEmail: GetEmail + deleteEmail: DeleteEmail + sendEmailChallenge: SendEmailChallenge + pollChallengeForEmailMagicLink: PollChallengeForEmailMagicLink + verifyEmailOtp: VerifyEmailOtp + listOktaApplications: ListOktaApplications + getOrganization: GetOrganization + getPassword: GetPassword + createPassword: CreatePassword + replacePassword: ReplacePassword + deletePassword: DeletePassword + listPhones: ListPhones + createPhone: CreatePhone + getPhone: GetPhone + deletePhone: DeletePhone + sendPhoneChallenge: SendPhoneChallenge + verifyPhoneChallenge: VerifyPhoneChallenge + getProfile: GetProfile + replaceProfile: ReplaceProfile + getProfileSchema: GetProfileSchema + deleteSessions: DeleteSessions +} + +export function createRouter(implementation: Implementation): Router { + const router = Router() + + const createAppAuthenticatorEnrollmentRequestBodySchema = + s_AppAuthenticatorEnrollmentRequest + + const createAppAuthenticatorEnrollmentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_AppAuthenticatorEnrollment], + ["400", s_Error], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // createAppAuthenticatorEnrollment + router.post( + `/idp/myaccount/app-authenticators`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + createAppAuthenticatorEnrollmentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .createAppAuthenticatorEnrollment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + createAppAuthenticatorEnrollmentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const verifyAppAuthenticatorPushNotificationChallengeParamSchema = z.object({ + challengeId: z.string(), + }) + + const verifyAppAuthenticatorPushNotificationChallengeRequestBodySchema = + s_PushNotificationVerification + + const verifyAppAuthenticatorPushNotificationChallengeResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.undefined()], + ["204", z.undefined()], + ["400", z.undefined()], + ], + undefined, + ) + + // verifyAppAuthenticatorPushNotificationChallenge + router.post( + `/idp/myaccount/app-authenticators/challenge/:challengeId/verify`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + verifyAppAuthenticatorPushNotificationChallengeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + verifyAppAuthenticatorPushNotificationChallengeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .verifyAppAuthenticatorPushNotificationChallenge( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + verifyAppAuthenticatorPushNotificationChallengeResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const updateAppAuthenticatorEnrollmentParamSchema = z.object({ + enrollmentId: z.string(), + }) + + const updateAppAuthenticatorEnrollmentRequestBodySchema = + s_UpdateAppAuthenticatorEnrollmentRequest + + const updateAppAuthenticatorEnrollmentResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_AppAuthenticatorEnrollment], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // updateAppAuthenticatorEnrollment + router.patch( + `/idp/myaccount/app-authenticators/:enrollmentId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + updateAppAuthenticatorEnrollmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + updateAppAuthenticatorEnrollmentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .updateAppAuthenticatorEnrollment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + updateAppAuthenticatorEnrollmentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteAppAuthenticatorEnrollmentParamSchema = z.object({ + enrollmentId: z.string(), + }) + + const deleteAppAuthenticatorEnrollmentResponseBodyValidator = + responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // deleteAppAuthenticatorEnrollment + router.delete( + `/idp/myaccount/app-authenticators/:enrollmentId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteAppAuthenticatorEnrollmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteAppAuthenticatorEnrollment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteAppAuthenticatorEnrollmentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const listAppAuthenticatorPendingPushNotificationChallengesParamSchema = + z.object({ enrollmentId: z.string() }) + + const listAppAuthenticatorPendingPushNotificationChallengesResponseBodyValidator = + responseValidationFactory( + [ + ["200", z.array(s_PushNotificationChallenge)], + ["401", s_Error], + ], + undefined, + ) + + // listAppAuthenticatorPendingPushNotificationChallenges + router.get( + `/idp/myaccount/app-authenticators/:enrollmentId/push/notifications`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + listAppAuthenticatorPendingPushNotificationChallengesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .listAppAuthenticatorPendingPushNotificationChallenges( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + listAppAuthenticatorPendingPushNotificationChallengesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const listAuthenticatorsQuerySchema = z.object({ + expand: z.string().optional(), + }) + + const listAuthenticatorsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_Authenticator)], + ["403", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // listAuthenticators + router.get( + `/idp/myaccount/authenticators`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + listAuthenticatorsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .listAuthenticators(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(listAuthenticatorsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAuthenticatorParamSchema = z.object({ authenticatorId: z.string() }) + + const getAuthenticatorQuerySchema = z.object({ + expand: z.string().optional(), + }) + + const getAuthenticatorResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Authenticator], + ["403", s_Error], + ["404", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // getAuthenticator + router.get( + `/idp/myaccount/authenticators/:authenticatorId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAuthenticatorParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAuthenticatorQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAuthenticator(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getAuthenticatorResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const listEnrollmentsParamSchema = z.object({ authenticatorId: z.string() }) + + const listEnrollmentsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_AuthenticatorEnrollment)], + ["403", s_Error], + ["404", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // listEnrollments + router.get( + `/idp/myaccount/authenticators/:authenticatorId/enrollments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + listEnrollmentsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .listEnrollments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(listEnrollmentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getEnrollmentParamSchema = z.object({ + authenticatorId: z.string(), + enrollmentId: z.string(), + }) + + const getEnrollmentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_AuthenticatorEnrollment], + ["403", s_Error], + ["404", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // getEnrollment + router.get( + `/idp/myaccount/authenticators/:authenticatorId/enrollments/:enrollmentId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getEnrollmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEnrollment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getEnrollmentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const updateEnrollmentParamSchema = z.object({ + authenticatorId: z.string(), + enrollmentId: z.string(), + }) + + const updateEnrollmentRequestBodySchema = + s_UpdateAuthenticatorEnrollmentRequest + + const updateEnrollmentResponseBodyValidator = responseValidationFactory( + [ + ["200", s_AuthenticatorEnrollment], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // updateEnrollment + router.patch( + `/idp/myaccount/authenticators/:authenticatorId/enrollments/:enrollmentId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + updateEnrollmentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + updateEnrollmentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .updateEnrollment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(updateEnrollmentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const listEmailsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_Email)], + ["401", s_Error], + ], + undefined, + ) + + // listEmails + router.get( + `/idp/myaccount/emails`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .listEmails(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(listEmailsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const createEmailRequestBodySchema = z.object({ + profile: z.object({ email: z.string().email() }), + sendEmail: PermissiveBoolean.optional().default(true), + state: z.string().optional(), + role: z.enum(["PRIMARY", "SECONDARY"]).optional(), + }) + + const createEmailResponseBodyValidator = responseValidationFactory( + [ + ["201", s_Email], + ["400", s_Error], + ["401", s_Error], + ["403", s_Error], + ["409", s_Error], + ], + undefined, + ) + + // createEmail + router.post( + `/idp/myaccount/emails`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + createEmailRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .createEmail(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(createEmailResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getEmailParamSchema = z.object({ id: z.string() }) + + const getEmailResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Email], + ["401", s_Error], + ], + undefined, + ) + + // getEmail + router.get( + `/idp/myaccount/emails/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getEmailParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEmail(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getEmailResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteEmailParamSchema = z.object({ id: z.string() }) + + const deleteEmailResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["400", s_Error], + ["401", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // deleteEmail + router.delete( + `/idp/myaccount/emails/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteEmailParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteEmail(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteEmailResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const sendEmailChallengeParamSchema = z.object({ id: z.string() }) + + const sendEmailChallengeRequestBodySchema = z.object({ state: z.string() }) + + const sendEmailChallengeResponseBodyValidator = responseValidationFactory( + [ + [ + "201", + z.object({ + id: z.string().min(1), + status: z.enum(["VERIFIED", "UNVERIFIED"]), + expiresAt: z.string().min(1), + profile: z.object({ email: z.string().min(1) }), + _links: z.object({ + verify: z.object({ + href: z.string().min(1), + hints: z.object({ allow: z.array(z.enum(["POST"])) }), + }), + poll: z.object({ + href: z.string().min(1), + hints: z.object({ allow: z.array(z.enum(["GET"])) }), + }), + }), + }), + ], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // sendEmailChallenge + router.post( + `/idp/myaccount/emails/:id/challenge`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + sendEmailChallengeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + sendEmailChallengeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse<{ + _links: { + poll: { + hints: { + allow: "GET"[] + } + href: string + } + verify: { + hints: { + allow: "POST"[] + } + href: string + } + } + expiresAt: string + id: string + profile: { + email: string + } + status: "VERIFIED" | "UNVERIFIED" + }>(201) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .sendEmailChallenge(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(sendEmailChallengeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const pollChallengeForEmailMagicLinkParamSchema = z.object({ + id: z.string(), + challengeId: z.string(), + }) + + const pollChallengeForEmailMagicLinkResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + id: z.string().min(1), + status: z.enum(["VERIFIED", "UNVERIFIED"]), + expiresAt: z.string().min(1), + profile: z.object({ email: z.string().min(1) }), + _links: z.object({ + verify: z.object({ + href: z.string().min(1), + hints: z.object({ + allow: z.array(z.enum(["DELETE", "GET", "POST", "PUT"])), + }), + }), + poll: z.object({ + href: z.string().min(1), + hints: z.object({ + allow: z.array(z.enum(["DELETE", "GET", "POST", "PUT"])), + }), + }), + }), + }), + ], + ["401", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // pollChallengeForEmailMagicLink + router.get( + `/idp/myaccount/emails/:id/challenge/:challengeId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + pollChallengeForEmailMagicLinkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + _links: { + poll: { + hints: { + allow: ("DELETE" | "GET" | "POST" | "PUT")[] + } + href: string + } + verify: { + hints: { + allow: ("DELETE" | "GET" | "POST" | "PUT")[] + } + href: string + } + } + expiresAt: string + id: string + profile: { + email: string + } + status: "VERIFIED" | "UNVERIFIED" + }>(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .pollChallengeForEmailMagicLink(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + pollChallengeForEmailMagicLinkResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const verifyEmailOtpParamSchema = z.object({ + id: z.string(), + challengeId: z.string(), + }) + + const verifyEmailOtpRequestBodySchema = z.object({ + verificationCode: z.string(), + }) + + const verifyEmailOtpResponseBodyValidator = responseValidationFactory( + [ + ["200", z.undefined()], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // verifyEmailOtp + router.post( + `/idp/myaccount/emails/:id/challenge/:challengeId/verify`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + verifyEmailOtpParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + verifyEmailOtpRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .verifyEmailOtp(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(verifyEmailOtpResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const listOktaApplicationsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_OktaApplication)], + ["400", s_Error], + ], + undefined, + ) + + // listOktaApplications + router.get( + `/idp/myaccount/okta-applications`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .listOktaApplications(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(listOktaApplicationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getOrganizationResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Organization], + ["401", s_Error], + ], + undefined, + ) + + // getOrganization + router.get( + `/idp/myaccount/organization`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getOrganization(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getOrganizationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPasswordResponseBodyValidator = responseValidationFactory( + [ + ["200", s_PasswordResponse], + ["401", s_Error], + ], + undefined, + ) + + // getPassword + router.get( + `/idp/myaccount/password`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPassword(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPasswordResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const createPasswordRequestBodySchema = z.object({ + profile: z.object({ password: z.string() }), + }) + + const createPasswordResponseBodyValidator = responseValidationFactory( + [ + ["201", s_PasswordResponse], + ["400", s_Error], + ["401", s_Error], + ["403", s_Error], + ], + undefined, + ) + + // createPassword + router.post( + `/idp/myaccount/password`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + createPasswordRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .createPassword(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(createPasswordResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const replacePasswordRequestBodySchema = z.object({ + profile: z.object({ password: z.string() }), + }) + + const replacePasswordResponseBodyValidator = responseValidationFactory( + [ + ["201", s_PasswordResponse], + ["400", s_Error], + ["401", s_Error], + ["403", s_Error], + ], + undefined, + ) + + // replacePassword + router.put( + `/idp/myaccount/password`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + replacePasswordRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .replacePassword(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(replacePasswordResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deletePasswordResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // deletePassword + router.delete( + `/idp/myaccount/password`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deletePassword(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deletePasswordResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const listPhonesResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_Phone)], + ["401", s_Error], + ], + undefined, + ) + + // listPhones + router.get( + `/idp/myaccount/phones`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .listPhones(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(listPhonesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const createPhoneRequestBodySchema = z.object({ + profile: z.object({ phoneNumber: z.string().optional() }), + sendCode: PermissiveBoolean.optional().default(true), + method: z.enum(["SMS", "CALL"]).optional(), + }) + + const createPhoneResponseBodyValidator = responseValidationFactory( + [ + ["201", s_Phone], + ["400", s_Error], + ["401", s_Error], + ["403", s_Error], + ["409", s_Error], + ["500", s_Error], + ], + undefined, + ) + + // createPhone + router.post( + `/idp/myaccount/phones`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + createPhoneRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .createPhone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(createPhoneResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPhoneParamSchema = z.object({ id: z.string() }) + + const getPhoneResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Phone], + ["401", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // getPhone + router.get( + `/idp/myaccount/phones/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPhoneParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPhone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPhoneResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deletePhoneParamSchema = z.object({ id: z.string() }) + + const deletePhoneResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // deletePhone + router.delete( + `/idp/myaccount/phones/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deletePhoneParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deletePhone(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deletePhoneResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const sendPhoneChallengeParamSchema = z.object({ id: z.string() }) + + const sendPhoneChallengeRequestBodySchema = z.object({ + method: z.enum(["SMS", "CALL"]), + retry: PermissiveBoolean.optional().default(false), + }) + + const sendPhoneChallengeResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + _links: z + .object({ + verify: z + .object({ + href: z.string().min(1), + hints: z.object({ allow: z.array(z.enum(["GET"])) }), + }) + .optional(), + }) + .optional(), + }), + ], + ["400", s_Error], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ["500", s_Error], + ], + undefined, + ) + + // sendPhoneChallenge + router.post( + `/idp/myaccount/phones/:id/challenge`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + sendPhoneChallengeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + sendPhoneChallengeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + _links?: + | { + verify?: + | { + hints: { + allow: "GET"[] + } + href: string + } + | undefined + } + | undefined + }>(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with500() { + return new ExpressRuntimeResponse(500) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .sendPhoneChallenge(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(sendPhoneChallengeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const verifyPhoneChallengeParamSchema = z.object({ id: z.string() }) + + const verifyPhoneChallengeRequestBodySchema = z.object({ + verificationCode: z.string(), + }) + + const verifyPhoneChallengeResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["400", s_Error], + ["401", s_Error], + ["403", s_Error], + ["404", s_Error], + ["409", s_Error], + ], + undefined, + ) + + // verifyPhoneChallenge + router.post( + `/idp/myaccount/phones/:id/verify`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + verifyPhoneChallengeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + verifyPhoneChallengeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with409() { + return new ExpressRuntimeResponse(409) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .verifyPhoneChallenge(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(verifyPhoneChallengeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getProfileResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Profile], + ["401", s_Error], + ], + undefined, + ) + + // getProfile + router.get( + `/idp/myaccount/profile`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getProfile(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getProfileResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const replaceProfileRequestBodySchema = z.object({ + profile: z.object({}).optional(), + }) + + const replaceProfileResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Profile], + ["400", s_Error], + ["401", s_Error], + ], + undefined, + ) + + // replaceProfile + router.put( + `/idp/myaccount/profile`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + replaceProfileRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .replaceProfile(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(replaceProfileResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getProfileSchemaResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Schema], + ["401", s_Error], + ], + undefined, + ) + + // getProfileSchema + router.get( + `/idp/myaccount/profile/schema`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getProfileSchema(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getProfileSchemaResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteSessionsResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["401", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // deleteSessions + router.delete( + `/idp/myaccount/sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteSessionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export async function bootstrap(config: ServerConfig) { + // MyAccount Management + return startServer(config) +} diff --git a/integration-tests/typescript-express/src/generated/okta.idp.yaml/models.ts b/integration-tests/typescript-express/src/generated/okta.idp.yaml/models.ts new file mode 100644 index 000000000..97f2de919 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/okta.idp.yaml/models.ts @@ -0,0 +1,547 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type EmptyObject = { [key: string]: never } + +export type t_AppAuthenticatorEnrollment = { + readonly authenticatorId?: string | undefined + readonly createdDate?: string | undefined + readonly device?: + | { + clientInstanceId?: string | undefined + createdDate?: string | undefined + id?: string | undefined + lastUpdated?: string | undefined + status?: "ACTIVE" | undefined + } + | undefined + readonly id?: string | undefined + readonly lastUpdated?: string | undefined + readonly links?: + | { + self?: + | { + hints?: + | { + allow?: ("PATCH" | "DELETE")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + } + | undefined + methods?: + | { + push?: + | { + createdDate?: string | undefined + id?: string | undefined + lastUpdated?: string | undefined + links?: + | { + pending?: + | { + hints?: + | { + allow?: "GET"[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + } + | undefined + } + | undefined + } + | undefined + readonly user?: + | { + id?: string | undefined + username?: string | undefined + } + | undefined +} + +export type t_AppAuthenticatorMethodCapabilities = { + transactionTypes?: ("LOGIN" | "CIBA")[] | undefined +} + +export type t_Authenticator = { + readonly _embedded?: + | { + enrollments?: t_AuthenticatorEnrollment[] | undefined + } + | undefined + readonly _links?: + | { + enroll?: t_HrefObject | undefined + enrollments?: t_HrefObject | undefined + self?: t_HrefObject | undefined + } + | undefined + readonly enrollable?: boolean | undefined + readonly id?: string | undefined + key?: t_AuthenticatorKey | undefined + readonly name?: string | undefined +} + +export type t_AuthenticatorEnrollment = { + readonly _links?: + | { + authenticator?: t_HrefObject | undefined + modify?: t_HrefObject | undefined + self?: t_HrefObject | undefined + unenroll?: t_HrefObject | undefined + } + | undefined + readonly canReset?: boolean | undefined + readonly canUnenroll?: boolean | undefined + readonly created?: string | undefined + readonly id?: string | undefined + readonly lastChallenged?: string | undefined + name?: string | undefined + nickname?: string | undefined + readonly profile?: EmptyObject | undefined +} + +export type t_AuthenticatorKey = + | "custom_app" + | "custom_otp" + | "duo" + | "external_idp" + | "google_otp" + | "okta_email" + | "okta_password" + | "okta_verify" + | "onprem_mfa" + | "phone_number" + | "rsa_token" + | "security_question" + | "symantec_vip" + | "webauthn" + | "yubikey_token" + +export type t_Email = { + _links?: + | { + challenge?: + | { + hints?: + | { + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + poll?: + | { + hints?: + | { + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + self?: + | { + hints?: + | { + allow?: ("GET" | "DELETE" | "PUT")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + verify?: + | { + hints?: + | { + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + } + | undefined + readonly id: string + profile: { + email: string + } + roles: ("PRIMARY" | "SECONDARY")[] + readonly status: "VERIFIED" | "UNVERIFIED" +} + +export type t_Error = { + errorCauses?: + | { + readonly errorSummary?: string | undefined + }[] + | undefined + readonly errorCode?: string | undefined + readonly errorId?: string | undefined + readonly errorLink?: string | undefined + readonly errorSummary?: string | undefined +} + +export type t_HrefObject = { + hints?: + | { + allow?: t_HttpMethod[] | undefined + } + | undefined + href: string + name?: string | undefined + type?: string | undefined +} + +export type t_HttpMethod = "DELETE" | "GET" | "POST" | "PUT" + +export type t_KeyEC = { + crv: "P-256" + kid: string + kty: "EC" + "okta:kpr": "HARDWARE" | "SOFTWARE" + x: string + y: string +} + +export type t_KeyObject = t_KeyEC | t_KeyRSA + +export type t_KeyRSA = { + e: string + kid: string + kty: "RSA" + n: string + "okta:kpr": "HARDWARE" | "SOFTWARE" +} + +export type t_OktaApplication = { + readonly displayName?: string | undefined + readonly id?: string | undefined + readonly name?: string | undefined +} + +export type t_Organization = { + _links?: + | { + self?: + | { + hints?: + | { + allow?: "GET"[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + } + | undefined + readonly helpLink?: string | undefined + readonly name?: string | undefined + readonly supportEmail?: string | undefined + readonly url?: string | undefined +} + +export type t_PasswordResponse = { + _links?: + | { + self?: + | { + hints?: + | { + allow?: ("DELETE" | "GET" | "PUT")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + } + | undefined + created?: string | undefined + readonly id?: string | undefined + lastUpdated?: string | undefined + status?: string | undefined +} + +export type t_Phone = { + _links?: + | { + challenge?: + | { + hints?: + | { + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + self?: + | { + hints?: + | { + allow?: ("GET" | "DELETE" | "PUT")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + verify?: + | { + hints?: + | { + allow?: ("DELETE" | "GET" | "POST" | "PUT")[] | undefined + } + | undefined + href?: string | undefined + } + | undefined + } + | undefined + readonly id: string + profile: { + phoneNumber: string + } + readonly status: "VERIFIED" | "UNVERIFIED" +} + +export type t_Profile = { + _links?: + | { + describedBy?: + | { + readonly href?: string | undefined + } + | undefined + self?: + | { + readonly href?: string | undefined + } + | undefined + } + | undefined + readonly createdAt?: string | undefined + readonly modifiedAt?: string | undefined + profile?: EmptyObject | undefined +} + +export type t_PushNotificationChallenge = { + challenge?: string | undefined + payloadVersion?: "IDXv1" | undefined +} + +export type t_Schema = { + _links?: + | { + self?: + | { + readonly href?: string | undefined + } + | undefined + user?: + | { + readonly href?: string | undefined + } + | undefined + } + | undefined + readonly properties?: EmptyObject | undefined +} + +export type t_CreateAppAuthenticatorEnrollmentRequestBodySchema = { + authenticatorId: string + device: { + clientInstanceBundleId: string + clientInstanceDeviceSdkVersion: string + clientInstanceKey: t_KeyObject + clientInstanceVersion: string + deviceAttestation?: + | { + [key: string]: unknown | undefined + } + | undefined + displayName: string + manufacturer?: string | undefined + model?: string | undefined + osVersion: string + platform: "ANDROID" | "IOS" + secureHardwarePresent?: boolean | undefined + udid?: string | undefined + } + methods: { + push: { + apsEnvironment?: ("PRODUCTION" | "DEVELOPMENT") | undefined + keys: { + capabilities?: t_AppAuthenticatorMethodCapabilities | undefined + proofOfPossession: t_KeyObject + userVerification?: t_KeyObject | undefined + } + pushToken: string + } + } +} + +export type t_CreateEmailRequestBodySchema = { + profile: { + email: string + } + role?: ("PRIMARY" | "SECONDARY") | undefined + sendEmail?: boolean | undefined + state?: string | undefined +} + +export type t_CreatePasswordRequestBodySchema = { + profile: { + password: string + } +} + +export type t_CreatePhoneRequestBodySchema = { + method?: ("SMS" | "CALL") | undefined + profile: { + phoneNumber?: string | undefined + } + sendCode?: boolean | undefined +} + +export type t_DeleteAppAuthenticatorEnrollmentParamSchema = { + enrollmentId: string +} + +export type t_DeleteEmailParamSchema = { + id: string +} + +export type t_DeletePhoneParamSchema = { + id: string +} + +export type t_GetAuthenticatorParamSchema = { + authenticatorId: string +} + +export type t_GetAuthenticatorQuerySchema = { + expand?: string | undefined +} + +export type t_GetEmailParamSchema = { + id: string +} + +export type t_GetEnrollmentParamSchema = { + authenticatorId: string + enrollmentId: string +} + +export type t_GetPhoneParamSchema = { + id: string +} + +export type t_ListAppAuthenticatorPendingPushNotificationChallengesParamSchema = + { + enrollmentId: string + } + +export type t_ListAuthenticatorsQuerySchema = { + expand?: string | undefined +} + +export type t_ListEnrollmentsParamSchema = { + authenticatorId: string +} + +export type t_PollChallengeForEmailMagicLinkParamSchema = { + challengeId: string + id: string +} + +export type t_ReplacePasswordRequestBodySchema = { + profile: { + password: string + } +} + +export type t_ReplaceProfileRequestBodySchema = { + profile?: EmptyObject | undefined +} + +export type t_SendEmailChallengeParamSchema = { + id: string +} + +export type t_SendEmailChallengeRequestBodySchema = { + state: string +} + +export type t_SendPhoneChallengeParamSchema = { + id: string +} + +export type t_SendPhoneChallengeRequestBodySchema = { + method: "SMS" | "CALL" + retry?: boolean | undefined +} + +export type t_UpdateAppAuthenticatorEnrollmentParamSchema = { + enrollmentId: string +} + +export type t_UpdateAppAuthenticatorEnrollmentRequestBodySchema = { + methods?: + | { + push?: + | { + capabilities?: t_AppAuthenticatorMethodCapabilities | undefined + keys?: + | { + userVerification?: t_KeyObject | undefined + } + | undefined + pushToken?: string | undefined + } + | undefined + } + | undefined +} + +export type t_UpdateEnrollmentParamSchema = { + authenticatorId: string + enrollmentId: string +} + +export type t_UpdateEnrollmentRequestBodySchema = { + nickname?: string | undefined +} + +export type t_VerifyAppAuthenticatorPushNotificationChallengeParamSchema = { + challengeId: string +} + +export type t_VerifyAppAuthenticatorPushNotificationChallengeRequestBodySchema = + { + challengeResponse?: string | undefined + method?: "push" | undefined + } + +export type t_VerifyEmailOtpParamSchema = { + challengeId: string + id: string +} + +export type t_VerifyEmailOtpRequestBodySchema = { + verificationCode: string +} + +export type t_VerifyPhoneChallengeParamSchema = { + id: string +} + +export type t_VerifyPhoneChallengeRequestBodySchema = { + verificationCode: string +} diff --git a/integration-tests/typescript-express/src/generated/okta.idp.yaml/schemas.ts b/integration-tests/typescript-express/src/generated/okta.idp.yaml/schemas.ts new file mode 100644 index 000000000..691367273 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/okta.idp.yaml/schemas.ts @@ -0,0 +1,392 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { z } from "zod" + +export const PermissiveBoolean = z.preprocess((value) => { + if (typeof value === "string" && (value === "true" || value === "false")) { + return value === "true" + } else if (typeof value === "number" && (value === 1 || value === 0)) { + return value === 1 + } + return value +}, z.boolean()) + +export const s_AppAuthenticatorEnrollment = z.object({ + authenticatorId: z.string().optional(), + createdDate: z.string().datetime({ offset: true }).optional(), + device: z + .object({ + id: z.string().optional(), + status: z.enum(["ACTIVE"]).optional(), + createdDate: z.string().datetime({ offset: true }).optional(), + lastUpdated: z.string().datetime({ offset: true }).optional(), + clientInstanceId: z.string().optional(), + }) + .optional(), + id: z.string().optional(), + lastUpdated: z.string().datetime({ offset: true }).optional(), + links: z + .object({ + self: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ allow: z.array(z.enum(["PATCH", "DELETE"])).optional() }) + .optional(), + }) + .optional(), + }) + .optional(), + methods: z + .object({ + push: z + .object({ + id: z.string().optional(), + createdDate: z.string().datetime({ offset: true }).optional(), + lastUpdated: z.string().datetime({ offset: true }).optional(), + links: z + .object({ + pending: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ allow: z.array(z.enum(["GET"])).optional() }) + .optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + user: z + .object({ id: z.string().optional(), username: z.string().optional() }) + .optional(), +}) + +export const s_AppAuthenticatorMethodCapabilities = z.object({ + transactionTypes: z.array(z.enum(["LOGIN", "CIBA"])).optional(), +}) + +export const s_AuthenticatorKey = z.enum([ + "custom_app", + "custom_otp", + "duo", + "external_idp", + "google_otp", + "okta_email", + "okta_password", + "okta_verify", + "onprem_mfa", + "phone_number", + "rsa_token", + "security_question", + "symantec_vip", + "webauthn", + "yubikey_token", +]) + +export const s_Email = z.object({ + id: z.string().min(1), + profile: z.object({ email: z.string().min(1) }), + roles: z.array(z.enum(["PRIMARY", "SECONDARY"])), + status: z.enum(["VERIFIED", "UNVERIFIED"]), + _links: z + .object({ + self: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ + allow: z.array(z.enum(["GET", "DELETE", "PUT"])).optional(), + }) + .optional(), + }) + .optional(), + challenge: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ + allow: z + .array(z.enum(["DELETE", "GET", "POST", "PUT"])) + .optional(), + }) + .optional(), + }) + .optional(), + verify: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ + allow: z + .array(z.enum(["DELETE", "GET", "POST", "PUT"])) + .optional(), + }) + .optional(), + }) + .optional(), + poll: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ + allow: z + .array(z.enum(["DELETE", "GET", "POST", "PUT"])) + .optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), +}) + +export const s_Error = z.object({ + errorCauses: z + .array(z.object({ errorSummary: z.string().optional() })) + .optional(), + errorCode: z.string().optional(), + errorId: z.string().optional(), + errorLink: z.string().optional(), + errorSummary: z.string().optional(), +}) + +export const s_HttpMethod = z.enum(["DELETE", "GET", "POST", "PUT"]) + +export const s_KeyEC = z.object({ + crv: z.enum(["P-256"]), + kid: z.string(), + kty: z.enum(["EC"]), + "okta:kpr": z.enum(["HARDWARE", "SOFTWARE"]), + x: z.string(), + y: z.string(), +}) + +export const s_KeyRSA = z.object({ + e: z.string(), + kid: z.string(), + kty: z.enum(["RSA"]), + n: z.string(), + "okta:kpr": z.enum(["HARDWARE", "SOFTWARE"]), +}) + +export const s_OktaApplication = z.object({ + displayName: z.string().min(1).optional(), + id: z.string().min(1).optional(), + name: z.string().min(1).optional(), +}) + +export const s_Organization = z.object({ + helpLink: z.string().optional(), + name: z.string().min(1).optional(), + supportEmail: z.string().optional(), + url: z.string().min(1).optional(), + _links: z + .object({ + self: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ allow: z.array(z.enum(["GET"])).optional() }) + .optional(), + }) + .optional(), + }) + .optional(), +}) + +export const s_PasswordResponse = z.object({ + created: z.string().optional(), + id: z.string().min(1).optional(), + lastUpdated: z.string().optional(), + status: z.string().optional(), + _links: z + .object({ + self: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ + allow: z.array(z.enum(["DELETE", "GET", "PUT"])).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), +}) + +export const s_Phone = z.object({ + id: z.string().min(1), + profile: z.object({ phoneNumber: z.string().min(1) }), + status: z.enum(["VERIFIED", "UNVERIFIED"]), + _links: z + .object({ + self: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ + allow: z.array(z.enum(["GET", "DELETE", "PUT"])).optional(), + }) + .optional(), + }) + .optional(), + challenge: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ + allow: z + .array(z.enum(["DELETE", "GET", "POST", "PUT"])) + .optional(), + }) + .optional(), + }) + .optional(), + verify: z + .object({ + href: z.string().min(1).optional(), + hints: z + .object({ + allow: z + .array(z.enum(["DELETE", "GET", "POST", "PUT"])) + .optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), +}) + +export const s_Profile = z.object({ + createdAt: z.string().datetime({ offset: true }).optional(), + modifiedAt: z.string().datetime({ offset: true }).optional(), + profile: z.object({}).optional(), + _links: z + .object({ + self: z.object({ href: z.string().optional() }).optional(), + describedBy: z.object({ href: z.string().optional() }).optional(), + }) + .optional(), +}) + +export const s_PushNotificationChallenge = z.object({ + challenge: z.string().optional(), + payloadVersion: z.enum(["IDXv1"]).optional(), +}) + +export const s_PushNotificationVerification = z.object({ + challengeResponse: z.string().optional(), + method: z.enum(["push"]).optional(), +}) + +export const s_Schema = z.object({ + properties: z.object({}).optional(), + _links: z + .object({ + self: z.object({ href: z.string().optional() }).optional(), + user: z.object({ href: z.string().optional() }).optional(), + }) + .optional(), +}) + +export const s_UpdateAuthenticatorEnrollmentRequest = z.object({ + nickname: z.string().optional(), +}) + +export const s_HrefObject = z.object({ + hints: z.object({ allow: z.array(s_HttpMethod).optional() }).optional(), + href: z.string(), + name: z.string().optional(), + type: z.string().optional(), +}) + +export const s_KeyObject = z.union([s_KeyEC, s_KeyRSA]) + +export const s_AppAuthenticatorEnrollmentRequest = z.object({ + authenticatorId: z.string(), + device: z.object({ + secureHardwarePresent: PermissiveBoolean.optional(), + clientInstanceKey: s_KeyObject, + osVersion: z.string(), + clientInstanceBundleId: z.string(), + platform: z.enum(["ANDROID", "IOS"]), + manufacturer: z.string().optional(), + deviceAttestation: z.record(z.unknown()).optional(), + clientInstanceVersion: z.string(), + clientInstanceDeviceSdkVersion: z.string(), + model: z.string().optional(), + displayName: z.string(), + udid: z.string().optional(), + }), + methods: z.object({ + push: z.object({ + apsEnvironment: z.enum(["PRODUCTION", "DEVELOPMENT"]).optional(), + pushToken: z.string(), + keys: z.object({ + proofOfPossession: s_KeyObject, + userVerification: s_KeyObject.optional(), + capabilities: s_AppAuthenticatorMethodCapabilities.optional(), + }), + }), + }), +}) + +export const s_AuthenticatorEnrollment = z.object({ + canReset: PermissiveBoolean.optional(), + canUnenroll: PermissiveBoolean.optional(), + created: z.string().optional(), + id: z.string().optional(), + lastChallenged: z.string().optional(), + name: z.string().optional(), + nickname: z.string().optional(), + profile: z.object({}).optional(), + _links: z + .object({ + self: s_HrefObject.optional(), + authenticator: s_HrefObject.optional(), + modify: s_HrefObject.optional(), + unenroll: s_HrefObject.optional(), + }) + .optional(), +}) + +export const s_UpdateAppAuthenticatorEnrollmentRequest = z.object({ + methods: z + .object({ + push: z + .object({ + pushToken: z.string().optional(), + keys: z + .object({ userVerification: s_KeyObject.optional() }) + .optional(), + capabilities: s_AppAuthenticatorMethodCapabilities.optional(), + }) + .optional(), + }) + .optional(), +}) + +export const s_Authenticator = z.object({ + enrollable: PermissiveBoolean.optional(), + id: z.string().optional(), + key: s_AuthenticatorKey.optional(), + name: z.string().optional(), + _embedded: z + .object({ enrollments: z.array(s_AuthenticatorEnrollment).optional() }) + .optional(), + _links: z + .object({ + self: s_HrefObject.optional(), + enroll: s_HrefObject.optional(), + enrollments: s_HrefObject.optional(), + }) + .optional(), +}) diff --git a/integration-tests/typescript-express/src/generated/okta.oauth.yaml/generated.ts b/integration-tests/typescript-express/src/generated/okta.oauth.yaml/generated.ts new file mode 100644 index 000000000..23c76585b --- /dev/null +++ b/integration-tests/typescript-express/src/generated/okta.oauth.yaml/generated.ts @@ -0,0 +1,4128 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_AuthorizeCustomAsParamSchema, + t_AuthorizeCustomAsQuerySchema, + t_AuthorizeCustomAsWithPostParamSchema, + t_AuthorizeCustomAsWithPostRequestBodySchema, + t_AuthorizeQuerySchema, + t_AuthorizeWithPostRequestBodySchema, + t_BackchannelAuthorizeResponse, + t_BcAuthorizeCustomAsParamSchema, + t_BcAuthorizeCustomAsRequestBodySchema, + t_BcAuthorizeRequestBodySchema, + t_ChallengeCustomAsParamSchema, + t_ChallengeCustomAsRequestBodySchema, + t_ChallengeRequestBodySchema, + t_ChallengeResponse, + t_Client, + t_CreateClientRequestBodySchema, + t_DeleteClientParamSchema, + t_DeviceAuthorizeCustomAsParamSchema, + t_DeviceAuthorizeCustomAsRequestBodySchema, + t_DeviceAuthorizeRequestBodySchema, + t_DeviceAuthorizeResponse, + t_Error, + t_GenerateNewClientSecretParamSchema, + t_GetClientParamSchema, + t_GetWellKnownOAuthConfigurationCustomAsParamSchema, + t_GetWellKnownOAuthConfigurationCustomAsQuerySchema, + t_GetWellKnownOpenIdConfigurationCustomAsParamSchema, + t_GetWellKnownOpenIdConfigurationCustomAsQuerySchema, + t_GetWellKnownOpenIdConfigurationQuerySchema, + t_GlobalTokenRevocationRequestBodySchema, + t_IntrospectCustomAsParamSchema, + t_IntrospectCustomAsRequestBodySchema, + t_IntrospectRequestBodySchema, + t_IntrospectionResponse, + t_ListClientsQuerySchema, + t_LogoutCustomAsParamSchema, + t_LogoutCustomAsQuerySchema, + t_LogoutCustomAsWithPostParamSchema, + t_LogoutCustomAsWithPostRequestBodySchema, + t_LogoutQuerySchema, + t_LogoutWithPostRequestBodySchema, + t_OAuthError, + t_OAuthKeys, + t_OAuthMetadata, + t_OauthKeysCustomAsParamSchema, + t_OauthKeysQuerySchema, + t_OidcMetadata, + t_OobAuthenticateCustomAsParamSchema, + t_OobAuthenticateCustomAsRequestBodySchema, + t_OobAuthenticateRequestBodySchema, + t_OobAuthenticateResponse, + t_ParCustomAsParamSchema, + t_ParCustomAsRequestBodySchema, + t_ParOptionsCustomAsParamSchema, + t_ParOptionsCustomAsRequestHeaderSchema, + t_ParOptionsRequestHeaderSchema, + t_ParRequestBodySchema, + t_ParResponse, + t_ReplaceClientParamSchema, + t_ReplaceClientRequestBodySchema, + t_RevokeCustomAsParamSchema, + t_RevokeCustomAsRequestBodySchema, + t_RevokeRequestBodySchema, + t_TokenCustomAsParamSchema, + t_TokenCustomAsRequestBodySchema, + t_TokenOptionsCustomAsParamSchema, + t_TokenOptionsCustomAsRequestHeaderSchema, + t_TokenOptionsRequestHeaderSchema, + t_TokenRequestBodySchema, + t_TokenResponse, + t_UserInfo, + t_UserinfoCustomAsParamSchema, +} from "./models" +import { + s_AcrValue, + s_AmrValue, + s_AuthorizeWithPost, + s_BackchannelAuthorizeRequest, + s_BackchannelAuthorizeResponse, + s_ChallengeRequest, + s_ChallengeResponse, + s_Client, + s_CodeChallengeMethod, + s_DeviceAuthorizeRequest, + s_DeviceAuthorizeResponse, + s_Error, + s_GlobalTokenRevocationRequest, + s_IntrospectionRequest, + s_IntrospectionResponse, + s_LogoutWithPost, + s_OAuthError, + s_OAuthKeys, + s_OAuthMetadata, + s_OidcMetadata, + s_OobAuthenticateRequest, + s_OobAuthenticateResponse, + s_ParRequest, + s_ParResponse, + s_Prompt, + s_ResponseMode, + s_ResponseTypesSupported, + s_RevokeRequest, + s_TokenRequest, + s_TokenResponse, + s_UserInfo, +} from "./schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + ServerConfig, + SkipResponse, + StatusCode, + startServer, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type GetWellKnownOpenIdConfigurationResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetWellKnownOpenIdConfiguration = ( + params: Params< + void, + t_GetWellKnownOpenIdConfigurationQuerySchema, + void, + void + >, + respond: GetWellKnownOpenIdConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AuthorizeResponder = { + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type Authorize = ( + params: Params, + respond: AuthorizeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AuthorizeWithPostResponder = { + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AuthorizeWithPost = ( + params: Params, + respond: AuthorizeWithPostResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BcAuthorizeResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type BcAuthorize = ( + params: Params, + respond: BcAuthorizeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChallengeResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type Challenge = ( + params: Params, + respond: ChallengeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ListClientsResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ListClients = ( + params: Params, + respond: ListClientsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CreateClientResponder = { + with201(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CreateClient = ( + params: Params, + respond: CreateClientResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetClientResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetClient = ( + params: Params, + respond: GetClientResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ReplaceClientResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ReplaceClient = ( + params: Params< + t_ReplaceClientParamSchema, + void, + t_ReplaceClientRequestBodySchema, + void + >, + respond: ReplaceClientResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteClientResponder = { + with204(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteClient = ( + params: Params, + respond: DeleteClientResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GenerateNewClientSecretResponder = { + with200(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GenerateNewClientSecret = ( + params: Params, + respond: GenerateNewClientSecretResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeviceAuthorizeResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeviceAuthorize = ( + params: Params, + respond: DeviceAuthorizeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GlobalTokenRevocationResponder = { + with204(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GlobalTokenRevocation = ( + params: Params, + respond: GlobalTokenRevocationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IntrospectResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type Introspect = ( + params: Params, + respond: IntrospectResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OauthKeysResponder = { + with200(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OauthKeys = ( + params: Params, + respond: OauthKeysResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type LogoutResponder = { + with200(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type Logout = ( + params: Params, + respond: LogoutResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type LogoutWithPostResponder = { + with200(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type LogoutWithPost = ( + params: Params, + respond: LogoutWithPostResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OobAuthenticateResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OobAuthenticate = ( + params: Params, + respond: OobAuthenticateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ParOptionsResponder = { + with204(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ParOptions = ( + params: Params, + respond: ParOptionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ParResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type Par = ( + params: Params, + respond: ParResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type RevokeResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type Revoke = ( + params: Params, + respond: RevokeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TokenOptionsResponder = { + with204(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TokenOptions = ( + params: Params, + respond: TokenOptionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TokenResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type Token = ( + params: Params, + respond: TokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UserinfoResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type Userinfo = ( + params: Params, + respond: UserinfoResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetWellKnownOAuthConfigurationCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetWellKnownOAuthConfigurationCustomAs = ( + params: Params< + t_GetWellKnownOAuthConfigurationCustomAsParamSchema, + t_GetWellKnownOAuthConfigurationCustomAsQuerySchema, + void, + void + >, + respond: GetWellKnownOAuthConfigurationCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetWellKnownOpenIdConfigurationCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with404(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetWellKnownOpenIdConfigurationCustomAs = ( + params: Params< + t_GetWellKnownOpenIdConfigurationCustomAsParamSchema, + t_GetWellKnownOpenIdConfigurationCustomAsQuerySchema, + void, + void + >, + respond: GetWellKnownOpenIdConfigurationCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AuthorizeCustomAsResponder = { + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AuthorizeCustomAs = ( + params: Params< + t_AuthorizeCustomAsParamSchema, + t_AuthorizeCustomAsQuerySchema, + void, + void + >, + respond: AuthorizeCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AuthorizeCustomAsWithPostResponder = { + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AuthorizeCustomAsWithPost = ( + params: Params< + t_AuthorizeCustomAsWithPostParamSchema, + void, + t_AuthorizeCustomAsWithPostRequestBodySchema, + void + >, + respond: AuthorizeCustomAsWithPostResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type BcAuthorizeCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type BcAuthorizeCustomAs = ( + params: Params< + t_BcAuthorizeCustomAsParamSchema, + void, + t_BcAuthorizeCustomAsRequestBodySchema, + void + >, + respond: BcAuthorizeCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ChallengeCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ChallengeCustomAs = ( + params: Params< + t_ChallengeCustomAsParamSchema, + void, + t_ChallengeCustomAsRequestBodySchema, + void + >, + respond: ChallengeCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeviceAuthorizeCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeviceAuthorizeCustomAs = ( + params: Params< + t_DeviceAuthorizeCustomAsParamSchema, + void, + t_DeviceAuthorizeCustomAsRequestBodySchema, + void + >, + respond: DeviceAuthorizeCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type IntrospectCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type IntrospectCustomAs = ( + params: Params< + t_IntrospectCustomAsParamSchema, + void, + t_IntrospectCustomAsRequestBodySchema, + void + >, + respond: IntrospectCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OauthKeysCustomAsResponder = { + with200(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OauthKeysCustomAs = ( + params: Params, + respond: OauthKeysCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type LogoutCustomAsResponder = { + with200(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type LogoutCustomAs = ( + params: Params< + t_LogoutCustomAsParamSchema, + t_LogoutCustomAsQuerySchema, + void, + void + >, + respond: LogoutCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type LogoutCustomAsWithPostResponder = { + with200(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type LogoutCustomAsWithPost = ( + params: Params< + t_LogoutCustomAsWithPostParamSchema, + void, + t_LogoutCustomAsWithPostRequestBodySchema, + void + >, + respond: LogoutCustomAsWithPostResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type OobAuthenticateCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type OobAuthenticateCustomAs = ( + params: Params< + t_OobAuthenticateCustomAsParamSchema, + void, + t_OobAuthenticateCustomAsRequestBodySchema, + void + >, + respond: OobAuthenticateCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ParOptionsCustomAsResponder = { + with204(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ParOptionsCustomAs = ( + params: Params< + t_ParOptionsCustomAsParamSchema, + void, + void, + t_ParOptionsCustomAsRequestHeaderSchema + >, + respond: ParOptionsCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ParCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ParCustomAs = ( + params: Params< + t_ParCustomAsParamSchema, + void, + t_ParCustomAsRequestBodySchema, + void + >, + respond: ParCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type RevokeCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type RevokeCustomAs = ( + params: Params< + t_RevokeCustomAsParamSchema, + void, + t_RevokeCustomAsRequestBodySchema, + void + >, + respond: RevokeCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TokenOptionsCustomAsResponder = { + with204(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TokenOptionsCustomAs = ( + params: Params< + t_TokenOptionsCustomAsParamSchema, + void, + void, + t_TokenOptionsCustomAsRequestHeaderSchema + >, + respond: TokenOptionsCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type TokenCustomAsResponder = { + with200(): ExpressRuntimeResponse + with400(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type TokenCustomAs = ( + params: Params< + t_TokenCustomAsParamSchema, + void, + t_TokenCustomAsRequestBodySchema, + void + >, + respond: TokenCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UserinfoCustomAsResponder = { + with200(): ExpressRuntimeResponse + with401(): ExpressRuntimeResponse + with403(): ExpressRuntimeResponse + with429(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UserinfoCustomAs = ( + params: Params, + respond: UserinfoCustomAsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type Implementation = { + getWellKnownOpenIdConfiguration: GetWellKnownOpenIdConfiguration + authorize: Authorize + authorizeWithPost: AuthorizeWithPost + bcAuthorize: BcAuthorize + challenge: Challenge + listClients: ListClients + createClient: CreateClient + getClient: GetClient + replaceClient: ReplaceClient + deleteClient: DeleteClient + generateNewClientSecret: GenerateNewClientSecret + deviceAuthorize: DeviceAuthorize + globalTokenRevocation: GlobalTokenRevocation + introspect: Introspect + oauthKeys: OauthKeys + logout: Logout + logoutWithPost: LogoutWithPost + oobAuthenticate: OobAuthenticate + parOptions: ParOptions + par: Par + revoke: Revoke + tokenOptions: TokenOptions + token: Token + userinfo: Userinfo + getWellKnownOAuthConfigurationCustomAs: GetWellKnownOAuthConfigurationCustomAs + getWellKnownOpenIdConfigurationCustomAs: GetWellKnownOpenIdConfigurationCustomAs + authorizeCustomAs: AuthorizeCustomAs + authorizeCustomAsWithPost: AuthorizeCustomAsWithPost + bcAuthorizeCustomAs: BcAuthorizeCustomAs + challengeCustomAs: ChallengeCustomAs + deviceAuthorizeCustomAs: DeviceAuthorizeCustomAs + introspectCustomAs: IntrospectCustomAs + oauthKeysCustomAs: OauthKeysCustomAs + logoutCustomAs: LogoutCustomAs + logoutCustomAsWithPost: LogoutCustomAsWithPost + oobAuthenticateCustomAs: OobAuthenticateCustomAs + parOptionsCustomAs: ParOptionsCustomAs + parCustomAs: ParCustomAs + revokeCustomAs: RevokeCustomAs + tokenOptionsCustomAs: TokenOptionsCustomAs + tokenCustomAs: TokenCustomAs + userinfoCustomAs: UserinfoCustomAs +} + +export function createRouter(implementation: Implementation): Router { + const router = Router() + + const getWellKnownOpenIdConfigurationQuerySchema = z.object({ + client_id: z.string().optional(), + }) + + const getWellKnownOpenIdConfigurationResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_OidcMetadata], + ["400", s_Error], + ], + undefined, + ) + + // getWellKnownOpenIdConfiguration + router.get( + `/.well-known/openid-configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getWellKnownOpenIdConfigurationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getWellKnownOpenIdConfiguration(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getWellKnownOpenIdConfigurationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const authorizeQuerySchema = z.object({ + acr_values: s_AcrValue.optional(), + client_id: z.string(), + code_challenge: z.string().optional(), + code_challenge_method: s_CodeChallengeMethod.optional(), + display: z.string().optional(), + enroll_amr_values: s_AmrValue.optional(), + idp_scope: z.string().optional(), + idp: z.string().optional(), + login_hint: z.string().optional(), + max_age: z.coerce.number().optional(), + nonce: z.string().optional(), + prompt: s_Prompt.optional(), + redirect_uri: z.string(), + response_type: s_ResponseTypesSupported, + response_mode: s_ResponseMode.optional(), + request_uri: z.string().optional(), + request: z.string().optional(), + scope: z.string(), + sessionToken: z.string().optional(), + state: z.string(), + }) + + const authorizeResponseBodyValidator = responseValidationFactory( + [["429", s_Error]], + undefined, + ) + + // authorize + router.get( + `/oauth2/v1/authorize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + authorizeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .authorize(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(authorizeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const authorizeWithPostRequestBodySchema = s_AuthorizeWithPost + + const authorizeWithPostResponseBodyValidator = responseValidationFactory( + [["429", s_Error]], + undefined, + ) + + // authorizeWithPost + router.post( + `/oauth2/v1/authorize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + authorizeWithPostRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .authorizeWithPost(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(authorizeWithPostResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const bcAuthorizeRequestBodySchema = s_BackchannelAuthorizeRequest + + const bcAuthorizeResponseBodyValidator = responseValidationFactory( + [ + ["200", s_BackchannelAuthorizeResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // bcAuthorize + router.post( + `/oauth2/v1/bc/authorize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + bcAuthorizeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .bcAuthorize(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(bcAuthorizeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const challengeRequestBodySchema = s_ChallengeRequest + + const challengeResponseBodyValidator = responseValidationFactory( + [ + ["200", s_ChallengeResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["403", s_OAuthError], + ["429", s_OAuthError], + ], + undefined, + ) + + // challenge + router.post( + `/oauth2/v1/challenge`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + challengeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .challenge(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(challengeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const listClientsQuerySchema = z.object({ + after: z.string().optional(), + limit: z.coerce.number().min(1).max(200).optional().default(20), + q: z.string().optional(), + }) + + const listClientsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.array(s_Client)], + ["403", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // listClients + router.get( + `/oauth2/v1/clients`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + listClientsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .listClients(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(listClientsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const createClientRequestBodySchema = s_Client + + const createClientResponseBodyValidator = responseValidationFactory( + [ + ["201", s_Client], + ["400", s_Error], + ["403", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // createClient + router.post( + `/oauth2/v1/clients`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + createClientRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with201() { + return new ExpressRuntimeResponse(201) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .createClient(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(createClientResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getClientParamSchema = z.object({ clientId: z.string() }) + + const getClientResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Client], + ["403", s_Error], + ["404", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // getClient + router.get( + `/oauth2/v1/clients/:clientId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getClientParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getClient(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getClientResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const replaceClientParamSchema = z.object({ clientId: z.string() }) + + const replaceClientRequestBodySchema = s_Client + + const replaceClientResponseBodyValidator = responseValidationFactory( + [ + ["200", s_Client], + ["400", s_Error], + ["403", s_Error], + ["404", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // replaceClient + router.put( + `/oauth2/v1/clients/:clientId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + replaceClientParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + replaceClientRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .replaceClient(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(replaceClientResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteClientParamSchema = z.object({ clientId: z.string() }) + + const deleteClientResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["403", s_Error], + ["404", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // deleteClient + router.delete( + `/oauth2/v1/clients/:clientId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteClientParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteClient(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteClientResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const generateNewClientSecretParamSchema = z.object({ clientId: z.string() }) + + const generateNewClientSecretResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_Client], + ["403", s_Error], + ["404", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // generateNewClientSecret + router.post( + `/oauth2/v1/clients/:clientId/lifecycle/newSecret`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + generateNewClientSecretParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .generateNewClientSecret(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(generateNewClientSecretResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deviceAuthorizeRequestBodySchema = s_DeviceAuthorizeRequest + + const deviceAuthorizeResponseBodyValidator = responseValidationFactory( + [ + ["200", s_DeviceAuthorizeResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // deviceAuthorize + router.post( + `/oauth2/v1/device/authorize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + deviceAuthorizeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deviceAuthorize(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deviceAuthorizeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const globalTokenRevocationRequestBodySchema = s_GlobalTokenRevocationRequest + + const globalTokenRevocationResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["400", z.undefined()], + ["403", s_Error], + ["429", s_Error], + ], + undefined, + ) + + // globalTokenRevocation + router.post( + `/oauth2/v1/global-token-revocation`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + globalTokenRevocationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .globalTokenRevocation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(globalTokenRevocationResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const introspectRequestBodySchema = s_IntrospectionRequest + + const introspectResponseBodyValidator = responseValidationFactory( + [ + ["200", s_IntrospectionResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // introspect + router.post( + `/oauth2/v1/introspect`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + introspectRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .introspect(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(introspectResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const oauthKeysQuerySchema = z.object({ client_id: z.string().optional() }) + + const oauthKeysResponseBodyValidator = responseValidationFactory( + [ + ["200", s_OAuthKeys], + ["429", s_Error], + ], + undefined, + ) + + // oauthKeys + router.get( + `/oauth2/v1/keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + oauthKeysQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .oauthKeys(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(oauthKeysResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const logoutQuerySchema = z.object({ + id_token_hint: z.string(), + post_logout_redirect_uri: z.string().optional(), + state: z.string().optional(), + }) + + const logoutResponseBodyValidator = responseValidationFactory( + [ + ["200", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // logout + router.get( + `/oauth2/v1/logout`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + logoutQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .logout(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(logoutResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const logoutWithPostRequestBodySchema = s_LogoutWithPost + + const logoutWithPostResponseBodyValidator = responseValidationFactory( + [ + ["200", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // logoutWithPost + router.post( + `/oauth2/v1/logout`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + logoutWithPostRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .logoutWithPost(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(logoutWithPostResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const oobAuthenticateRequestBodySchema = s_OobAuthenticateRequest + + const oobAuthenticateResponseBodyValidator = responseValidationFactory( + [ + ["200", s_OobAuthenticateResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["403", s_OAuthError], + ["429", s_OAuthError], + ], + undefined, + ) + + // oobAuthenticate + router.post( + `/oauth2/v1/oob-authenticate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + oobAuthenticateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .oobAuthenticate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(oobAuthenticateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const parOptionsRequestHeaderSchema = z.object({ + origin: z.string().optional(), + }) + + const parOptionsResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // parOptions + router.options( + `/oauth2/v1/par`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: parseRequestInput( + parOptionsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .parOptions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(parOptionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const parRequestBodySchema = s_ParRequest + + const parResponseBodyValidator = responseValidationFactory( + [ + ["200", s_ParResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["403", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // par + router.post( + `/oauth2/v1/par`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + parRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .par(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(parResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const revokeRequestBodySchema = s_RevokeRequest + + const revokeResponseBodyValidator = responseValidationFactory( + [ + ["200", z.undefined()], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // revoke + router.post( + `/oauth2/v1/revoke`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + revokeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .revoke(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(revokeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const tokenOptionsRequestHeaderSchema = z.object({ + origin: z.string().optional(), + }) + + const tokenOptionsResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // tokenOptions + router.options( + `/oauth2/v1/token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: parseRequestInput( + tokenOptionsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .tokenOptions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(tokenOptionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const tokenRequestBodySchema = s_TokenRequest + + const tokenResponseBodyValidator = responseValidationFactory( + [ + ["200", s_TokenResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // token + router.post( + `/oauth2/v1/token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + tokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .token(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(tokenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const userinfoResponseBodyValidator = responseValidationFactory( + [ + ["200", s_UserInfo], + ["401", z.undefined()], + ["403", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // userinfo + router.get( + `/oauth2/v1/userinfo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .userinfo(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(userinfoResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getWellKnownOAuthConfigurationCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const getWellKnownOAuthConfigurationCustomAsQuerySchema = z.object({ + client_id: z.string().optional(), + }) + + const getWellKnownOAuthConfigurationCustomAsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_OAuthMetadata], + ["400", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // getWellKnownOAuthConfigurationCustomAs + router.get( + `/oauth2/:authorizationServerId/.well-known/oauth-authorization-server`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getWellKnownOAuthConfigurationCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getWellKnownOAuthConfigurationCustomAsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getWellKnownOAuthConfigurationCustomAs( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getWellKnownOAuthConfigurationCustomAsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getWellKnownOpenIdConfigurationCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const getWellKnownOpenIdConfigurationCustomAsQuerySchema = z.object({ + client_id: z.string().optional(), + }) + + const getWellKnownOpenIdConfigurationCustomAsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_OidcMetadata], + ["400", s_Error], + ["404", s_Error], + ], + undefined, + ) + + // getWellKnownOpenIdConfigurationCustomAs + router.get( + `/oauth2/:authorizationServerId/.well-known/openid-configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getWellKnownOpenIdConfigurationCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getWellKnownOpenIdConfigurationCustomAsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with404() { + return new ExpressRuntimeResponse(404) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getWellKnownOpenIdConfigurationCustomAs( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getWellKnownOpenIdConfigurationCustomAsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const authorizeCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const authorizeCustomAsQuerySchema = z.object({ + acr_values: s_AcrValue.optional(), + client_id: z.string(), + code_challenge: z.string().optional(), + code_challenge_method: s_CodeChallengeMethod.optional(), + display: z.string().optional(), + enroll_amr_values: s_AmrValue.optional(), + idp_scope: z.string().optional(), + idp: z.string().optional(), + login_hint: z.string().optional(), + max_age: z.coerce.number().optional(), + nonce: z.string().optional(), + prompt: s_Prompt.optional(), + redirect_uri: z.string(), + response_type: s_ResponseTypesSupported, + response_mode: s_ResponseMode.optional(), + request_uri: z.string().optional(), + request: z.string().optional(), + scope: z.string(), + sessionToken: z.string().optional(), + state: z.string(), + }) + + const authorizeCustomAsResponseBodyValidator = responseValidationFactory( + [["429", s_Error]], + undefined, + ) + + // authorizeCustomAs + router.get( + `/oauth2/:authorizationServerId/v1/authorize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + authorizeCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + authorizeCustomAsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .authorizeCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(authorizeCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const authorizeCustomAsWithPostParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const authorizeCustomAsWithPostRequestBodySchema = s_AuthorizeWithPost + + const authorizeCustomAsWithPostResponseBodyValidator = + responseValidationFactory([["429", s_Error]], undefined) + + // authorizeCustomAsWithPost + router.post( + `/oauth2/:authorizationServerId/v1/authorize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + authorizeCustomAsWithPostParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + authorizeCustomAsWithPostRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .authorizeCustomAsWithPost(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(authorizeCustomAsWithPostResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const bcAuthorizeCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const bcAuthorizeCustomAsRequestBodySchema = s_BackchannelAuthorizeRequest + + const bcAuthorizeCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_BackchannelAuthorizeResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // bcAuthorizeCustomAs + router.post( + `/oauth2/:authorizationServerId/v1/bc/authorize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + bcAuthorizeCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + bcAuthorizeCustomAsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .bcAuthorizeCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(bcAuthorizeCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const challengeCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const challengeCustomAsRequestBodySchema = s_ChallengeRequest + + const challengeCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_ChallengeResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["403", s_OAuthError], + ["429", s_OAuthError], + ], + undefined, + ) + + // challengeCustomAs + router.post( + `/oauth2/:authorizationServerId/v1/challenge`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + challengeCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + challengeCustomAsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .challengeCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(challengeCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deviceAuthorizeCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const deviceAuthorizeCustomAsRequestBodySchema = s_DeviceAuthorizeRequest + + const deviceAuthorizeCustomAsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_DeviceAuthorizeResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // deviceAuthorizeCustomAs + router.post( + `/oauth2/:authorizationServerId/v1/device/authorize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deviceAuthorizeCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deviceAuthorizeCustomAsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deviceAuthorizeCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deviceAuthorizeCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const introspectCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const introspectCustomAsRequestBodySchema = s_IntrospectionRequest + + const introspectCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_IntrospectionResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // introspectCustomAs + router.post( + `/oauth2/:authorizationServerId/v1/introspect`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + introspectCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + introspectCustomAsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .introspectCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(introspectCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const oauthKeysCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const oauthKeysCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_OAuthKeys], + ["429", s_Error], + ], + undefined, + ) + + // oauthKeysCustomAs + router.get( + `/oauth2/:authorizationServerId/v1/keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + oauthKeysCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .oauthKeysCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(oauthKeysCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const logoutCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const logoutCustomAsQuerySchema = z.object({ + id_token_hint: z.string(), + post_logout_redirect_uri: z.string().optional(), + state: z.string().optional(), + }) + + const logoutCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // logoutCustomAs + router.get( + `/oauth2/:authorizationServerId/v1/logout`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + logoutCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + logoutCustomAsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .logoutCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(logoutCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const logoutCustomAsWithPostParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const logoutCustomAsWithPostRequestBodySchema = s_LogoutWithPost + + const logoutCustomAsWithPostResponseBodyValidator = responseValidationFactory( + [ + ["200", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // logoutCustomAsWithPost + router.post( + `/oauth2/:authorizationServerId/v1/logout`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + logoutCustomAsWithPostParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + logoutCustomAsWithPostRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .logoutCustomAsWithPost(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(logoutCustomAsWithPostResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const oobAuthenticateCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const oobAuthenticateCustomAsRequestBodySchema = s_OobAuthenticateRequest + + const oobAuthenticateCustomAsResponseBodyValidator = + responseValidationFactory( + [ + ["200", s_OobAuthenticateResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["403", s_OAuthError], + ["429", s_OAuthError], + ], + undefined, + ) + + // oobAuthenticateCustomAs + router.post( + `/oauth2/:authorizationServerId/v1/oob-authenticate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + oobAuthenticateCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + oobAuthenticateCustomAsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .oobAuthenticateCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(oobAuthenticateCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const parOptionsCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const parOptionsCustomAsRequestHeaderSchema = z.object({ + origin: z.string().optional(), + }) + + const parOptionsCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // parOptionsCustomAs + router.options( + `/oauth2/:authorizationServerId/v1/par`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + parOptionsCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: parseRequestInput( + parOptionsCustomAsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .parOptionsCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(parOptionsCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const parCustomAsParamSchema = z.object({ authorizationServerId: z.string() }) + + const parCustomAsRequestBodySchema = s_ParRequest + + const parCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_ParResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["403", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // parCustomAs + router.post( + `/oauth2/:authorizationServerId/v1/par`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + parCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + parCustomAsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .parCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(parCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const revokeCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const revokeCustomAsRequestBodySchema = s_RevokeRequest + + const revokeCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", z.undefined()], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // revokeCustomAs + router.post( + `/oauth2/:authorizationServerId/v1/revoke`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + revokeCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + revokeCustomAsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .revokeCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(revokeCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const tokenOptionsCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const tokenOptionsCustomAsRequestHeaderSchema = z.object({ + origin: z.string().optional(), + }) + + const tokenOptionsCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // tokenOptionsCustomAs + router.options( + `/oauth2/:authorizationServerId/v1/token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + tokenOptionsCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: parseRequestInput( + tokenOptionsCustomAsRequestHeaderSchema, + req.headers, + RequestInputType.RequestHeader, + ), + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .tokenOptionsCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(tokenOptionsCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const tokenCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const tokenCustomAsRequestBodySchema = s_TokenRequest + + const tokenCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_TokenResponse], + ["400", s_OAuthError], + ["401", s_OAuthError], + ["429", s_Error], + ], + undefined, + ) + + // tokenCustomAs + router.post( + `/oauth2/:authorizationServerId/v1/token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + tokenCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + tokenCustomAsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with400() { + return new ExpressRuntimeResponse(400) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .tokenCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(tokenCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const userinfoCustomAsParamSchema = z.object({ + authorizationServerId: z.string(), + }) + + const userinfoCustomAsResponseBodyValidator = responseValidationFactory( + [ + ["200", s_UserInfo], + ["401", z.undefined()], + ["403", z.undefined()], + ["429", s_Error], + ], + undefined, + ) + + // userinfoCustomAs + router.get( + `/oauth2/:authorizationServerId/v1/userinfo`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + userinfoCustomAsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + with401() { + return new ExpressRuntimeResponse(401) + }, + with403() { + return new ExpressRuntimeResponse(403) + }, + with429() { + return new ExpressRuntimeResponse(429) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .userinfoCustomAs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(userinfoCustomAsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export async function bootstrap(config: ServerConfig) { + // Okta OpenID Connect & OAuth 2.0 + return startServer(config) +} diff --git a/integration-tests/typescript-express/src/generated/okta.oauth.yaml/models.ts b/integration-tests/typescript-express/src/generated/okta.oauth.yaml/models.ts new file mode 100644 index 000000000..e92c1f425 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/okta.oauth.yaml/models.ts @@ -0,0 +1,731 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type t_AcrValue = + | "phr" + | "phrh" + | "urn:okta:loa:1fa:any" + | "urn:okta:loa:1fa:pwd" + | "urn:okta:loa:2fa:any" + | "urn:okta:loa:2fa:any:ifpossible" + +export type t_AmrValue = + | "duo" + | "email" + | "fed" + | "google_otp" + | "kba" + | "oath_otp" + | "okta_verify" + | "opt" + | "pop" + | "pwd" + | "rsa" + | "sms" + | "symantec" + | "tel" + | "yubikey" + +export type t_ApplicationType = "browser" | "native" | "service" | "web" + +export type t_BackchannelAuthorizeResponse = { + auth_req_id?: string | undefined + expires_in?: number | undefined + interval?: number | undefined +} + +export type t_BindingMethod = "none" | "prompt" | "transfer" + +export type t_ChallengeResponse = { + binding_code?: string | undefined + binding_method?: t_BindingMethod | undefined + challenge_type?: string | undefined + channel?: t_Channel | undefined + expires_in?: number | undefined + interval?: number | undefined + oob_code?: string | undefined +} + +export type t_ChallengeType = + | "http://auth0.com/oauth/grant-type/mfa-oob" + | "http://auth0.com/oauth/grant-type/mfa-otp" + +export type t_Channel = "push" | "sms" | "voice" + +export type t_Claim = string + +export type t_Client = { + application_type?: t_ApplicationType | undefined + readonly client_id?: string | undefined + readonly client_id_issued_at?: number | undefined + client_name: string + readonly client_secret?: (string | null) | undefined + readonly client_secret_expires_at?: (number | null) | undefined + frontchannel_logout_session_required?: boolean | undefined + frontchannel_logout_uri?: (string | null) | undefined + grant_types?: t_GrantType[] | undefined + initiate_login_uri?: string | undefined + jwks?: + | { + keys?: t_JsonWebKey[] | undefined + } + | undefined + jwks_uri?: string | undefined + logo_uri?: (string | null) | undefined + policy_uri?: (string | null) | undefined + post_logout_redirect_uris?: string | undefined + redirect_uris?: string[] | undefined + request_object_signing_alg?: t_SigningAlgorithm[] | undefined + response_types?: t_ResponseType[] | undefined + token_endpoint_auth_method?: t_EndpointAuthMethod | undefined + tos_uri?: (string | null) | undefined +} + +export type t_CodeChallengeMethod = "S256" + +export type t_DeviceAuthorizeResponse = { + device_code?: string | undefined + expires_in?: number | undefined + interval?: number | undefined + user_code?: string | undefined + verification_uri?: string | undefined + verification_uri_complete?: string | undefined +} + +export type t_EndpointAuthMethod = + | "client_secret_basic" + | "client_secret_jwt" + | "client_secret_post" + | "none" + | "private_key_jwt" + +export type t_Error = { + errorCauses?: + | { + errorSummary?: string | undefined + }[] + | undefined + errorCode?: string | undefined + errorId?: string | undefined + errorLink?: string | undefined + errorSummary?: string | undefined +} + +export type t_GrantType = + | "authorization_code" + | "client_credentials" + | "implicit" + | "interaction_code" + | "password" + | "refresh_token" + | "urn:ietf:params:oauth:grant-type:device_code" + | "urn:ietf:params:oauth:grant-type:jwt-bearer" + | "urn:ietf:params:oauth:grant-type:saml2-bearer" + | "urn:ietf:params:oauth:grant-type:token-exchange" + | "urn:openid:params:grant-type:ciba" + | "urn:okta:params:oauth:grant-type:otp" + | "urn:okta:params:oauth:grant-type:oob" + | "http://auth0.com/oauth/grant-type/mfa-otp" + | "http://auth0.com/oauth/grant-type/mfa-oob" + +export type t_IntrospectionResponse = { + active?: boolean | undefined + aud?: string | undefined + client_id?: string | undefined + device_id?: string | undefined + exp?: number | undefined + iat?: number | undefined + iss?: string | undefined + jti?: string | undefined + nbf?: number | undefined + scope?: string | undefined + sub?: string | undefined + token_type?: string | undefined + uid?: string | undefined + username?: string | undefined + [key: string]: unknown | undefined +} + +export type t_JsonWebKey = { + alg?: t_SigningAlgorithm | undefined + kid?: string | undefined + kty?: t_JsonWebKeyType | undefined + status?: t_JsonWebKeyStatus | undefined + use?: t_JsonWebKeyUse | undefined +} + +export type t_JsonWebKeyStatus = "ACTIVE" | "INACTIVE" + +export type t_JsonWebKeyType = "EC" | "RSA" + +export type t_JsonWebKeyUse = "enc" | "sig" + +export type t_OAuthError = { + error?: string | undefined + error_description?: string | undefined +} + +export type t_OAuthKeys = { + keys?: t_JsonWebKey[] | undefined +} + +export type t_OAuthMetadata = { + authorization_endpoint?: string | undefined + backchannel_authentication_request_signing_alg_values_supported?: + | t_SigningAlgorithm[] + | undefined + backchannel_token_delivery_modes_supported?: t_TokenDeliveryMode[] | undefined + claims_supported?: t_Claim[] | undefined + code_challenge_methods_supported?: t_CodeChallengeMethod[] | undefined + device_authorization_endpoint?: string | undefined + dpop_signing_alg_values_supported?: + | ("ES256" | "ES384" | "ES512" | "RS256" | "RS384" | "RS512")[] + | undefined + end_session_endpoint?: string | undefined + grant_types_supported?: t_GrantType[] | undefined + introspection_endpoint?: string | undefined + introspection_endpoint_auth_methods_supported?: + | t_EndpointAuthMethod[] + | undefined + issuer?: string | undefined + jwks_uri?: string | undefined + pushed_authorization_request_endpoint?: string | undefined + registration_endpoint?: string | undefined + request_object_signing_alg_values_supported?: t_SigningAlgorithm[] | undefined + request_parameter_supported?: boolean | undefined + response_modes_supported?: t_ResponseMode[] | undefined + response_types_supported?: t_ResponseTypesSupported[] | undefined + revocation_endpoint?: string | undefined + revocation_endpoint_auth_methods_supported?: + | t_EndpointAuthMethod[] + | undefined + scopes_supported?: t_Scope[] | undefined + subject_types_supported?: t_SubjectType[] | undefined + token_endpoint?: string | undefined + token_endpoint_auth_methods_supported?: t_EndpointAuthMethod[] | undefined +} + +export type t_OidcMetadata = t_OAuthMetadata & { + id_token_signing_alg_values_supported?: t_SigningAlgorithm[] | undefined + userinfo_endpoint?: string | undefined +} + +export type t_OobAuthenticateResponse = { + binding_code?: string | undefined + binding_method?: t_BindingMethod | undefined + channel?: t_Channel | undefined + expires_in?: number | undefined + interval?: number | undefined + oob_code?: string | undefined +} + +export type t_ParResponse = { + expires_in?: number | undefined + request_uri?: string | undefined +} + +export type t_Prompt = + | "consent" + | "enroll_authenticator" + | "login" + | "login consent" + | "none" + +export type t_ResponseMode = + | "form_post" + | "fragment" + | "okta_post_message" + | "query" + +export type t_ResponseType = "code" | "id_token" | "none" | "token" + +export type t_ResponseTypesSupported = + | "code" + | "code id_token" + | "code id_token token" + | "code token" + | "id_token" + | "id_token token" + | "token" + +export type t_Scope = string + +export type t_SigningAlgorithm = + | "ES256" + | "ES384" + | "ES512" + | "HS256" + | "HS384" + | "HS512" + | "RS256" + | "RS384" + | "RS512" + +export type t_SubjectType = "pairwise" | "public" + +export type t_TokenDeliveryMode = "poll" + +export type t_TokenResponse = { + access_token?: string | undefined + device_secret?: string | undefined + expires_in?: number | undefined + id_token?: string | undefined + issued_token_type?: t_TokenType | undefined + refresh_token?: string | undefined + scope?: string | undefined + token_type?: t_TokenResponseTokenType | undefined +} + +export type t_TokenResponseTokenType = "Bearer" | "N_A" + +export type t_TokenType = + | "urn:ietf:params:oauth:token-type:access_token" + | "urn:ietf:params:oauth:token-type:id_token" + | "urn:ietf:params:oauth:token-type:jwt" + | "urn:ietf:params:oauth:token-type:refresh_token" + | "urn:ietf:params:oauth:token-type:saml1" + | "urn:ietf:params:oauth:token-type:saml2" + | "urn:okta:oauth:token-type:web_sso_token" + | "urn:x-oath:params:oauth:token-type:device-secret" + +export type t_TokenTypeHintIntrospect = + | "access_token" + | "device_secret" + | "id_token" + | "refresh_token" + +export type t_TokenTypeHintRevoke = + | "access_token" + | "device_secret" + | "refresh_token" + +export type t_UserInfo = { + sub?: string | undefined + [key: string]: unknown | undefined +} + +export type t_sub_id = { + format?: "opaque" | undefined + id?: string | undefined +} + +export type t_AuthorizeQuerySchema = { + acr_values?: t_AcrValue | undefined + client_id: string + code_challenge?: string | undefined + code_challenge_method?: t_CodeChallengeMethod | undefined + display?: string | undefined + enroll_amr_values?: t_AmrValue | undefined + idp?: string | undefined + idp_scope?: string | undefined + login_hint?: string | undefined + max_age?: number | undefined + nonce?: string | undefined + prompt?: t_Prompt | undefined + redirect_uri: string + request?: string | undefined + request_uri?: string | undefined + response_mode?: t_ResponseMode | undefined + response_type: t_ResponseTypesSupported + scope: string + sessionToken?: string | undefined + state: string +} + +export type t_AuthorizeCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_AuthorizeCustomAsQuerySchema = { + acr_values?: t_AcrValue | undefined + client_id: string + code_challenge?: string | undefined + code_challenge_method?: t_CodeChallengeMethod | undefined + display?: string | undefined + enroll_amr_values?: t_AmrValue | undefined + idp?: string | undefined + idp_scope?: string | undefined + login_hint?: string | undefined + max_age?: number | undefined + nonce?: string | undefined + prompt?: t_Prompt | undefined + redirect_uri: string + request?: string | undefined + request_uri?: string | undefined + response_mode?: t_ResponseMode | undefined + response_type: t_ResponseTypesSupported + scope: string + sessionToken?: string | undefined + state: string +} + +export type t_AuthorizeCustomAsWithPostParamSchema = { + authorizationServerId: string +} + +export type t_AuthorizeCustomAsWithPostRequestBodySchema = { + acr_values?: (t_AcrValue & string) | undefined + client_id: string + code_challenge?: string | undefined + code_challenge_method?: (t_CodeChallengeMethod & string) | undefined + display?: string | undefined + enroll_amr_values?: (t_AmrValue & string) | undefined + idp?: string | undefined + idp_scope?: string | undefined + login_hint?: string | undefined + max_age?: number | undefined + nonce?: string | undefined + prompt?: (t_Prompt & string) | undefined + redirect_uri: string + request?: string | undefined + request_uri?: string | undefined + response_mode?: (t_ResponseMode & string) | undefined + response_type: t_ResponseTypesSupported & string + scope: string + sessionToken?: string | undefined + state: string +} + +export type t_AuthorizeWithPostRequestBodySchema = { + acr_values?: (t_AcrValue & string) | undefined + client_id: string + code_challenge?: string | undefined + code_challenge_method?: (t_CodeChallengeMethod & string) | undefined + display?: string | undefined + enroll_amr_values?: (t_AmrValue & string) | undefined + idp?: string | undefined + idp_scope?: string | undefined + login_hint?: string | undefined + max_age?: number | undefined + nonce?: string | undefined + prompt?: (t_Prompt & string) | undefined + redirect_uri: string + request?: string | undefined + request_uri?: string | undefined + response_mode?: (t_ResponseMode & string) | undefined + response_type: t_ResponseTypesSupported & string + scope: string + sessionToken?: string | undefined + state: string +} + +export type t_BcAuthorizeRequestBodySchema = { + binding_message?: string | undefined + id_token_hint: string + login_hint: string + request?: string | undefined + request_expiry?: number | undefined + scope: string + [key: string]: unknown | undefined +} + +export type t_BcAuthorizeCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_BcAuthorizeCustomAsRequestBodySchema = { + binding_message?: string | undefined + id_token_hint: string + login_hint: string + request?: string | undefined + request_expiry?: number | undefined + scope: string + [key: string]: unknown | undefined +} + +export type t_ChallengeRequestBodySchema = { + challenge_types_supported?: t_ChallengeType[] | undefined + channel_hint?: t_Channel | undefined + mfa_token: string +} + +export type t_ChallengeCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_ChallengeCustomAsRequestBodySchema = { + challenge_types_supported?: t_ChallengeType[] | undefined + channel_hint?: t_Channel | undefined + mfa_token: string +} + +export type t_CreateClientRequestBodySchema = { + application_type?: t_ApplicationType | undefined + readonly client_id?: string | undefined + readonly client_id_issued_at?: number | undefined + client_name: string + readonly client_secret?: (string | null) | undefined + readonly client_secret_expires_at?: (number | null) | undefined + frontchannel_logout_session_required?: boolean | undefined + frontchannel_logout_uri?: (string | null) | undefined + grant_types?: t_GrantType[] | undefined + initiate_login_uri?: string | undefined + jwks?: + | { + keys?: t_JsonWebKey[] | undefined + } + | undefined + jwks_uri?: string | undefined + logo_uri?: (string | null) | undefined + policy_uri?: (string | null) | undefined + post_logout_redirect_uris?: string | undefined + redirect_uris?: string[] | undefined + request_object_signing_alg?: t_SigningAlgorithm[] | undefined + response_types?: t_ResponseType[] | undefined + token_endpoint_auth_method?: t_EndpointAuthMethod | undefined + tos_uri?: (string | null) | undefined +} + +export type t_DeleteClientParamSchema = { + clientId: string +} + +export type t_DeviceAuthorizeRequestBodySchema = { + client_id?: string | undefined + scope?: string | undefined +} + +export type t_DeviceAuthorizeCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_DeviceAuthorizeCustomAsRequestBodySchema = { + client_id?: string | undefined + scope?: string | undefined +} + +export type t_GenerateNewClientSecretParamSchema = { + clientId: string +} + +export type t_GetClientParamSchema = { + clientId: string +} + +export type t_GetWellKnownOAuthConfigurationCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_GetWellKnownOAuthConfigurationCustomAsQuerySchema = { + client_id?: string | undefined +} + +export type t_GetWellKnownOpenIdConfigurationQuerySchema = { + client_id?: string | undefined +} + +export type t_GetWellKnownOpenIdConfigurationCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_GetWellKnownOpenIdConfigurationCustomAsQuerySchema = { + client_id?: string | undefined +} + +export type t_GlobalTokenRevocationRequestBodySchema = { + sub_id?: t_sub_id | undefined +} + +export type t_IntrospectRequestBodySchema = { + token?: string | undefined + token_type_hint?: t_TokenTypeHintIntrospect | undefined +} + +export type t_IntrospectCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_IntrospectCustomAsRequestBodySchema = { + token?: string | undefined + token_type_hint?: t_TokenTypeHintIntrospect | undefined +} + +export type t_ListClientsQuerySchema = { + after?: string | undefined + limit?: number | undefined + q?: string | undefined +} + +export type t_LogoutQuerySchema = { + id_token_hint: string + post_logout_redirect_uri?: string | undefined + state?: string | undefined +} + +export type t_LogoutCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_LogoutCustomAsQuerySchema = { + id_token_hint: string + post_logout_redirect_uri?: string | undefined + state?: string | undefined +} + +export type t_LogoutCustomAsWithPostParamSchema = { + authorizationServerId: string +} + +export type t_LogoutCustomAsWithPostRequestBodySchema = { + id_token_hint: string + post_logout_redirect_uri?: string | undefined + state?: string | undefined +} + +export type t_LogoutWithPostRequestBodySchema = { + id_token_hint: string + post_logout_redirect_uri?: string | undefined + state?: string | undefined +} + +export type t_OauthKeysQuerySchema = { + client_id?: string | undefined +} + +export type t_OauthKeysCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_OobAuthenticateRequestBodySchema = { + channel_hint: t_Channel + login_hint: string +} + +export type t_OobAuthenticateCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_OobAuthenticateCustomAsRequestBodySchema = { + channel_hint: t_Channel + login_hint: string +} + +export type t_ParRequestBodySchema = { + client_id?: string | undefined + code_challenge?: string | undefined + code_challenge_method?: string | undefined + display?: string | undefined + idp?: string | undefined + idp_scope?: string | undefined + login_hint?: string | undefined + max_age?: number | undefined + nonce?: string | undefined + prompt?: string | undefined + redirect_uri?: string | undefined + request?: string | undefined + response_mode?: string | undefined + response_type?: string | undefined + scope?: string | undefined + sessionToken?: string | undefined + state?: string | undefined +} + +export type t_ParCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_ParCustomAsRequestBodySchema = { + client_id?: string | undefined + code_challenge?: string | undefined + code_challenge_method?: string | undefined + display?: string | undefined + idp?: string | undefined + idp_scope?: string | undefined + login_hint?: string | undefined + max_age?: number | undefined + nonce?: string | undefined + prompt?: string | undefined + redirect_uri?: string | undefined + request?: string | undefined + response_mode?: string | undefined + response_type?: string | undefined + scope?: string | undefined + sessionToken?: string | undefined + state?: string | undefined +} + +export type t_ParOptionsRequestHeaderSchema = { + origin?: string | undefined +} + +export type t_ParOptionsCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_ParOptionsCustomAsRequestHeaderSchema = { + origin?: string | undefined +} + +export type t_ReplaceClientParamSchema = { + clientId: string +} + +export type t_ReplaceClientRequestBodySchema = { + application_type?: t_ApplicationType | undefined + readonly client_id?: string | undefined + readonly client_id_issued_at?: number | undefined + client_name: string + readonly client_secret?: (string | null) | undefined + readonly client_secret_expires_at?: (number | null) | undefined + frontchannel_logout_session_required?: boolean | undefined + frontchannel_logout_uri?: (string | null) | undefined + grant_types?: t_GrantType[] | undefined + initiate_login_uri?: string | undefined + jwks?: + | { + keys?: t_JsonWebKey[] | undefined + } + | undefined + jwks_uri?: string | undefined + logo_uri?: (string | null) | undefined + policy_uri?: (string | null) | undefined + post_logout_redirect_uris?: string | undefined + redirect_uris?: string[] | undefined + request_object_signing_alg?: t_SigningAlgorithm[] | undefined + response_types?: t_ResponseType[] | undefined + token_endpoint_auth_method?: t_EndpointAuthMethod | undefined + tos_uri?: (string | null) | undefined +} + +export type t_RevokeRequestBodySchema = { + token: string + token_type_hint?: t_TokenTypeHintRevoke | undefined +} + +export type t_RevokeCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_RevokeCustomAsRequestBodySchema = { + token: string + token_type_hint?: t_TokenTypeHintRevoke | undefined +} + +export type t_TokenRequestBodySchema = { + grant_type?: t_GrantType | undefined +} + +export type t_TokenCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_TokenCustomAsRequestBodySchema = { + grant_type?: t_GrantType | undefined +} + +export type t_TokenOptionsRequestHeaderSchema = { + origin?: string | undefined +} + +export type t_TokenOptionsCustomAsParamSchema = { + authorizationServerId: string +} + +export type t_TokenOptionsCustomAsRequestHeaderSchema = { + origin?: string | undefined +} + +export type t_UserinfoCustomAsParamSchema = { + authorizationServerId: string +} diff --git a/integration-tests/typescript-express/src/generated/okta.oauth.yaml/schemas.ts b/integration-tests/typescript-express/src/generated/okta.oauth.yaml/schemas.ts new file mode 100644 index 000000000..0a532703a --- /dev/null +++ b/integration-tests/typescript-express/src/generated/okta.oauth.yaml/schemas.ts @@ -0,0 +1,433 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { z } from "zod" + +export const PermissiveBoolean = z.preprocess((value) => { + if (typeof value === "string" && (value === "true" || value === "false")) { + return value === "true" + } else if (typeof value === "number" && (value === 1 || value === 0)) { + return value === 1 + } + return value +}, z.boolean()) + +export const s_AcrValue = z.enum([ + "phr", + "phrh", + "urn:okta:loa:1fa:any", + "urn:okta:loa:1fa:pwd", + "urn:okta:loa:2fa:any", + "urn:okta:loa:2fa:any:ifpossible", +]) + +export const s_AmrValue = z.enum([ + "duo", + "email", + "fed", + "google_otp", + "kba", + "oath_otp", + "okta_verify", + "opt", + "pop", + "pwd", + "rsa", + "sms", + "symantec", + "tel", + "yubikey", +]) + +export const s_ApplicationType = z.enum(["browser", "native", "service", "web"]) + +export const s_BackchannelAuthorizeRequest = z.intersection( + z.object({ + binding_message: z.string().optional(), + id_token_hint: z.string(), + login_hint: z.string(), + request: z.string().optional(), + request_expiry: z.coerce.number().min(1).max(300).optional(), + scope: z.string(), + }), + z.record(z.unknown()), +) + +export const s_BackchannelAuthorizeResponse = z.object({ + auth_req_id: z.string().optional(), + expires_in: z.coerce.number().min(1).max(300).optional(), + interval: z.coerce.number().optional(), +}) + +export const s_BindingMethod = z.enum(["none", "prompt", "transfer"]) + +export const s_ChallengeType = z.enum([ + "http://auth0.com/oauth/grant-type/mfa-oob", + "http://auth0.com/oauth/grant-type/mfa-otp", +]) + +export const s_Channel = z.enum(["push", "sms", "voice"]) + +export const s_Claim = z.string() + +export const s_CodeChallengeMethod = z.enum(["S256"]) + +export const s_DeviceAuthorizeRequest = z.object({ + client_id: z.string().optional(), + scope: z.string().optional(), +}) + +export const s_DeviceAuthorizeResponse = z.object({ + device_code: z.string().optional(), + expires_in: z.coerce.number().optional(), + interval: z.coerce.number().optional(), + user_code: z.string().optional(), + verification_uri: z.string().optional(), + verification_uri_complete: z.string().optional(), +}) + +export const s_EndpointAuthMethod = z.enum([ + "client_secret_basic", + "client_secret_jwt", + "client_secret_post", + "none", + "private_key_jwt", +]) + +export const s_Error = z.object({ + errorCauses: z + .array(z.object({ errorSummary: z.string().optional() })) + .optional(), + errorCode: z.string().optional(), + errorId: z.string().optional(), + errorLink: z.string().optional(), + errorSummary: z.string().optional(), +}) + +export const s_GrantType = z.enum([ + "authorization_code", + "client_credentials", + "implicit", + "interaction_code", + "password", + "refresh_token", + "urn:ietf:params:oauth:grant-type:device_code", + "urn:ietf:params:oauth:grant-type:jwt-bearer", + "urn:ietf:params:oauth:grant-type:saml2-bearer", + "urn:ietf:params:oauth:grant-type:token-exchange", + "urn:openid:params:grant-type:ciba", + "urn:okta:params:oauth:grant-type:otp", + "urn:okta:params:oauth:grant-type:oob", + "http://auth0.com/oauth/grant-type/mfa-otp", + "http://auth0.com/oauth/grant-type/mfa-oob", +]) + +export const s_IntrospectionResponse = z.intersection( + z.object({ + active: PermissiveBoolean.optional(), + aud: z.string().optional(), + client_id: z.string().optional(), + device_id: z.string().optional(), + exp: z.coerce.number().optional(), + iat: z.coerce.number().optional(), + iss: z.string().optional(), + jti: z.string().optional(), + nbf: z.coerce.number().optional(), + scope: z.string().optional(), + sub: z.string().optional(), + token_type: z.string().optional(), + uid: z.string().optional(), + username: z.string().optional(), + }), + z.record(z.unknown()), +) + +export const s_JsonWebKeyStatus = z.enum(["ACTIVE", "INACTIVE"]) + +export const s_JsonWebKeyType = z.enum(["EC", "RSA"]) + +export const s_JsonWebKeyUse = z.enum(["enc", "sig"]) + +export const s_LogoutWithPost = z.object({ + id_token_hint: z.string(), + post_logout_redirect_uri: z.string().optional(), + state: z.string().optional(), +}) + +export const s_OAuthError = z.object({ + error: z.string().optional(), + error_description: z.string().optional(), +}) + +export const s_ParRequest = z.object({ + client_id: z.string().optional(), + code_challenge: z.string().optional(), + code_challenge_method: z.string().optional(), + display: z.string().optional(), + idp: z.string().optional(), + idp_scope: z.string().optional(), + login_hint: z.string().optional(), + max_age: z.coerce.number().optional(), + nonce: z.string().optional(), + prompt: z.string().optional(), + redirect_uri: z.string().optional(), + request: z.string().optional(), + response_mode: z.string().optional(), + response_type: z.string().optional(), + scope: z.string().optional(), + sessionToken: z.string().optional(), + state: z.string().optional(), +}) + +export const s_ParResponse = z.object({ + expires_in: z.coerce.number().optional(), + request_uri: z.string().optional(), +}) + +export const s_Prompt = z.enum([ + "consent", + "enroll_authenticator", + "login", + "login consent", + "none", +]) + +export const s_ResponseMode = z.enum([ + "form_post", + "fragment", + "okta_post_message", + "query", +]) + +export const s_ResponseType = z.enum(["code", "id_token", "none", "token"]) + +export const s_ResponseTypesSupported = z.enum([ + "code", + "code id_token", + "code id_token token", + "code token", + "id_token", + "id_token token", + "token", +]) + +export const s_Scope = z.string() + +export const s_SigningAlgorithm = z.enum([ + "ES256", + "ES384", + "ES512", + "HS256", + "HS384", + "HS512", + "RS256", + "RS384", + "RS512", +]) + +export const s_SubjectType = z.enum(["pairwise", "public"]) + +export const s_TokenDeliveryMode = z.enum(["poll"]) + +export const s_TokenResponseTokenType = z.enum(["Bearer", "N_A"]) + +export const s_TokenType = z.enum([ + "urn:ietf:params:oauth:token-type:access_token", + "urn:ietf:params:oauth:token-type:id_token", + "urn:ietf:params:oauth:token-type:jwt", + "urn:ietf:params:oauth:token-type:refresh_token", + "urn:ietf:params:oauth:token-type:saml1", + "urn:ietf:params:oauth:token-type:saml2", + "urn:okta:oauth:token-type:web_sso_token", + "urn:x-oath:params:oauth:token-type:device-secret", +]) + +export const s_TokenTypeHintIntrospect = z.enum([ + "access_token", + "device_secret", + "id_token", + "refresh_token", +]) + +export const s_TokenTypeHintRevoke = z.enum([ + "access_token", + "device_secret", + "refresh_token", +]) + +export const s_UserInfo = z.intersection( + z.object({ sub: z.string().optional() }), + z.record(z.unknown()), +) + +export const s_sub_id = z.object({ + format: z.enum(["opaque"]).optional(), + id: z.string().optional(), +}) + +export const s_AuthorizeWithPost = z.object({ + acr_values: z.intersection(s_AcrValue, z.string()).optional(), + client_id: z.string(), + code_challenge: z.string().optional(), + code_challenge_method: z + .intersection(s_CodeChallengeMethod, z.string()) + .optional(), + display: z.string().optional(), + enroll_amr_values: z.intersection(s_AmrValue, z.string()).optional(), + idp: z.string().optional(), + idp_scope: z.string().optional(), + login_hint: z.string().optional(), + max_age: z.coerce.number().optional(), + nonce: z.string().optional(), + prompt: z.intersection(s_Prompt, z.string()).optional(), + redirect_uri: z.string(), + request: z.string().optional(), + request_uri: z.string().optional(), + response_mode: z.intersection(s_ResponseMode, z.string()).optional(), + response_type: z.intersection(s_ResponseTypesSupported, z.string()), + scope: z.string(), + sessionToken: z.string().optional(), + state: z.string(), +}) + +export const s_ChallengeRequest = z.object({ + challenge_types_supported: z.array(s_ChallengeType).optional(), + channel_hint: s_Channel.optional(), + mfa_token: z.string(), +}) + +export const s_ChallengeResponse = z.object({ + binding_code: z.string().optional(), + binding_method: s_BindingMethod.optional(), + challenge_type: z.string().optional(), + channel: s_Channel.optional(), + expires_in: z.coerce.number().optional(), + interval: z.coerce.number().optional(), + oob_code: z.string().optional(), +}) + +export const s_GlobalTokenRevocationRequest = z.object({ + sub_id: s_sub_id.optional(), +}) + +export const s_IntrospectionRequest = z.object({ + token: z.string().optional(), + token_type_hint: s_TokenTypeHintIntrospect.optional(), +}) + +export const s_JsonWebKey = z.object({ + alg: s_SigningAlgorithm.optional(), + kid: z.string().optional(), + kty: s_JsonWebKeyType.optional(), + status: s_JsonWebKeyStatus.optional(), + use: s_JsonWebKeyUse.optional(), +}) + +export const s_OAuthMetadata = z.object({ + authorization_endpoint: z.string().optional(), + backchannel_authentication_request_signing_alg_values_supported: z + .array(s_SigningAlgorithm) + .optional(), + backchannel_token_delivery_modes_supported: z + .array(s_TokenDeliveryMode) + .optional(), + claims_supported: z.array(s_Claim).optional(), + code_challenge_methods_supported: z.array(s_CodeChallengeMethod).optional(), + device_authorization_endpoint: z.string().optional(), + dpop_signing_alg_values_supported: z + .array(z.enum(["ES256", "ES384", "ES512", "RS256", "RS384", "RS512"])) + .optional(), + end_session_endpoint: z.string().optional(), + grant_types_supported: z.array(s_GrantType).optional(), + introspection_endpoint: z.string().optional(), + introspection_endpoint_auth_methods_supported: z + .array(s_EndpointAuthMethod) + .optional(), + issuer: z.string().optional(), + jwks_uri: z.string().optional(), + pushed_authorization_request_endpoint: z.string().optional(), + registration_endpoint: z.string().optional(), + request_object_signing_alg_values_supported: z + .array(s_SigningAlgorithm) + .optional(), + request_parameter_supported: PermissiveBoolean.optional(), + response_modes_supported: z.array(s_ResponseMode).optional(), + response_types_supported: z.array(s_ResponseTypesSupported).optional(), + revocation_endpoint: z.string().optional(), + revocation_endpoint_auth_methods_supported: z + .array(s_EndpointAuthMethod) + .optional(), + scopes_supported: z.array(s_Scope).optional(), + subject_types_supported: z.array(s_SubjectType).optional(), + token_endpoint: z.string().optional(), + token_endpoint_auth_methods_supported: z + .array(s_EndpointAuthMethod) + .optional(), +}) + +export const s_OobAuthenticateRequest = z.object({ + channel_hint: s_Channel, + login_hint: z.string(), +}) + +export const s_OobAuthenticateResponse = z.object({ + binding_code: z.string().optional(), + binding_method: s_BindingMethod.optional(), + channel: s_Channel.optional(), + expires_in: z.coerce.number().optional(), + interval: z.coerce.number().optional(), + oob_code: z.string().optional(), +}) + +export const s_RevokeRequest = z.object({ + token: z.string(), + token_type_hint: s_TokenTypeHintRevoke.optional(), +}) + +export const s_TokenRequest = z.object({ grant_type: s_GrantType.optional() }) + +export const s_TokenResponse = z.object({ + access_token: z.string().optional(), + device_secret: z.string().optional(), + expires_in: z.coerce.number().optional(), + id_token: z.string().optional(), + issued_token_type: s_TokenType.optional(), + refresh_token: z.string().optional(), + scope: z.string().optional(), + token_type: s_TokenResponseTokenType.optional(), +}) + +export const s_Client = z.object({ + application_type: s_ApplicationType.optional(), + client_id: z.string().optional(), + client_id_issued_at: z.coerce.number().optional(), + client_name: z.string(), + client_secret: z.string().nullable().optional(), + client_secret_expires_at: z.coerce.number().min(0).nullable().optional(), + frontchannel_logout_session_required: PermissiveBoolean.optional(), + frontchannel_logout_uri: z.string().nullable().optional(), + grant_types: z.array(s_GrantType).optional(), + initiate_login_uri: z.string().optional(), + jwks: z.object({ keys: z.array(s_JsonWebKey).optional() }).optional(), + jwks_uri: z.string().optional(), + logo_uri: z.string().nullable().optional(), + policy_uri: z.string().nullable().optional(), + post_logout_redirect_uris: z.string().optional(), + redirect_uris: z.array(z.string()).optional(), + request_object_signing_alg: z.array(s_SigningAlgorithm).optional(), + response_types: z.array(s_ResponseType).optional(), + token_endpoint_auth_method: s_EndpointAuthMethod.optional(), + tos_uri: z.string().nullable().optional(), +}) + +export const s_OAuthKeys = z.object({ keys: z.array(s_JsonWebKey).optional() }) + +export const s_OidcMetadata = s_OAuthMetadata.merge( + z.object({ + id_token_signing_alg_values_supported: z + .array(s_SigningAlgorithm) + .optional(), + userinfo_endpoint: z.string().optional(), + }), +) diff --git a/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/generated.ts b/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/generated.ts new file mode 100644 index 000000000..89ce507b5 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/generated.ts @@ -0,0 +1,366 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_AddPetRequestBodySchema, + t_DeletePetParamSchema, + t_Error, + t_FindPetByIdParamSchema, + t_FindPetsQuerySchema, + t_Pet, +} from "./models" +import { s_Error, s_NewPet, s_Pet } from "./schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + ServerConfig, + SkipResponse, + StatusCode, + startServer, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type FindPetsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type FindPets = ( + params: Params, + respond: FindPetsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type AddPetResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type AddPet = ( + params: Params, + respond: AddPetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type FindPetByIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type FindPetById = ( + params: Params, + respond: FindPetByIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeletePetResponder = { + with204(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeletePet = ( + params: Params, + respond: DeletePetResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type Implementation = { + findPets: FindPets + addPet: AddPet + findPetById: FindPetById + deletePet: DeletePet +} + +export function createRouter(implementation: Implementation): Router { + const router = Router() + + const findPetsQuerySchema = z.object({ + tags: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), + limit: z.coerce.number().optional(), + }) + + const findPetsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_Pet)]], + s_Error, + ) + + // findPets + router.get( + `/pets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + findPetsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .findPets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(findPetsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const addPetRequestBodySchema = s_NewPet + + const addPetResponseBodyValidator = responseValidationFactory( + [["200", s_Pet]], + s_Error, + ) + + // addPet + router.post( + `/pets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + addPetRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .addPet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(addPetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const findPetByIdParamSchema = z.object({ id: z.coerce.number() }) + + const findPetByIdResponseBodyValidator = responseValidationFactory( + [["200", s_Pet]], + s_Error, + ) + + // findPetById + router.get( + `/pets/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + findPetByIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .findPetById(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(findPetByIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deletePetParamSchema = z.object({ id: z.coerce.number() }) + + const deletePetResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + s_Error, + ) + + // deletePet + router.delete( + `/pets/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deletePetParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deletePet(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deletePetResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export async function bootstrap(config: ServerConfig) { + // Swagger Petstore + return startServer(config) +} diff --git a/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/models.ts b/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/models.ts new file mode 100644 index 000000000..1b273e904 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/models.ts @@ -0,0 +1,35 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type t_Error = { + code: number + message: string +} + +export type t_NewPet = { + name: string + tag?: string | undefined +} + +export type t_Pet = t_NewPet & { + id: number +} + +export type t_AddPetRequestBodySchema = { + name: string + tag?: string | undefined +} + +export type t_DeletePetParamSchema = { + id: number +} + +export type t_FindPetByIdParamSchema = { + id: number +} + +export type t_FindPetsQuerySchema = { + limit?: number | undefined + tags?: string[] | undefined +} diff --git a/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/schemas.ts b/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/schemas.ts new file mode 100644 index 000000000..91607d6ae --- /dev/null +++ b/integration-tests/typescript-express/src/generated/petstore-expanded.yaml/schemas.ts @@ -0,0 +1,17 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { z } from "zod" + +export const s_Error = z.object({ + code: z.coerce.number(), + message: z.string(), +}) + +export const s_NewPet = z.object({ + name: z.string(), + tag: z.string().optional(), +}) + +export const s_Pet = s_NewPet.merge(z.object({ id: z.coerce.number() })) diff --git a/integration-tests/typescript-express/src/generated/stripe.yaml/generated.ts b/integration-tests/typescript-express/src/generated/stripe.yaml/generated.ts new file mode 100644 index 000000000..83deb2434 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/stripe.yaml/generated.ts @@ -0,0 +1,86717 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_DeleteAccountsAccountBankAccountsIdParamSchema, + t_DeleteAccountsAccountBankAccountsIdRequestBodySchema, + t_DeleteAccountsAccountExternalAccountsIdParamSchema, + t_DeleteAccountsAccountExternalAccountsIdRequestBodySchema, + t_DeleteAccountsAccountParamSchema, + t_DeleteAccountsAccountPeoplePersonParamSchema, + t_DeleteAccountsAccountPeoplePersonRequestBodySchema, + t_DeleteAccountsAccountPersonsPersonParamSchema, + t_DeleteAccountsAccountPersonsPersonRequestBodySchema, + t_DeleteAccountsAccountRequestBodySchema, + t_DeleteApplePayDomainsDomainParamSchema, + t_DeleteApplePayDomainsDomainRequestBodySchema, + t_DeleteCouponsCouponParamSchema, + t_DeleteCouponsCouponRequestBodySchema, + t_DeleteCustomersCustomerBankAccountsIdParamSchema, + t_DeleteCustomersCustomerBankAccountsIdRequestBodySchema, + t_DeleteCustomersCustomerCardsIdParamSchema, + t_DeleteCustomersCustomerCardsIdRequestBodySchema, + t_DeleteCustomersCustomerDiscountParamSchema, + t_DeleteCustomersCustomerDiscountRequestBodySchema, + t_DeleteCustomersCustomerParamSchema, + t_DeleteCustomersCustomerRequestBodySchema, + t_DeleteCustomersCustomerSourcesIdParamSchema, + t_DeleteCustomersCustomerSourcesIdRequestBodySchema, + t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema, + t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema, + t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema, + t_DeleteCustomersCustomerTaxIdsIdParamSchema, + t_DeleteCustomersCustomerTaxIdsIdRequestBodySchema, + t_DeleteEphemeralKeysKeyParamSchema, + t_DeleteEphemeralKeysKeyRequestBodySchema, + t_DeleteInvoiceitemsInvoiceitemParamSchema, + t_DeleteInvoiceitemsInvoiceitemRequestBodySchema, + t_DeleteInvoicesInvoiceParamSchema, + t_DeleteInvoicesInvoiceRequestBodySchema, + t_DeletePlansPlanParamSchema, + t_DeletePlansPlanRequestBodySchema, + t_DeleteProductsIdParamSchema, + t_DeleteProductsIdRequestBodySchema, + t_DeleteProductsProductFeaturesIdParamSchema, + t_DeleteProductsProductFeaturesIdRequestBodySchema, + t_DeleteRadarValueListItemsItemParamSchema, + t_DeleteRadarValueListItemsItemRequestBodySchema, + t_DeleteRadarValueListsValueListParamSchema, + t_DeleteRadarValueListsValueListRequestBodySchema, + t_DeleteSubscriptionItemsItemParamSchema, + t_DeleteSubscriptionItemsItemRequestBodySchema, + t_DeleteSubscriptionsSubscriptionExposedIdDiscountParamSchema, + t_DeleteSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema, + t_DeleteSubscriptionsSubscriptionExposedIdParamSchema, + t_DeleteSubscriptionsSubscriptionExposedIdRequestBodySchema, + t_DeleteTaxIdsIdParamSchema, + t_DeleteTaxIdsIdRequestBodySchema, + t_DeleteTerminalConfigurationsConfigurationParamSchema, + t_DeleteTerminalConfigurationsConfigurationRequestBodySchema, + t_DeleteTerminalLocationsLocationParamSchema, + t_DeleteTerminalLocationsLocationRequestBodySchema, + t_DeleteTerminalReadersReaderParamSchema, + t_DeleteTerminalReadersReaderRequestBodySchema, + t_DeleteTestHelpersTestClocksTestClockParamSchema, + t_DeleteTestHelpersTestClocksTestClockRequestBodySchema, + t_DeleteWebhookEndpointsWebhookEndpointParamSchema, + t_DeleteWebhookEndpointsWebhookEndpointRequestBodySchema, + t_GetAccountQuerySchema, + t_GetAccountRequestBodySchema, + t_GetAccountsAccountBankAccountsIdParamSchema, + t_GetAccountsAccountBankAccountsIdQuerySchema, + t_GetAccountsAccountBankAccountsIdRequestBodySchema, + t_GetAccountsAccountCapabilitiesCapabilityParamSchema, + t_GetAccountsAccountCapabilitiesCapabilityQuerySchema, + t_GetAccountsAccountCapabilitiesCapabilityRequestBodySchema, + t_GetAccountsAccountCapabilitiesParamSchema, + t_GetAccountsAccountCapabilitiesQuerySchema, + t_GetAccountsAccountCapabilitiesRequestBodySchema, + t_GetAccountsAccountExternalAccountsIdParamSchema, + t_GetAccountsAccountExternalAccountsIdQuerySchema, + t_GetAccountsAccountExternalAccountsIdRequestBodySchema, + t_GetAccountsAccountExternalAccountsParamSchema, + t_GetAccountsAccountExternalAccountsQuerySchema, + t_GetAccountsAccountExternalAccountsRequestBodySchema, + t_GetAccountsAccountParamSchema, + t_GetAccountsAccountPeopleParamSchema, + t_GetAccountsAccountPeoplePersonParamSchema, + t_GetAccountsAccountPeoplePersonQuerySchema, + t_GetAccountsAccountPeoplePersonRequestBodySchema, + t_GetAccountsAccountPeopleQuerySchema, + t_GetAccountsAccountPeopleRequestBodySchema, + t_GetAccountsAccountPersonsParamSchema, + t_GetAccountsAccountPersonsPersonParamSchema, + t_GetAccountsAccountPersonsPersonQuerySchema, + t_GetAccountsAccountPersonsPersonRequestBodySchema, + t_GetAccountsAccountPersonsQuerySchema, + t_GetAccountsAccountPersonsRequestBodySchema, + t_GetAccountsAccountQuerySchema, + t_GetAccountsAccountRequestBodySchema, + t_GetAccountsQuerySchema, + t_GetAccountsRequestBodySchema, + t_GetApplePayDomainsDomainParamSchema, + t_GetApplePayDomainsDomainQuerySchema, + t_GetApplePayDomainsDomainRequestBodySchema, + t_GetApplePayDomainsQuerySchema, + t_GetApplePayDomainsRequestBodySchema, + t_GetApplicationFeesFeeRefundsIdParamSchema, + t_GetApplicationFeesFeeRefundsIdQuerySchema, + t_GetApplicationFeesFeeRefundsIdRequestBodySchema, + t_GetApplicationFeesIdParamSchema, + t_GetApplicationFeesIdQuerySchema, + t_GetApplicationFeesIdRefundsParamSchema, + t_GetApplicationFeesIdRefundsQuerySchema, + t_GetApplicationFeesIdRefundsRequestBodySchema, + t_GetApplicationFeesIdRequestBodySchema, + t_GetApplicationFeesQuerySchema, + t_GetApplicationFeesRequestBodySchema, + t_GetAppsSecretsFindQuerySchema, + t_GetAppsSecretsFindRequestBodySchema, + t_GetAppsSecretsQuerySchema, + t_GetAppsSecretsRequestBodySchema, + t_GetBalanceHistoryIdParamSchema, + t_GetBalanceHistoryIdQuerySchema, + t_GetBalanceHistoryIdRequestBodySchema, + t_GetBalanceHistoryQuerySchema, + t_GetBalanceHistoryRequestBodySchema, + t_GetBalanceQuerySchema, + t_GetBalanceRequestBodySchema, + t_GetBalanceTransactionsIdParamSchema, + t_GetBalanceTransactionsIdQuerySchema, + t_GetBalanceTransactionsIdRequestBodySchema, + t_GetBalanceTransactionsQuerySchema, + t_GetBalanceTransactionsRequestBodySchema, + t_GetBillingAlertsIdParamSchema, + t_GetBillingAlertsIdQuerySchema, + t_GetBillingAlertsIdRequestBodySchema, + t_GetBillingAlertsQuerySchema, + t_GetBillingAlertsRequestBodySchema, + t_GetBillingCreditBalanceSummaryQuerySchema, + t_GetBillingCreditBalanceSummaryRequestBodySchema, + t_GetBillingCreditBalanceTransactionsIdParamSchema, + t_GetBillingCreditBalanceTransactionsIdQuerySchema, + t_GetBillingCreditBalanceTransactionsIdRequestBodySchema, + t_GetBillingCreditBalanceTransactionsQuerySchema, + t_GetBillingCreditBalanceTransactionsRequestBodySchema, + t_GetBillingCreditGrantsIdParamSchema, + t_GetBillingCreditGrantsIdQuerySchema, + t_GetBillingCreditGrantsIdRequestBodySchema, + t_GetBillingCreditGrantsQuerySchema, + t_GetBillingCreditGrantsRequestBodySchema, + t_GetBillingMetersIdEventSummariesParamSchema, + t_GetBillingMetersIdEventSummariesQuerySchema, + t_GetBillingMetersIdEventSummariesRequestBodySchema, + t_GetBillingMetersIdParamSchema, + t_GetBillingMetersIdQuerySchema, + t_GetBillingMetersIdRequestBodySchema, + t_GetBillingMetersQuerySchema, + t_GetBillingMetersRequestBodySchema, + t_GetBillingPortalConfigurationsConfigurationParamSchema, + t_GetBillingPortalConfigurationsConfigurationQuerySchema, + t_GetBillingPortalConfigurationsConfigurationRequestBodySchema, + t_GetBillingPortalConfigurationsQuerySchema, + t_GetBillingPortalConfigurationsRequestBodySchema, + t_GetChargesChargeDisputeParamSchema, + t_GetChargesChargeDisputeQuerySchema, + t_GetChargesChargeDisputeRequestBodySchema, + t_GetChargesChargeParamSchema, + t_GetChargesChargeQuerySchema, + t_GetChargesChargeRefundsParamSchema, + t_GetChargesChargeRefundsQuerySchema, + t_GetChargesChargeRefundsRefundParamSchema, + t_GetChargesChargeRefundsRefundQuerySchema, + t_GetChargesChargeRefundsRefundRequestBodySchema, + t_GetChargesChargeRefundsRequestBodySchema, + t_GetChargesChargeRequestBodySchema, + t_GetChargesQuerySchema, + t_GetChargesRequestBodySchema, + t_GetChargesSearchQuerySchema, + t_GetChargesSearchRequestBodySchema, + t_GetCheckoutSessionsQuerySchema, + t_GetCheckoutSessionsRequestBodySchema, + t_GetCheckoutSessionsSessionLineItemsParamSchema, + t_GetCheckoutSessionsSessionLineItemsQuerySchema, + t_GetCheckoutSessionsSessionLineItemsRequestBodySchema, + t_GetCheckoutSessionsSessionParamSchema, + t_GetCheckoutSessionsSessionQuerySchema, + t_GetCheckoutSessionsSessionRequestBodySchema, + t_GetClimateOrdersOrderParamSchema, + t_GetClimateOrdersOrderQuerySchema, + t_GetClimateOrdersOrderRequestBodySchema, + t_GetClimateOrdersQuerySchema, + t_GetClimateOrdersRequestBodySchema, + t_GetClimateProductsProductParamSchema, + t_GetClimateProductsProductQuerySchema, + t_GetClimateProductsProductRequestBodySchema, + t_GetClimateProductsQuerySchema, + t_GetClimateProductsRequestBodySchema, + t_GetClimateSuppliersQuerySchema, + t_GetClimateSuppliersRequestBodySchema, + t_GetClimateSuppliersSupplierParamSchema, + t_GetClimateSuppliersSupplierQuerySchema, + t_GetClimateSuppliersSupplierRequestBodySchema, + t_GetConfirmationTokensConfirmationTokenParamSchema, + t_GetConfirmationTokensConfirmationTokenQuerySchema, + t_GetConfirmationTokensConfirmationTokenRequestBodySchema, + t_GetCountrySpecsCountryParamSchema, + t_GetCountrySpecsCountryQuerySchema, + t_GetCountrySpecsCountryRequestBodySchema, + t_GetCountrySpecsQuerySchema, + t_GetCountrySpecsRequestBodySchema, + t_GetCouponsCouponParamSchema, + t_GetCouponsCouponQuerySchema, + t_GetCouponsCouponRequestBodySchema, + t_GetCouponsQuerySchema, + t_GetCouponsRequestBodySchema, + t_GetCreditNotesCreditNoteLinesParamSchema, + t_GetCreditNotesCreditNoteLinesQuerySchema, + t_GetCreditNotesCreditNoteLinesRequestBodySchema, + t_GetCreditNotesIdParamSchema, + t_GetCreditNotesIdQuerySchema, + t_GetCreditNotesIdRequestBodySchema, + t_GetCreditNotesPreviewLinesQuerySchema, + t_GetCreditNotesPreviewLinesRequestBodySchema, + t_GetCreditNotesPreviewQuerySchema, + t_GetCreditNotesPreviewRequestBodySchema, + t_GetCreditNotesQuerySchema, + t_GetCreditNotesRequestBodySchema, + t_GetCustomersCustomerBalanceTransactionsParamSchema, + t_GetCustomersCustomerBalanceTransactionsQuerySchema, + t_GetCustomersCustomerBalanceTransactionsRequestBodySchema, + t_GetCustomersCustomerBalanceTransactionsTransactionParamSchema, + t_GetCustomersCustomerBalanceTransactionsTransactionQuerySchema, + t_GetCustomersCustomerBalanceTransactionsTransactionRequestBodySchema, + t_GetCustomersCustomerBankAccountsIdParamSchema, + t_GetCustomersCustomerBankAccountsIdQuerySchema, + t_GetCustomersCustomerBankAccountsIdRequestBodySchema, + t_GetCustomersCustomerBankAccountsParamSchema, + t_GetCustomersCustomerBankAccountsQuerySchema, + t_GetCustomersCustomerBankAccountsRequestBodySchema, + t_GetCustomersCustomerCardsIdParamSchema, + t_GetCustomersCustomerCardsIdQuerySchema, + t_GetCustomersCustomerCardsIdRequestBodySchema, + t_GetCustomersCustomerCardsParamSchema, + t_GetCustomersCustomerCardsQuerySchema, + t_GetCustomersCustomerCardsRequestBodySchema, + t_GetCustomersCustomerCashBalanceParamSchema, + t_GetCustomersCustomerCashBalanceQuerySchema, + t_GetCustomersCustomerCashBalanceRequestBodySchema, + t_GetCustomersCustomerCashBalanceTransactionsParamSchema, + t_GetCustomersCustomerCashBalanceTransactionsQuerySchema, + t_GetCustomersCustomerCashBalanceTransactionsRequestBodySchema, + t_GetCustomersCustomerCashBalanceTransactionsTransactionParamSchema, + t_GetCustomersCustomerCashBalanceTransactionsTransactionQuerySchema, + t_GetCustomersCustomerCashBalanceTransactionsTransactionRequestBodySchema, + t_GetCustomersCustomerDiscountParamSchema, + t_GetCustomersCustomerDiscountQuerySchema, + t_GetCustomersCustomerDiscountRequestBodySchema, + t_GetCustomersCustomerParamSchema, + t_GetCustomersCustomerPaymentMethodsParamSchema, + t_GetCustomersCustomerPaymentMethodsPaymentMethodParamSchema, + t_GetCustomersCustomerPaymentMethodsPaymentMethodQuerySchema, + t_GetCustomersCustomerPaymentMethodsPaymentMethodRequestBodySchema, + t_GetCustomersCustomerPaymentMethodsQuerySchema, + t_GetCustomersCustomerPaymentMethodsRequestBodySchema, + t_GetCustomersCustomerQuerySchema, + t_GetCustomersCustomerRequestBodySchema, + t_GetCustomersCustomerSourcesIdParamSchema, + t_GetCustomersCustomerSourcesIdQuerySchema, + t_GetCustomersCustomerSourcesIdRequestBodySchema, + t_GetCustomersCustomerSourcesParamSchema, + t_GetCustomersCustomerSourcesQuerySchema, + t_GetCustomersCustomerSourcesRequestBodySchema, + t_GetCustomersCustomerSubscriptionsParamSchema, + t_GetCustomersCustomerSubscriptionsQuerySchema, + t_GetCustomersCustomerSubscriptionsRequestBodySchema, + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema, + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema, + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema, + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema, + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema, + t_GetCustomersCustomerTaxIdsIdParamSchema, + t_GetCustomersCustomerTaxIdsIdQuerySchema, + t_GetCustomersCustomerTaxIdsIdRequestBodySchema, + t_GetCustomersCustomerTaxIdsParamSchema, + t_GetCustomersCustomerTaxIdsQuerySchema, + t_GetCustomersCustomerTaxIdsRequestBodySchema, + t_GetCustomersQuerySchema, + t_GetCustomersRequestBodySchema, + t_GetCustomersSearchQuerySchema, + t_GetCustomersSearchRequestBodySchema, + t_GetDisputesDisputeParamSchema, + t_GetDisputesDisputeQuerySchema, + t_GetDisputesDisputeRequestBodySchema, + t_GetDisputesQuerySchema, + t_GetDisputesRequestBodySchema, + t_GetEntitlementsActiveEntitlementsIdParamSchema, + t_GetEntitlementsActiveEntitlementsIdQuerySchema, + t_GetEntitlementsActiveEntitlementsIdRequestBodySchema, + t_GetEntitlementsActiveEntitlementsQuerySchema, + t_GetEntitlementsActiveEntitlementsRequestBodySchema, + t_GetEntitlementsFeaturesIdParamSchema, + t_GetEntitlementsFeaturesIdQuerySchema, + t_GetEntitlementsFeaturesIdRequestBodySchema, + t_GetEntitlementsFeaturesQuerySchema, + t_GetEntitlementsFeaturesRequestBodySchema, + t_GetEventsIdParamSchema, + t_GetEventsIdQuerySchema, + t_GetEventsIdRequestBodySchema, + t_GetEventsQuerySchema, + t_GetEventsRequestBodySchema, + t_GetExchangeRatesQuerySchema, + t_GetExchangeRatesRateIdParamSchema, + t_GetExchangeRatesRateIdQuerySchema, + t_GetExchangeRatesRateIdRequestBodySchema, + t_GetExchangeRatesRequestBodySchema, + t_GetFileLinksLinkParamSchema, + t_GetFileLinksLinkQuerySchema, + t_GetFileLinksLinkRequestBodySchema, + t_GetFileLinksQuerySchema, + t_GetFileLinksRequestBodySchema, + t_GetFilesFileParamSchema, + t_GetFilesFileQuerySchema, + t_GetFilesFileRequestBodySchema, + t_GetFilesQuerySchema, + t_GetFilesRequestBodySchema, + t_GetFinancialConnectionsAccountsAccountOwnersParamSchema, + t_GetFinancialConnectionsAccountsAccountOwnersQuerySchema, + t_GetFinancialConnectionsAccountsAccountOwnersRequestBodySchema, + t_GetFinancialConnectionsAccountsAccountParamSchema, + t_GetFinancialConnectionsAccountsAccountQuerySchema, + t_GetFinancialConnectionsAccountsAccountRequestBodySchema, + t_GetFinancialConnectionsAccountsQuerySchema, + t_GetFinancialConnectionsAccountsRequestBodySchema, + t_GetFinancialConnectionsSessionsSessionParamSchema, + t_GetFinancialConnectionsSessionsSessionQuerySchema, + t_GetFinancialConnectionsSessionsSessionRequestBodySchema, + t_GetFinancialConnectionsTransactionsQuerySchema, + t_GetFinancialConnectionsTransactionsRequestBodySchema, + t_GetFinancialConnectionsTransactionsTransactionParamSchema, + t_GetFinancialConnectionsTransactionsTransactionQuerySchema, + t_GetFinancialConnectionsTransactionsTransactionRequestBodySchema, + t_GetForwardingRequestsIdParamSchema, + t_GetForwardingRequestsIdQuerySchema, + t_GetForwardingRequestsIdRequestBodySchema, + t_GetForwardingRequestsQuerySchema, + t_GetForwardingRequestsRequestBodySchema, + t_GetIdentityVerificationReportsQuerySchema, + t_GetIdentityVerificationReportsReportParamSchema, + t_GetIdentityVerificationReportsReportQuerySchema, + t_GetIdentityVerificationReportsReportRequestBodySchema, + t_GetIdentityVerificationReportsRequestBodySchema, + t_GetIdentityVerificationSessionsQuerySchema, + t_GetIdentityVerificationSessionsRequestBodySchema, + t_GetIdentityVerificationSessionsSessionParamSchema, + t_GetIdentityVerificationSessionsSessionQuerySchema, + t_GetIdentityVerificationSessionsSessionRequestBodySchema, + t_GetInvoicePaymentsInvoicePaymentParamSchema, + t_GetInvoicePaymentsInvoicePaymentQuerySchema, + t_GetInvoicePaymentsInvoicePaymentRequestBodySchema, + t_GetInvoicePaymentsQuerySchema, + t_GetInvoicePaymentsRequestBodySchema, + t_GetInvoiceRenderingTemplatesQuerySchema, + t_GetInvoiceRenderingTemplatesRequestBodySchema, + t_GetInvoiceRenderingTemplatesTemplateParamSchema, + t_GetInvoiceRenderingTemplatesTemplateQuerySchema, + t_GetInvoiceRenderingTemplatesTemplateRequestBodySchema, + t_GetInvoiceitemsInvoiceitemParamSchema, + t_GetInvoiceitemsInvoiceitemQuerySchema, + t_GetInvoiceitemsInvoiceitemRequestBodySchema, + t_GetInvoiceitemsQuerySchema, + t_GetInvoiceitemsRequestBodySchema, + t_GetInvoicesInvoiceLinesParamSchema, + t_GetInvoicesInvoiceLinesQuerySchema, + t_GetInvoicesInvoiceLinesRequestBodySchema, + t_GetInvoicesInvoiceParamSchema, + t_GetInvoicesInvoiceQuerySchema, + t_GetInvoicesInvoiceRequestBodySchema, + t_GetInvoicesQuerySchema, + t_GetInvoicesRequestBodySchema, + t_GetInvoicesSearchQuerySchema, + t_GetInvoicesSearchRequestBodySchema, + t_GetIssuingAuthorizationsAuthorizationParamSchema, + t_GetIssuingAuthorizationsAuthorizationQuerySchema, + t_GetIssuingAuthorizationsAuthorizationRequestBodySchema, + t_GetIssuingAuthorizationsQuerySchema, + t_GetIssuingAuthorizationsRequestBodySchema, + t_GetIssuingCardholdersCardholderParamSchema, + t_GetIssuingCardholdersCardholderQuerySchema, + t_GetIssuingCardholdersCardholderRequestBodySchema, + t_GetIssuingCardholdersQuerySchema, + t_GetIssuingCardholdersRequestBodySchema, + t_GetIssuingCardsCardParamSchema, + t_GetIssuingCardsCardQuerySchema, + t_GetIssuingCardsCardRequestBodySchema, + t_GetIssuingCardsQuerySchema, + t_GetIssuingCardsRequestBodySchema, + t_GetIssuingDisputesDisputeParamSchema, + t_GetIssuingDisputesDisputeQuerySchema, + t_GetIssuingDisputesDisputeRequestBodySchema, + t_GetIssuingDisputesQuerySchema, + t_GetIssuingDisputesRequestBodySchema, + t_GetIssuingPersonalizationDesignsPersonalizationDesignParamSchema, + t_GetIssuingPersonalizationDesignsPersonalizationDesignQuerySchema, + t_GetIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema, + t_GetIssuingPersonalizationDesignsQuerySchema, + t_GetIssuingPersonalizationDesignsRequestBodySchema, + t_GetIssuingPhysicalBundlesPhysicalBundleParamSchema, + t_GetIssuingPhysicalBundlesPhysicalBundleQuerySchema, + t_GetIssuingPhysicalBundlesPhysicalBundleRequestBodySchema, + t_GetIssuingPhysicalBundlesQuerySchema, + t_GetIssuingPhysicalBundlesRequestBodySchema, + t_GetIssuingSettlementsSettlementParamSchema, + t_GetIssuingSettlementsSettlementQuerySchema, + t_GetIssuingSettlementsSettlementRequestBodySchema, + t_GetIssuingTokensQuerySchema, + t_GetIssuingTokensRequestBodySchema, + t_GetIssuingTokensTokenParamSchema, + t_GetIssuingTokensTokenQuerySchema, + t_GetIssuingTokensTokenRequestBodySchema, + t_GetIssuingTransactionsQuerySchema, + t_GetIssuingTransactionsRequestBodySchema, + t_GetIssuingTransactionsTransactionParamSchema, + t_GetIssuingTransactionsTransactionQuerySchema, + t_GetIssuingTransactionsTransactionRequestBodySchema, + t_GetLinkAccountSessionsSessionParamSchema, + t_GetLinkAccountSessionsSessionQuerySchema, + t_GetLinkAccountSessionsSessionRequestBodySchema, + t_GetLinkedAccountsAccountOwnersParamSchema, + t_GetLinkedAccountsAccountOwnersQuerySchema, + t_GetLinkedAccountsAccountOwnersRequestBodySchema, + t_GetLinkedAccountsAccountParamSchema, + t_GetLinkedAccountsAccountQuerySchema, + t_GetLinkedAccountsAccountRequestBodySchema, + t_GetLinkedAccountsQuerySchema, + t_GetLinkedAccountsRequestBodySchema, + t_GetMandatesMandateParamSchema, + t_GetMandatesMandateQuerySchema, + t_GetMandatesMandateRequestBodySchema, + t_GetPaymentIntentsIntentParamSchema, + t_GetPaymentIntentsIntentQuerySchema, + t_GetPaymentIntentsIntentRequestBodySchema, + t_GetPaymentIntentsQuerySchema, + t_GetPaymentIntentsRequestBodySchema, + t_GetPaymentIntentsSearchQuerySchema, + t_GetPaymentIntentsSearchRequestBodySchema, + t_GetPaymentLinksPaymentLinkLineItemsParamSchema, + t_GetPaymentLinksPaymentLinkLineItemsQuerySchema, + t_GetPaymentLinksPaymentLinkLineItemsRequestBodySchema, + t_GetPaymentLinksPaymentLinkParamSchema, + t_GetPaymentLinksPaymentLinkQuerySchema, + t_GetPaymentLinksPaymentLinkRequestBodySchema, + t_GetPaymentLinksQuerySchema, + t_GetPaymentLinksRequestBodySchema, + t_GetPaymentMethodConfigurationsConfigurationParamSchema, + t_GetPaymentMethodConfigurationsConfigurationQuerySchema, + t_GetPaymentMethodConfigurationsConfigurationRequestBodySchema, + t_GetPaymentMethodConfigurationsQuerySchema, + t_GetPaymentMethodConfigurationsRequestBodySchema, + t_GetPaymentMethodDomainsPaymentMethodDomainParamSchema, + t_GetPaymentMethodDomainsPaymentMethodDomainQuerySchema, + t_GetPaymentMethodDomainsPaymentMethodDomainRequestBodySchema, + t_GetPaymentMethodDomainsQuerySchema, + t_GetPaymentMethodDomainsRequestBodySchema, + t_GetPaymentMethodsPaymentMethodParamSchema, + t_GetPaymentMethodsPaymentMethodQuerySchema, + t_GetPaymentMethodsPaymentMethodRequestBodySchema, + t_GetPaymentMethodsQuerySchema, + t_GetPaymentMethodsRequestBodySchema, + t_GetPayoutsPayoutParamSchema, + t_GetPayoutsPayoutQuerySchema, + t_GetPayoutsPayoutRequestBodySchema, + t_GetPayoutsQuerySchema, + t_GetPayoutsRequestBodySchema, + t_GetPlansPlanParamSchema, + t_GetPlansPlanQuerySchema, + t_GetPlansPlanRequestBodySchema, + t_GetPlansQuerySchema, + t_GetPlansRequestBodySchema, + t_GetPricesPriceParamSchema, + t_GetPricesPriceQuerySchema, + t_GetPricesPriceRequestBodySchema, + t_GetPricesQuerySchema, + t_GetPricesRequestBodySchema, + t_GetPricesSearchQuerySchema, + t_GetPricesSearchRequestBodySchema, + t_GetProductsIdParamSchema, + t_GetProductsIdQuerySchema, + t_GetProductsIdRequestBodySchema, + t_GetProductsProductFeaturesIdParamSchema, + t_GetProductsProductFeaturesIdQuerySchema, + t_GetProductsProductFeaturesIdRequestBodySchema, + t_GetProductsProductFeaturesParamSchema, + t_GetProductsProductFeaturesQuerySchema, + t_GetProductsProductFeaturesRequestBodySchema, + t_GetProductsQuerySchema, + t_GetProductsRequestBodySchema, + t_GetProductsSearchQuerySchema, + t_GetProductsSearchRequestBodySchema, + t_GetPromotionCodesPromotionCodeParamSchema, + t_GetPromotionCodesPromotionCodeQuerySchema, + t_GetPromotionCodesPromotionCodeRequestBodySchema, + t_GetPromotionCodesQuerySchema, + t_GetPromotionCodesRequestBodySchema, + t_GetQuotesQuerySchema, + t_GetQuotesQuoteComputedUpfrontLineItemsParamSchema, + t_GetQuotesQuoteComputedUpfrontLineItemsQuerySchema, + t_GetQuotesQuoteComputedUpfrontLineItemsRequestBodySchema, + t_GetQuotesQuoteLineItemsParamSchema, + t_GetQuotesQuoteLineItemsQuerySchema, + t_GetQuotesQuoteLineItemsRequestBodySchema, + t_GetQuotesQuoteParamSchema, + t_GetQuotesQuotePdfParamSchema, + t_GetQuotesQuotePdfQuerySchema, + t_GetQuotesQuotePdfRequestBodySchema, + t_GetQuotesQuoteQuerySchema, + t_GetQuotesQuoteRequestBodySchema, + t_GetQuotesRequestBodySchema, + t_GetRadarEarlyFraudWarningsEarlyFraudWarningParamSchema, + t_GetRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema, + t_GetRadarEarlyFraudWarningsEarlyFraudWarningRequestBodySchema, + t_GetRadarEarlyFraudWarningsQuerySchema, + t_GetRadarEarlyFraudWarningsRequestBodySchema, + t_GetRadarValueListItemsItemParamSchema, + t_GetRadarValueListItemsItemQuerySchema, + t_GetRadarValueListItemsItemRequestBodySchema, + t_GetRadarValueListItemsQuerySchema, + t_GetRadarValueListItemsRequestBodySchema, + t_GetRadarValueListsQuerySchema, + t_GetRadarValueListsRequestBodySchema, + t_GetRadarValueListsValueListParamSchema, + t_GetRadarValueListsValueListQuerySchema, + t_GetRadarValueListsValueListRequestBodySchema, + t_GetRefundsQuerySchema, + t_GetRefundsRefundParamSchema, + t_GetRefundsRefundQuerySchema, + t_GetRefundsRefundRequestBodySchema, + t_GetRefundsRequestBodySchema, + t_GetReportingReportRunsQuerySchema, + t_GetReportingReportRunsReportRunParamSchema, + t_GetReportingReportRunsReportRunQuerySchema, + t_GetReportingReportRunsReportRunRequestBodySchema, + t_GetReportingReportRunsRequestBodySchema, + t_GetReportingReportTypesQuerySchema, + t_GetReportingReportTypesReportTypeParamSchema, + t_GetReportingReportTypesReportTypeQuerySchema, + t_GetReportingReportTypesReportTypeRequestBodySchema, + t_GetReportingReportTypesRequestBodySchema, + t_GetReviewsQuerySchema, + t_GetReviewsRequestBodySchema, + t_GetReviewsReviewParamSchema, + t_GetReviewsReviewQuerySchema, + t_GetReviewsReviewRequestBodySchema, + t_GetSetupAttemptsQuerySchema, + t_GetSetupAttemptsRequestBodySchema, + t_GetSetupIntentsIntentParamSchema, + t_GetSetupIntentsIntentQuerySchema, + t_GetSetupIntentsIntentRequestBodySchema, + t_GetSetupIntentsQuerySchema, + t_GetSetupIntentsRequestBodySchema, + t_GetShippingRatesQuerySchema, + t_GetShippingRatesRequestBodySchema, + t_GetShippingRatesShippingRateTokenParamSchema, + t_GetShippingRatesShippingRateTokenQuerySchema, + t_GetShippingRatesShippingRateTokenRequestBodySchema, + t_GetSigmaScheduledQueryRunsQuerySchema, + t_GetSigmaScheduledQueryRunsRequestBodySchema, + t_GetSigmaScheduledQueryRunsScheduledQueryRunParamSchema, + t_GetSigmaScheduledQueryRunsScheduledQueryRunQuerySchema, + t_GetSigmaScheduledQueryRunsScheduledQueryRunRequestBodySchema, + t_GetSourcesSourceMandateNotificationsMandateNotificationParamSchema, + t_GetSourcesSourceMandateNotificationsMandateNotificationQuerySchema, + t_GetSourcesSourceMandateNotificationsMandateNotificationRequestBodySchema, + t_GetSourcesSourceParamSchema, + t_GetSourcesSourceQuerySchema, + t_GetSourcesSourceRequestBodySchema, + t_GetSourcesSourceSourceTransactionsParamSchema, + t_GetSourcesSourceSourceTransactionsQuerySchema, + t_GetSourcesSourceSourceTransactionsRequestBodySchema, + t_GetSourcesSourceSourceTransactionsSourceTransactionParamSchema, + t_GetSourcesSourceSourceTransactionsSourceTransactionQuerySchema, + t_GetSourcesSourceSourceTransactionsSourceTransactionRequestBodySchema, + t_GetSubscriptionItemsItemParamSchema, + t_GetSubscriptionItemsItemQuerySchema, + t_GetSubscriptionItemsItemRequestBodySchema, + t_GetSubscriptionItemsQuerySchema, + t_GetSubscriptionItemsRequestBodySchema, + t_GetSubscriptionSchedulesQuerySchema, + t_GetSubscriptionSchedulesRequestBodySchema, + t_GetSubscriptionSchedulesScheduleParamSchema, + t_GetSubscriptionSchedulesScheduleQuerySchema, + t_GetSubscriptionSchedulesScheduleRequestBodySchema, + t_GetSubscriptionsQuerySchema, + t_GetSubscriptionsRequestBodySchema, + t_GetSubscriptionsSearchQuerySchema, + t_GetSubscriptionsSearchRequestBodySchema, + t_GetSubscriptionsSubscriptionExposedIdParamSchema, + t_GetSubscriptionsSubscriptionExposedIdQuerySchema, + t_GetSubscriptionsSubscriptionExposedIdRequestBodySchema, + t_GetTaxCalculationsCalculationLineItemsParamSchema, + t_GetTaxCalculationsCalculationLineItemsQuerySchema, + t_GetTaxCalculationsCalculationLineItemsRequestBodySchema, + t_GetTaxCalculationsCalculationParamSchema, + t_GetTaxCalculationsCalculationQuerySchema, + t_GetTaxCalculationsCalculationRequestBodySchema, + t_GetTaxCodesIdParamSchema, + t_GetTaxCodesIdQuerySchema, + t_GetTaxCodesIdRequestBodySchema, + t_GetTaxCodesQuerySchema, + t_GetTaxCodesRequestBodySchema, + t_GetTaxIdsIdParamSchema, + t_GetTaxIdsIdQuerySchema, + t_GetTaxIdsIdRequestBodySchema, + t_GetTaxIdsQuerySchema, + t_GetTaxIdsRequestBodySchema, + t_GetTaxRatesQuerySchema, + t_GetTaxRatesRequestBodySchema, + t_GetTaxRatesTaxRateParamSchema, + t_GetTaxRatesTaxRateQuerySchema, + t_GetTaxRatesTaxRateRequestBodySchema, + t_GetTaxRegistrationsIdParamSchema, + t_GetTaxRegistrationsIdQuerySchema, + t_GetTaxRegistrationsIdRequestBodySchema, + t_GetTaxRegistrationsQuerySchema, + t_GetTaxRegistrationsRequestBodySchema, + t_GetTaxSettingsQuerySchema, + t_GetTaxSettingsRequestBodySchema, + t_GetTaxTransactionsTransactionLineItemsParamSchema, + t_GetTaxTransactionsTransactionLineItemsQuerySchema, + t_GetTaxTransactionsTransactionLineItemsRequestBodySchema, + t_GetTaxTransactionsTransactionParamSchema, + t_GetTaxTransactionsTransactionQuerySchema, + t_GetTaxTransactionsTransactionRequestBodySchema, + t_GetTerminalConfigurationsConfigurationParamSchema, + t_GetTerminalConfigurationsConfigurationQuerySchema, + t_GetTerminalConfigurationsConfigurationRequestBodySchema, + t_GetTerminalConfigurationsQuerySchema, + t_GetTerminalConfigurationsRequestBodySchema, + t_GetTerminalLocationsLocationParamSchema, + t_GetTerminalLocationsLocationQuerySchema, + t_GetTerminalLocationsLocationRequestBodySchema, + t_GetTerminalLocationsQuerySchema, + t_GetTerminalLocationsRequestBodySchema, + t_GetTerminalReadersQuerySchema, + t_GetTerminalReadersReaderParamSchema, + t_GetTerminalReadersReaderQuerySchema, + t_GetTerminalReadersReaderRequestBodySchema, + t_GetTerminalReadersRequestBodySchema, + t_GetTestHelpersTestClocksQuerySchema, + t_GetTestHelpersTestClocksRequestBodySchema, + t_GetTestHelpersTestClocksTestClockParamSchema, + t_GetTestHelpersTestClocksTestClockQuerySchema, + t_GetTestHelpersTestClocksTestClockRequestBodySchema, + t_GetTokensTokenParamSchema, + t_GetTokensTokenQuerySchema, + t_GetTokensTokenRequestBodySchema, + t_GetTopupsQuerySchema, + t_GetTopupsRequestBodySchema, + t_GetTopupsTopupParamSchema, + t_GetTopupsTopupQuerySchema, + t_GetTopupsTopupRequestBodySchema, + t_GetTransfersIdReversalsParamSchema, + t_GetTransfersIdReversalsQuerySchema, + t_GetTransfersIdReversalsRequestBodySchema, + t_GetTransfersQuerySchema, + t_GetTransfersRequestBodySchema, + t_GetTransfersTransferParamSchema, + t_GetTransfersTransferQuerySchema, + t_GetTransfersTransferRequestBodySchema, + t_GetTransfersTransferReversalsIdParamSchema, + t_GetTransfersTransferReversalsIdQuerySchema, + t_GetTransfersTransferReversalsIdRequestBodySchema, + t_GetTreasuryCreditReversalsCreditReversalParamSchema, + t_GetTreasuryCreditReversalsCreditReversalQuerySchema, + t_GetTreasuryCreditReversalsCreditReversalRequestBodySchema, + t_GetTreasuryCreditReversalsQuerySchema, + t_GetTreasuryCreditReversalsRequestBodySchema, + t_GetTreasuryDebitReversalsDebitReversalParamSchema, + t_GetTreasuryDebitReversalsDebitReversalQuerySchema, + t_GetTreasuryDebitReversalsDebitReversalRequestBodySchema, + t_GetTreasuryDebitReversalsQuerySchema, + t_GetTreasuryDebitReversalsRequestBodySchema, + t_GetTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema, + t_GetTreasuryFinancialAccountsFinancialAccountFeaturesQuerySchema, + t_GetTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema, + t_GetTreasuryFinancialAccountsFinancialAccountParamSchema, + t_GetTreasuryFinancialAccountsFinancialAccountQuerySchema, + t_GetTreasuryFinancialAccountsFinancialAccountRequestBodySchema, + t_GetTreasuryFinancialAccountsQuerySchema, + t_GetTreasuryFinancialAccountsRequestBodySchema, + t_GetTreasuryInboundTransfersIdParamSchema, + t_GetTreasuryInboundTransfersIdQuerySchema, + t_GetTreasuryInboundTransfersIdRequestBodySchema, + t_GetTreasuryInboundTransfersQuerySchema, + t_GetTreasuryInboundTransfersRequestBodySchema, + t_GetTreasuryOutboundPaymentsIdParamSchema, + t_GetTreasuryOutboundPaymentsIdQuerySchema, + t_GetTreasuryOutboundPaymentsIdRequestBodySchema, + t_GetTreasuryOutboundPaymentsQuerySchema, + t_GetTreasuryOutboundPaymentsRequestBodySchema, + t_GetTreasuryOutboundTransfersOutboundTransferParamSchema, + t_GetTreasuryOutboundTransfersOutboundTransferQuerySchema, + t_GetTreasuryOutboundTransfersOutboundTransferRequestBodySchema, + t_GetTreasuryOutboundTransfersQuerySchema, + t_GetTreasuryOutboundTransfersRequestBodySchema, + t_GetTreasuryReceivedCreditsIdParamSchema, + t_GetTreasuryReceivedCreditsIdQuerySchema, + t_GetTreasuryReceivedCreditsIdRequestBodySchema, + t_GetTreasuryReceivedCreditsQuerySchema, + t_GetTreasuryReceivedCreditsRequestBodySchema, + t_GetTreasuryReceivedDebitsIdParamSchema, + t_GetTreasuryReceivedDebitsIdQuerySchema, + t_GetTreasuryReceivedDebitsIdRequestBodySchema, + t_GetTreasuryReceivedDebitsQuerySchema, + t_GetTreasuryReceivedDebitsRequestBodySchema, + t_GetTreasuryTransactionEntriesIdParamSchema, + t_GetTreasuryTransactionEntriesIdQuerySchema, + t_GetTreasuryTransactionEntriesIdRequestBodySchema, + t_GetTreasuryTransactionEntriesQuerySchema, + t_GetTreasuryTransactionEntriesRequestBodySchema, + t_GetTreasuryTransactionsIdParamSchema, + t_GetTreasuryTransactionsIdQuerySchema, + t_GetTreasuryTransactionsIdRequestBodySchema, + t_GetTreasuryTransactionsQuerySchema, + t_GetTreasuryTransactionsRequestBodySchema, + t_GetWebhookEndpointsQuerySchema, + t_GetWebhookEndpointsRequestBodySchema, + t_GetWebhookEndpointsWebhookEndpointParamSchema, + t_GetWebhookEndpointsWebhookEndpointQuerySchema, + t_GetWebhookEndpointsWebhookEndpointRequestBodySchema, + t_PostAccountLinksRequestBodySchema, + t_PostAccountSessionsRequestBodySchema, + t_PostAccountsAccountBankAccountsIdParamSchema, + t_PostAccountsAccountBankAccountsIdRequestBodySchema, + t_PostAccountsAccountBankAccountsParamSchema, + t_PostAccountsAccountBankAccountsRequestBodySchema, + t_PostAccountsAccountCapabilitiesCapabilityParamSchema, + t_PostAccountsAccountCapabilitiesCapabilityRequestBodySchema, + t_PostAccountsAccountExternalAccountsIdParamSchema, + t_PostAccountsAccountExternalAccountsIdRequestBodySchema, + t_PostAccountsAccountExternalAccountsParamSchema, + t_PostAccountsAccountExternalAccountsRequestBodySchema, + t_PostAccountsAccountLoginLinksParamSchema, + t_PostAccountsAccountLoginLinksRequestBodySchema, + t_PostAccountsAccountParamSchema, + t_PostAccountsAccountPeopleParamSchema, + t_PostAccountsAccountPeoplePersonParamSchema, + t_PostAccountsAccountPeoplePersonRequestBodySchema, + t_PostAccountsAccountPeopleRequestBodySchema, + t_PostAccountsAccountPersonsParamSchema, + t_PostAccountsAccountPersonsPersonParamSchema, + t_PostAccountsAccountPersonsPersonRequestBodySchema, + t_PostAccountsAccountPersonsRequestBodySchema, + t_PostAccountsAccountRejectParamSchema, + t_PostAccountsAccountRejectRequestBodySchema, + t_PostAccountsAccountRequestBodySchema, + t_PostAccountsRequestBodySchema, + t_PostApplePayDomainsRequestBodySchema, + t_PostApplicationFeesFeeRefundsIdParamSchema, + t_PostApplicationFeesFeeRefundsIdRequestBodySchema, + t_PostApplicationFeesIdRefundParamSchema, + t_PostApplicationFeesIdRefundRequestBodySchema, + t_PostApplicationFeesIdRefundsParamSchema, + t_PostApplicationFeesIdRefundsRequestBodySchema, + t_PostAppsSecretsDeleteRequestBodySchema, + t_PostAppsSecretsRequestBodySchema, + t_PostBillingAlertsIdActivateParamSchema, + t_PostBillingAlertsIdActivateRequestBodySchema, + t_PostBillingAlertsIdArchiveParamSchema, + t_PostBillingAlertsIdArchiveRequestBodySchema, + t_PostBillingAlertsIdDeactivateParamSchema, + t_PostBillingAlertsIdDeactivateRequestBodySchema, + t_PostBillingAlertsRequestBodySchema, + t_PostBillingCreditGrantsIdExpireParamSchema, + t_PostBillingCreditGrantsIdExpireRequestBodySchema, + t_PostBillingCreditGrantsIdParamSchema, + t_PostBillingCreditGrantsIdRequestBodySchema, + t_PostBillingCreditGrantsIdVoidParamSchema, + t_PostBillingCreditGrantsIdVoidRequestBodySchema, + t_PostBillingCreditGrantsRequestBodySchema, + t_PostBillingMeterEventAdjustmentsRequestBodySchema, + t_PostBillingMeterEventsRequestBodySchema, + t_PostBillingMetersIdDeactivateParamSchema, + t_PostBillingMetersIdDeactivateRequestBodySchema, + t_PostBillingMetersIdParamSchema, + t_PostBillingMetersIdReactivateParamSchema, + t_PostBillingMetersIdReactivateRequestBodySchema, + t_PostBillingMetersIdRequestBodySchema, + t_PostBillingMetersRequestBodySchema, + t_PostBillingPortalConfigurationsConfigurationParamSchema, + t_PostBillingPortalConfigurationsConfigurationRequestBodySchema, + t_PostBillingPortalConfigurationsRequestBodySchema, + t_PostBillingPortalSessionsRequestBodySchema, + t_PostChargesChargeCaptureParamSchema, + t_PostChargesChargeCaptureRequestBodySchema, + t_PostChargesChargeDisputeCloseParamSchema, + t_PostChargesChargeDisputeCloseRequestBodySchema, + t_PostChargesChargeDisputeParamSchema, + t_PostChargesChargeDisputeRequestBodySchema, + t_PostChargesChargeParamSchema, + t_PostChargesChargeRefundParamSchema, + t_PostChargesChargeRefundRequestBodySchema, + t_PostChargesChargeRefundsParamSchema, + t_PostChargesChargeRefundsRefundParamSchema, + t_PostChargesChargeRefundsRefundRequestBodySchema, + t_PostChargesChargeRefundsRequestBodySchema, + t_PostChargesChargeRequestBodySchema, + t_PostChargesRequestBodySchema, + t_PostCheckoutSessionsRequestBodySchema, + t_PostCheckoutSessionsSessionExpireParamSchema, + t_PostCheckoutSessionsSessionExpireRequestBodySchema, + t_PostCheckoutSessionsSessionParamSchema, + t_PostCheckoutSessionsSessionRequestBodySchema, + t_PostClimateOrdersOrderCancelParamSchema, + t_PostClimateOrdersOrderCancelRequestBodySchema, + t_PostClimateOrdersOrderParamSchema, + t_PostClimateOrdersOrderRequestBodySchema, + t_PostClimateOrdersRequestBodySchema, + t_PostCouponsCouponParamSchema, + t_PostCouponsCouponRequestBodySchema, + t_PostCouponsRequestBodySchema, + t_PostCreditNotesIdParamSchema, + t_PostCreditNotesIdRequestBodySchema, + t_PostCreditNotesIdVoidParamSchema, + t_PostCreditNotesIdVoidRequestBodySchema, + t_PostCreditNotesRequestBodySchema, + t_PostCustomerSessionsRequestBodySchema, + t_PostCustomersCustomerBalanceTransactionsParamSchema, + t_PostCustomersCustomerBalanceTransactionsRequestBodySchema, + t_PostCustomersCustomerBalanceTransactionsTransactionParamSchema, + t_PostCustomersCustomerBalanceTransactionsTransactionRequestBodySchema, + t_PostCustomersCustomerBankAccountsIdParamSchema, + t_PostCustomersCustomerBankAccountsIdRequestBodySchema, + t_PostCustomersCustomerBankAccountsIdVerifyParamSchema, + t_PostCustomersCustomerBankAccountsIdVerifyRequestBodySchema, + t_PostCustomersCustomerBankAccountsParamSchema, + t_PostCustomersCustomerBankAccountsRequestBodySchema, + t_PostCustomersCustomerCardsIdParamSchema, + t_PostCustomersCustomerCardsIdRequestBodySchema, + t_PostCustomersCustomerCardsParamSchema, + t_PostCustomersCustomerCardsRequestBodySchema, + t_PostCustomersCustomerCashBalanceParamSchema, + t_PostCustomersCustomerCashBalanceRequestBodySchema, + t_PostCustomersCustomerFundingInstructionsParamSchema, + t_PostCustomersCustomerFundingInstructionsRequestBodySchema, + t_PostCustomersCustomerParamSchema, + t_PostCustomersCustomerRequestBodySchema, + t_PostCustomersCustomerSourcesIdParamSchema, + t_PostCustomersCustomerSourcesIdRequestBodySchema, + t_PostCustomersCustomerSourcesIdVerifyParamSchema, + t_PostCustomersCustomerSourcesIdVerifyRequestBodySchema, + t_PostCustomersCustomerSourcesParamSchema, + t_PostCustomersCustomerSourcesRequestBodySchema, + t_PostCustomersCustomerSubscriptionsParamSchema, + t_PostCustomersCustomerSubscriptionsRequestBodySchema, + t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema, + t_PostCustomersCustomerTaxIdsParamSchema, + t_PostCustomersCustomerTaxIdsRequestBodySchema, + t_PostCustomersRequestBodySchema, + t_PostDisputesDisputeCloseParamSchema, + t_PostDisputesDisputeCloseRequestBodySchema, + t_PostDisputesDisputeParamSchema, + t_PostDisputesDisputeRequestBodySchema, + t_PostEntitlementsFeaturesIdParamSchema, + t_PostEntitlementsFeaturesIdRequestBodySchema, + t_PostEntitlementsFeaturesRequestBodySchema, + t_PostEphemeralKeysRequestBodySchema, + t_PostExternalAccountsIdParamSchema, + t_PostExternalAccountsIdRequestBodySchema, + t_PostFileLinksLinkParamSchema, + t_PostFileLinksLinkRequestBodySchema, + t_PostFileLinksRequestBodySchema, + t_PostFilesRequestBodySchema, + t_PostFinancialConnectionsAccountsAccountDisconnectParamSchema, + t_PostFinancialConnectionsAccountsAccountDisconnectRequestBodySchema, + t_PostFinancialConnectionsAccountsAccountRefreshParamSchema, + t_PostFinancialConnectionsAccountsAccountRefreshRequestBodySchema, + t_PostFinancialConnectionsAccountsAccountSubscribeParamSchema, + t_PostFinancialConnectionsAccountsAccountSubscribeRequestBodySchema, + t_PostFinancialConnectionsAccountsAccountUnsubscribeParamSchema, + t_PostFinancialConnectionsAccountsAccountUnsubscribeRequestBodySchema, + t_PostFinancialConnectionsSessionsRequestBodySchema, + t_PostForwardingRequestsRequestBodySchema, + t_PostIdentityVerificationSessionsRequestBodySchema, + t_PostIdentityVerificationSessionsSessionCancelParamSchema, + t_PostIdentityVerificationSessionsSessionCancelRequestBodySchema, + t_PostIdentityVerificationSessionsSessionParamSchema, + t_PostIdentityVerificationSessionsSessionRedactParamSchema, + t_PostIdentityVerificationSessionsSessionRedactRequestBodySchema, + t_PostIdentityVerificationSessionsSessionRequestBodySchema, + t_PostInvoiceRenderingTemplatesTemplateArchiveParamSchema, + t_PostInvoiceRenderingTemplatesTemplateArchiveRequestBodySchema, + t_PostInvoiceRenderingTemplatesTemplateUnarchiveParamSchema, + t_PostInvoiceRenderingTemplatesTemplateUnarchiveRequestBodySchema, + t_PostInvoiceitemsInvoiceitemParamSchema, + t_PostInvoiceitemsInvoiceitemRequestBodySchema, + t_PostInvoiceitemsRequestBodySchema, + t_PostInvoicesCreatePreviewRequestBodySchema, + t_PostInvoicesInvoiceAddLinesParamSchema, + t_PostInvoicesInvoiceAddLinesRequestBodySchema, + t_PostInvoicesInvoiceFinalizeParamSchema, + t_PostInvoicesInvoiceFinalizeRequestBodySchema, + t_PostInvoicesInvoiceLinesLineItemIdParamSchema, + t_PostInvoicesInvoiceLinesLineItemIdRequestBodySchema, + t_PostInvoicesInvoiceMarkUncollectibleParamSchema, + t_PostInvoicesInvoiceMarkUncollectibleRequestBodySchema, + t_PostInvoicesInvoiceParamSchema, + t_PostInvoicesInvoicePayParamSchema, + t_PostInvoicesInvoicePayRequestBodySchema, + t_PostInvoicesInvoiceRemoveLinesParamSchema, + t_PostInvoicesInvoiceRemoveLinesRequestBodySchema, + t_PostInvoicesInvoiceRequestBodySchema, + t_PostInvoicesInvoiceSendParamSchema, + t_PostInvoicesInvoiceSendRequestBodySchema, + t_PostInvoicesInvoiceUpdateLinesParamSchema, + t_PostInvoicesInvoiceUpdateLinesRequestBodySchema, + t_PostInvoicesInvoiceVoidParamSchema, + t_PostInvoicesInvoiceVoidRequestBodySchema, + t_PostInvoicesRequestBodySchema, + t_PostIssuingAuthorizationsAuthorizationApproveParamSchema, + t_PostIssuingAuthorizationsAuthorizationApproveRequestBodySchema, + t_PostIssuingAuthorizationsAuthorizationDeclineParamSchema, + t_PostIssuingAuthorizationsAuthorizationDeclineRequestBodySchema, + t_PostIssuingAuthorizationsAuthorizationParamSchema, + t_PostIssuingAuthorizationsAuthorizationRequestBodySchema, + t_PostIssuingCardholdersCardholderParamSchema, + t_PostIssuingCardholdersCardholderRequestBodySchema, + t_PostIssuingCardholdersRequestBodySchema, + t_PostIssuingCardsCardParamSchema, + t_PostIssuingCardsCardRequestBodySchema, + t_PostIssuingCardsRequestBodySchema, + t_PostIssuingDisputesDisputeParamSchema, + t_PostIssuingDisputesDisputeRequestBodySchema, + t_PostIssuingDisputesDisputeSubmitParamSchema, + t_PostIssuingDisputesDisputeSubmitRequestBodySchema, + t_PostIssuingDisputesRequestBodySchema, + t_PostIssuingPersonalizationDesignsPersonalizationDesignParamSchema, + t_PostIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema, + t_PostIssuingPersonalizationDesignsRequestBodySchema, + t_PostIssuingSettlementsSettlementParamSchema, + t_PostIssuingSettlementsSettlementRequestBodySchema, + t_PostIssuingTokensTokenParamSchema, + t_PostIssuingTokensTokenRequestBodySchema, + t_PostIssuingTransactionsTransactionParamSchema, + t_PostIssuingTransactionsTransactionRequestBodySchema, + t_PostLinkAccountSessionsRequestBodySchema, + t_PostLinkedAccountsAccountDisconnectParamSchema, + t_PostLinkedAccountsAccountDisconnectRequestBodySchema, + t_PostLinkedAccountsAccountRefreshParamSchema, + t_PostLinkedAccountsAccountRefreshRequestBodySchema, + t_PostPaymentIntentsIntentApplyCustomerBalanceParamSchema, + t_PostPaymentIntentsIntentApplyCustomerBalanceRequestBodySchema, + t_PostPaymentIntentsIntentCancelParamSchema, + t_PostPaymentIntentsIntentCancelRequestBodySchema, + t_PostPaymentIntentsIntentCaptureParamSchema, + t_PostPaymentIntentsIntentCaptureRequestBodySchema, + t_PostPaymentIntentsIntentConfirmParamSchema, + t_PostPaymentIntentsIntentConfirmRequestBodySchema, + t_PostPaymentIntentsIntentIncrementAuthorizationParamSchema, + t_PostPaymentIntentsIntentIncrementAuthorizationRequestBodySchema, + t_PostPaymentIntentsIntentParamSchema, + t_PostPaymentIntentsIntentRequestBodySchema, + t_PostPaymentIntentsIntentVerifyMicrodepositsParamSchema, + t_PostPaymentIntentsIntentVerifyMicrodepositsRequestBodySchema, + t_PostPaymentIntentsRequestBodySchema, + t_PostPaymentLinksPaymentLinkParamSchema, + t_PostPaymentLinksPaymentLinkRequestBodySchema, + t_PostPaymentLinksRequestBodySchema, + t_PostPaymentMethodConfigurationsConfigurationParamSchema, + t_PostPaymentMethodConfigurationsConfigurationRequestBodySchema, + t_PostPaymentMethodConfigurationsRequestBodySchema, + t_PostPaymentMethodDomainsPaymentMethodDomainParamSchema, + t_PostPaymentMethodDomainsPaymentMethodDomainRequestBodySchema, + t_PostPaymentMethodDomainsPaymentMethodDomainValidateParamSchema, + t_PostPaymentMethodDomainsPaymentMethodDomainValidateRequestBodySchema, + t_PostPaymentMethodDomainsRequestBodySchema, + t_PostPaymentMethodsPaymentMethodAttachParamSchema, + t_PostPaymentMethodsPaymentMethodAttachRequestBodySchema, + t_PostPaymentMethodsPaymentMethodDetachParamSchema, + t_PostPaymentMethodsPaymentMethodDetachRequestBodySchema, + t_PostPaymentMethodsPaymentMethodParamSchema, + t_PostPaymentMethodsPaymentMethodRequestBodySchema, + t_PostPaymentMethodsRequestBodySchema, + t_PostPayoutsPayoutCancelParamSchema, + t_PostPayoutsPayoutCancelRequestBodySchema, + t_PostPayoutsPayoutParamSchema, + t_PostPayoutsPayoutRequestBodySchema, + t_PostPayoutsPayoutReverseParamSchema, + t_PostPayoutsPayoutReverseRequestBodySchema, + t_PostPayoutsRequestBodySchema, + t_PostPlansPlanParamSchema, + t_PostPlansPlanRequestBodySchema, + t_PostPlansRequestBodySchema, + t_PostPricesPriceParamSchema, + t_PostPricesPriceRequestBodySchema, + t_PostPricesRequestBodySchema, + t_PostProductsIdParamSchema, + t_PostProductsIdRequestBodySchema, + t_PostProductsProductFeaturesParamSchema, + t_PostProductsProductFeaturesRequestBodySchema, + t_PostProductsRequestBodySchema, + t_PostPromotionCodesPromotionCodeParamSchema, + t_PostPromotionCodesPromotionCodeRequestBodySchema, + t_PostPromotionCodesRequestBodySchema, + t_PostQuotesQuoteAcceptParamSchema, + t_PostQuotesQuoteAcceptRequestBodySchema, + t_PostQuotesQuoteCancelParamSchema, + t_PostQuotesQuoteCancelRequestBodySchema, + t_PostQuotesQuoteFinalizeParamSchema, + t_PostQuotesQuoteFinalizeRequestBodySchema, + t_PostQuotesQuoteParamSchema, + t_PostQuotesQuoteRequestBodySchema, + t_PostQuotesRequestBodySchema, + t_PostRadarValueListItemsRequestBodySchema, + t_PostRadarValueListsRequestBodySchema, + t_PostRadarValueListsValueListParamSchema, + t_PostRadarValueListsValueListRequestBodySchema, + t_PostRefundsRefundCancelParamSchema, + t_PostRefundsRefundCancelRequestBodySchema, + t_PostRefundsRefundParamSchema, + t_PostRefundsRefundRequestBodySchema, + t_PostRefundsRequestBodySchema, + t_PostReportingReportRunsRequestBodySchema, + t_PostReviewsReviewApproveParamSchema, + t_PostReviewsReviewApproveRequestBodySchema, + t_PostSetupIntentsIntentCancelParamSchema, + t_PostSetupIntentsIntentCancelRequestBodySchema, + t_PostSetupIntentsIntentConfirmParamSchema, + t_PostSetupIntentsIntentConfirmRequestBodySchema, + t_PostSetupIntentsIntentParamSchema, + t_PostSetupIntentsIntentRequestBodySchema, + t_PostSetupIntentsIntentVerifyMicrodepositsParamSchema, + t_PostSetupIntentsIntentVerifyMicrodepositsRequestBodySchema, + t_PostSetupIntentsRequestBodySchema, + t_PostShippingRatesRequestBodySchema, + t_PostShippingRatesShippingRateTokenParamSchema, + t_PostShippingRatesShippingRateTokenRequestBodySchema, + t_PostSigmaSavedQueriesIdParamSchema, + t_PostSigmaSavedQueriesIdRequestBodySchema, + t_PostSourcesRequestBodySchema, + t_PostSourcesSourceParamSchema, + t_PostSourcesSourceRequestBodySchema, + t_PostSourcesSourceVerifyParamSchema, + t_PostSourcesSourceVerifyRequestBodySchema, + t_PostSubscriptionItemsItemParamSchema, + t_PostSubscriptionItemsItemRequestBodySchema, + t_PostSubscriptionItemsRequestBodySchema, + t_PostSubscriptionSchedulesRequestBodySchema, + t_PostSubscriptionSchedulesScheduleCancelParamSchema, + t_PostSubscriptionSchedulesScheduleCancelRequestBodySchema, + t_PostSubscriptionSchedulesScheduleParamSchema, + t_PostSubscriptionSchedulesScheduleReleaseParamSchema, + t_PostSubscriptionSchedulesScheduleReleaseRequestBodySchema, + t_PostSubscriptionSchedulesScheduleRequestBodySchema, + t_PostSubscriptionsRequestBodySchema, + t_PostSubscriptionsSubscriptionExposedIdParamSchema, + t_PostSubscriptionsSubscriptionExposedIdRequestBodySchema, + t_PostSubscriptionsSubscriptionResumeParamSchema, + t_PostSubscriptionsSubscriptionResumeRequestBodySchema, + t_PostTaxCalculationsRequestBodySchema, + t_PostTaxIdsRequestBodySchema, + t_PostTaxRatesRequestBodySchema, + t_PostTaxRatesTaxRateParamSchema, + t_PostTaxRatesTaxRateRequestBodySchema, + t_PostTaxRegistrationsIdParamSchema, + t_PostTaxRegistrationsIdRequestBodySchema, + t_PostTaxRegistrationsRequestBodySchema, + t_PostTaxSettingsRequestBodySchema, + t_PostTaxTransactionsCreateFromCalculationRequestBodySchema, + t_PostTaxTransactionsCreateReversalRequestBodySchema, + t_PostTerminalConfigurationsConfigurationParamSchema, + t_PostTerminalConfigurationsConfigurationRequestBodySchema, + t_PostTerminalConfigurationsRequestBodySchema, + t_PostTerminalConnectionTokensRequestBodySchema, + t_PostTerminalLocationsLocationParamSchema, + t_PostTerminalLocationsLocationRequestBodySchema, + t_PostTerminalLocationsRequestBodySchema, + t_PostTerminalReadersReaderCancelActionParamSchema, + t_PostTerminalReadersReaderCancelActionRequestBodySchema, + t_PostTerminalReadersReaderParamSchema, + t_PostTerminalReadersReaderProcessPaymentIntentParamSchema, + t_PostTerminalReadersReaderProcessPaymentIntentRequestBodySchema, + t_PostTerminalReadersReaderProcessSetupIntentParamSchema, + t_PostTerminalReadersReaderProcessSetupIntentRequestBodySchema, + t_PostTerminalReadersReaderRefundPaymentParamSchema, + t_PostTerminalReadersReaderRefundPaymentRequestBodySchema, + t_PostTerminalReadersReaderRequestBodySchema, + t_PostTerminalReadersReaderSetReaderDisplayParamSchema, + t_PostTerminalReadersReaderSetReaderDisplayRequestBodySchema, + t_PostTerminalReadersRequestBodySchema, + t_PostTestHelpersConfirmationTokensRequestBodySchema, + t_PostTestHelpersCustomersCustomerFundCashBalanceParamSchema, + t_PostTestHelpersCustomersCustomerFundCashBalanceRequestBodySchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationCaptureParamSchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationCaptureRequestBodySchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationExpireParamSchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationExpireRequestBodySchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountRequestBodySchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondParamSchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondRequestBodySchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationIncrementParamSchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationIncrementRequestBodySchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationReverseParamSchema, + t_PostTestHelpersIssuingAuthorizationsAuthorizationReverseRequestBodySchema, + t_PostTestHelpersIssuingAuthorizationsRequestBodySchema, + t_PostTestHelpersIssuingCardsCardShippingDeliverParamSchema, + t_PostTestHelpersIssuingCardsCardShippingDeliverRequestBodySchema, + t_PostTestHelpersIssuingCardsCardShippingFailParamSchema, + t_PostTestHelpersIssuingCardsCardShippingFailRequestBodySchema, + t_PostTestHelpersIssuingCardsCardShippingReturnParamSchema, + t_PostTestHelpersIssuingCardsCardShippingReturnRequestBodySchema, + t_PostTestHelpersIssuingCardsCardShippingShipParamSchema, + t_PostTestHelpersIssuingCardsCardShippingShipRequestBodySchema, + t_PostTestHelpersIssuingCardsCardShippingSubmitParamSchema, + t_PostTestHelpersIssuingCardsCardShippingSubmitRequestBodySchema, + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateParamSchema, + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateRequestBodySchema, + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateParamSchema, + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateRequestBodySchema, + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectParamSchema, + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectRequestBodySchema, + t_PostTestHelpersIssuingSettlementsRequestBodySchema, + t_PostTestHelpersIssuingSettlementsSettlementCompleteParamSchema, + t_PostTestHelpersIssuingSettlementsSettlementCompleteRequestBodySchema, + t_PostTestHelpersIssuingTransactionsCreateForceCaptureRequestBodySchema, + t_PostTestHelpersIssuingTransactionsCreateUnlinkedRefundRequestBodySchema, + t_PostTestHelpersIssuingTransactionsTransactionRefundParamSchema, + t_PostTestHelpersIssuingTransactionsTransactionRefundRequestBodySchema, + t_PostTestHelpersRefundsRefundExpireParamSchema, + t_PostTestHelpersRefundsRefundExpireRequestBodySchema, + t_PostTestHelpersTerminalReadersReaderPresentPaymentMethodParamSchema, + t_PostTestHelpersTerminalReadersReaderPresentPaymentMethodRequestBodySchema, + t_PostTestHelpersTestClocksRequestBodySchema, + t_PostTestHelpersTestClocksTestClockAdvanceParamSchema, + t_PostTestHelpersTestClocksTestClockAdvanceRequestBodySchema, + t_PostTestHelpersTreasuryInboundTransfersIdFailParamSchema, + t_PostTestHelpersTreasuryInboundTransfersIdFailRequestBodySchema, + t_PostTestHelpersTreasuryInboundTransfersIdReturnParamSchema, + t_PostTestHelpersTreasuryInboundTransfersIdReturnRequestBodySchema, + t_PostTestHelpersTreasuryInboundTransfersIdSucceedParamSchema, + t_PostTestHelpersTreasuryInboundTransfersIdSucceedRequestBodySchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdFailParamSchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdFailRequestBodySchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdParamSchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdPostParamSchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdPostRequestBodySchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdRequestBodySchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdReturnParamSchema, + t_PostTestHelpersTreasuryOutboundPaymentsIdReturnRequestBodySchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailParamSchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailRequestBodySchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferPostParamSchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferPostRequestBodySchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferRequestBodySchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturnParamSchema, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturnRequestBodySchema, + t_PostTestHelpersTreasuryReceivedCreditsRequestBodySchema, + t_PostTestHelpersTreasuryReceivedDebitsRequestBodySchema, + t_PostTokensRequestBodySchema, + t_PostTopupsRequestBodySchema, + t_PostTopupsTopupCancelParamSchema, + t_PostTopupsTopupCancelRequestBodySchema, + t_PostTopupsTopupParamSchema, + t_PostTopupsTopupRequestBodySchema, + t_PostTransfersIdReversalsParamSchema, + t_PostTransfersIdReversalsRequestBodySchema, + t_PostTransfersRequestBodySchema, + t_PostTransfersTransferParamSchema, + t_PostTransfersTransferRequestBodySchema, + t_PostTransfersTransferReversalsIdParamSchema, + t_PostTransfersTransferReversalsIdRequestBodySchema, + t_PostTreasuryCreditReversalsRequestBodySchema, + t_PostTreasuryDebitReversalsRequestBodySchema, + t_PostTreasuryFinancialAccountsFinancialAccountCloseParamSchema, + t_PostTreasuryFinancialAccountsFinancialAccountCloseRequestBodySchema, + t_PostTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema, + t_PostTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema, + t_PostTreasuryFinancialAccountsFinancialAccountParamSchema, + t_PostTreasuryFinancialAccountsFinancialAccountRequestBodySchema, + t_PostTreasuryFinancialAccountsRequestBodySchema, + t_PostTreasuryInboundTransfersInboundTransferCancelParamSchema, + t_PostTreasuryInboundTransfersInboundTransferCancelRequestBodySchema, + t_PostTreasuryInboundTransfersRequestBodySchema, + t_PostTreasuryOutboundPaymentsIdCancelParamSchema, + t_PostTreasuryOutboundPaymentsIdCancelRequestBodySchema, + t_PostTreasuryOutboundPaymentsRequestBodySchema, + t_PostTreasuryOutboundTransfersOutboundTransferCancelParamSchema, + t_PostTreasuryOutboundTransfersOutboundTransferCancelRequestBodySchema, + t_PostTreasuryOutboundTransfersRequestBodySchema, + t_PostWebhookEndpointsRequestBodySchema, + t_PostWebhookEndpointsWebhookEndpointParamSchema, + t_PostWebhookEndpointsWebhookEndpointRequestBodySchema, + t_account, + t_account_link, + t_account_session, + t_apple_pay_domain, + t_application_fee, + t_apps_secret, + t_balance, + t_balance_transaction, + t_bank_account, + t_billing_alert, + t_billing_credit_balance_summary, + t_billing_credit_balance_transaction, + t_billing_credit_grant, + t_billing_meter, + t_billing_meter_event, + t_billing_meter_event_adjustment, + t_billing_meter_event_summary, + t_billing_portal_configuration, + t_billing_portal_session, + t_capability, + t_card, + t_cash_balance, + t_charge, + t_checkout_session, + t_climate_order, + t_climate_product, + t_climate_supplier, + t_confirmation_token, + t_country_spec, + t_coupon, + t_credit_note, + t_credit_note_line_item, + t_customer, + t_customer_balance_transaction, + t_customer_cash_balance_transaction, + t_customer_session, + t_deleted_account, + t_deleted_apple_pay_domain, + t_deleted_coupon, + t_deleted_customer, + t_deleted_discount, + t_deleted_external_account, + t_deleted_invoice, + t_deleted_invoiceitem, + t_deleted_payment_source, + t_deleted_person, + t_deleted_plan, + t_deleted_product, + t_deleted_product_feature, + t_deleted_radar_value_list, + t_deleted_radar_value_list_item, + t_deleted_subscription_item, + t_deleted_tax_id, + t_deleted_terminal_configuration, + t_deleted_terminal_location, + t_deleted_terminal_reader, + t_deleted_test_helpers_test_clock, + t_deleted_webhook_endpoint, + t_discount, + t_dispute, + t_entitlements_active_entitlement, + t_entitlements_feature, + t_ephemeral_key, + t_error, + t_event, + t_exchange_rate, + t_external_account, + t_fee_refund, + t_file, + t_file_link, + t_financial_connections_account, + t_financial_connections_account_owner, + t_financial_connections_session, + t_financial_connections_transaction, + t_forwarding_request, + t_funding_instructions, + t_identity_verification_report, + t_identity_verification_session, + t_invoice, + t_invoice_payment, + t_invoice_rendering_template, + t_invoiceitem, + t_issuing_authorization, + t_issuing_card, + t_issuing_cardholder, + t_issuing_dispute, + t_issuing_personalization_design, + t_issuing_physical_bundle, + t_issuing_settlement, + t_issuing_token, + t_issuing_transaction, + t_item, + t_line_item, + t_login_link, + t_mandate, + t_payment_intent, + t_payment_link, + t_payment_method, + t_payment_method_configuration, + t_payment_method_domain, + t_payment_source, + t_payout, + t_person, + t_plan, + t_price, + t_product, + t_product_feature, + t_promotion_code, + t_quote, + t_radar_early_fraud_warning, + t_radar_value_list, + t_radar_value_list_item, + t_refund, + t_reporting_report_run, + t_reporting_report_type, + t_review, + t_scheduled_query_run, + t_setup_attempt, + t_setup_intent, + t_shipping_rate, + t_sigma_sigma_api_query, + t_source, + t_source_mandate_notification, + t_source_transaction, + t_subscription, + t_subscription_item, + t_subscription_schedule, + t_tax_calculation, + t_tax_calculation_line_item, + t_tax_code, + t_tax_id, + t_tax_rate, + t_tax_registration, + t_tax_settings, + t_tax_transaction, + t_tax_transaction_line_item, + t_terminal_configuration, + t_terminal_connection_token, + t_terminal_location, + t_terminal_reader, + t_test_helpers_test_clock, + t_token, + t_topup, + t_transfer, + t_transfer_reversal, + t_treasury_credit_reversal, + t_treasury_debit_reversal, + t_treasury_financial_account, + t_treasury_financial_account_features, + t_treasury_inbound_transfer, + t_treasury_outbound_payment, + t_treasury_outbound_transfer, + t_treasury_received_credit, + t_treasury_received_debit, + t_treasury_transaction, + t_treasury_transaction_entry, + t_webhook_endpoint, +} from "./models" +import { + PermissiveBoolean, + s_account, + s_account_link, + s_account_session, + s_apple_pay_domain, + s_application_fee, + s_apps_secret, + s_balance, + s_balance_transaction, + s_bank_account, + s_billing_alert, + s_billing_credit_balance_summary, + s_billing_credit_balance_transaction, + s_billing_credit_grant, + s_billing_meter, + s_billing_meter_event, + s_billing_meter_event_adjustment, + s_billing_meter_event_summary, + s_billing_portal_configuration, + s_billing_portal_session, + s_capability, + s_card, + s_cash_balance, + s_charge, + s_checkout_session, + s_climate_order, + s_climate_product, + s_climate_supplier, + s_confirmation_token, + s_country_spec, + s_coupon, + s_credit_note, + s_credit_note_line_item, + s_customer, + s_customer_balance_transaction, + s_customer_cash_balance_transaction, + s_customer_session, + s_deleted_account, + s_deleted_apple_pay_domain, + s_deleted_coupon, + s_deleted_customer, + s_deleted_discount, + s_deleted_external_account, + s_deleted_invoice, + s_deleted_invoiceitem, + s_deleted_payment_source, + s_deleted_person, + s_deleted_plan, + s_deleted_product, + s_deleted_product_feature, + s_deleted_radar_value_list, + s_deleted_radar_value_list_item, + s_deleted_subscription_item, + s_deleted_tax_id, + s_deleted_terminal_configuration, + s_deleted_terminal_location, + s_deleted_terminal_reader, + s_deleted_test_helpers_test_clock, + s_deleted_webhook_endpoint, + s_discount, + s_dispute, + s_entitlements_active_entitlement, + s_entitlements_feature, + s_ephemeral_key, + s_error, + s_event, + s_exchange_rate, + s_external_account, + s_fee_refund, + s_file, + s_file_link, + s_financial_connections_account, + s_financial_connections_account_owner, + s_financial_connections_session, + s_financial_connections_transaction, + s_forwarding_request, + s_funding_instructions, + s_identity_verification_report, + s_identity_verification_session, + s_invoice, + s_invoice_payment, + s_invoice_rendering_template, + s_invoiceitem, + s_issuing_authorization, + s_issuing_card, + s_issuing_cardholder, + s_issuing_dispute, + s_issuing_personalization_design, + s_issuing_physical_bundle, + s_issuing_settlement, + s_issuing_token, + s_issuing_transaction, + s_item, + s_line_item, + s_login_link, + s_mandate, + s_payment_intent, + s_payment_link, + s_payment_method, + s_payment_method_configuration, + s_payment_method_domain, + s_payment_source, + s_payout, + s_person, + s_plan, + s_price, + s_product, + s_product_feature, + s_promotion_code, + s_quote, + s_radar_early_fraud_warning, + s_radar_value_list, + s_radar_value_list_item, + s_refund, + s_reporting_report_run, + s_reporting_report_type, + s_review, + s_scheduled_query_run, + s_setup_attempt, + s_setup_intent, + s_shipping_rate, + s_sigma_sigma_api_query, + s_source, + s_source_mandate_notification, + s_source_transaction, + s_subscription, + s_subscription_item, + s_subscription_schedule, + s_tax_calculation, + s_tax_calculation_line_item, + s_tax_code, + s_tax_id, + s_tax_rate, + s_tax_registration, + s_tax_settings, + s_tax_transaction, + s_tax_transaction_line_item, + s_terminal_configuration, + s_terminal_connection_token, + s_terminal_location, + s_terminal_reader, + s_test_helpers_test_clock, + s_token, + s_topup, + s_transfer, + s_transfer_reversal, + s_treasury_credit_reversal, + s_treasury_debit_reversal, + s_treasury_financial_account, + s_treasury_financial_account_features, + s_treasury_inbound_transfer, + s_treasury_outbound_payment, + s_treasury_outbound_transfer, + s_treasury_received_credit, + s_treasury_received_debit, + s_treasury_transaction, + s_treasury_transaction_entry, + s_webhook_endpoint, +} from "./schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + ServerConfig, + SkipResponse, + StatusCode, + startServer, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type GetAccountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccount = ( + params: Params< + void, + t_GetAccountQuerySchema, + t_GetAccountRequestBodySchema | undefined, + void + >, + respond: GetAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountLinksResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountLinks = ( + params: Params, + respond: PostAccountLinksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountSessionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountSessions = ( + params: Params, + respond: PostAccountSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_account[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccounts = ( + params: Params< + void, + t_GetAccountsQuerySchema, + t_GetAccountsRequestBodySchema | undefined, + void + >, + respond: GetAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccounts = ( + params: Params, + respond: PostAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteAccountsAccountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteAccountsAccount = ( + params: Params< + t_DeleteAccountsAccountParamSchema, + void, + t_DeleteAccountsAccountRequestBodySchema | undefined, + void + >, + respond: DeleteAccountsAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccount = ( + params: Params< + t_GetAccountsAccountParamSchema, + t_GetAccountsAccountQuerySchema, + t_GetAccountsAccountRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccount = ( + params: Params< + t_PostAccountsAccountParamSchema, + void, + t_PostAccountsAccountRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountBankAccountsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountBankAccounts = ( + params: Params< + t_PostAccountsAccountBankAccountsParamSchema, + void, + t_PostAccountsAccountBankAccountsRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountBankAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteAccountsAccountBankAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteAccountsAccountBankAccountsId = ( + params: Params< + t_DeleteAccountsAccountBankAccountsIdParamSchema, + void, + t_DeleteAccountsAccountBankAccountsIdRequestBodySchema | undefined, + void + >, + respond: DeleteAccountsAccountBankAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountBankAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountBankAccountsId = ( + params: Params< + t_GetAccountsAccountBankAccountsIdParamSchema, + t_GetAccountsAccountBankAccountsIdQuerySchema, + t_GetAccountsAccountBankAccountsIdRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountBankAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountBankAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountBankAccountsId = ( + params: Params< + t_PostAccountsAccountBankAccountsIdParamSchema, + void, + t_PostAccountsAccountBankAccountsIdRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountBankAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountCapabilitiesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_capability[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountCapabilities = ( + params: Params< + t_GetAccountsAccountCapabilitiesParamSchema, + t_GetAccountsAccountCapabilitiesQuerySchema, + t_GetAccountsAccountCapabilitiesRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountCapabilitiesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountCapabilitiesCapabilityResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountCapabilitiesCapability = ( + params: Params< + t_GetAccountsAccountCapabilitiesCapabilityParamSchema, + t_GetAccountsAccountCapabilitiesCapabilityQuerySchema, + t_GetAccountsAccountCapabilitiesCapabilityRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountCapabilitiesCapabilityResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountCapabilitiesCapabilityResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountCapabilitiesCapability = ( + params: Params< + t_PostAccountsAccountCapabilitiesCapabilityParamSchema, + void, + t_PostAccountsAccountCapabilitiesCapabilityRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountCapabilitiesCapabilityResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountExternalAccountsResponder = { + with200(): ExpressRuntimeResponse<{ + data: (t_bank_account | t_card)[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountExternalAccounts = ( + params: Params< + t_GetAccountsAccountExternalAccountsParamSchema, + t_GetAccountsAccountExternalAccountsQuerySchema, + t_GetAccountsAccountExternalAccountsRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountExternalAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountExternalAccountsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountExternalAccounts = ( + params: Params< + t_PostAccountsAccountExternalAccountsParamSchema, + void, + t_PostAccountsAccountExternalAccountsRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountExternalAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteAccountsAccountExternalAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteAccountsAccountExternalAccountsId = ( + params: Params< + t_DeleteAccountsAccountExternalAccountsIdParamSchema, + void, + t_DeleteAccountsAccountExternalAccountsIdRequestBodySchema | undefined, + void + >, + respond: DeleteAccountsAccountExternalAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountExternalAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountExternalAccountsId = ( + params: Params< + t_GetAccountsAccountExternalAccountsIdParamSchema, + t_GetAccountsAccountExternalAccountsIdQuerySchema, + t_GetAccountsAccountExternalAccountsIdRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountExternalAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountExternalAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountExternalAccountsId = ( + params: Params< + t_PostAccountsAccountExternalAccountsIdParamSchema, + void, + t_PostAccountsAccountExternalAccountsIdRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountExternalAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountLoginLinksResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountLoginLinks = ( + params: Params< + t_PostAccountsAccountLoginLinksParamSchema, + void, + t_PostAccountsAccountLoginLinksRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountLoginLinksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountPeopleResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_person[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountPeople = ( + params: Params< + t_GetAccountsAccountPeopleParamSchema, + t_GetAccountsAccountPeopleQuerySchema, + t_GetAccountsAccountPeopleRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountPeopleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountPeopleResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountPeople = ( + params: Params< + t_PostAccountsAccountPeopleParamSchema, + void, + t_PostAccountsAccountPeopleRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountPeopleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteAccountsAccountPeoplePersonResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteAccountsAccountPeoplePerson = ( + params: Params< + t_DeleteAccountsAccountPeoplePersonParamSchema, + void, + t_DeleteAccountsAccountPeoplePersonRequestBodySchema | undefined, + void + >, + respond: DeleteAccountsAccountPeoplePersonResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountPeoplePersonResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountPeoplePerson = ( + params: Params< + t_GetAccountsAccountPeoplePersonParamSchema, + t_GetAccountsAccountPeoplePersonQuerySchema, + t_GetAccountsAccountPeoplePersonRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountPeoplePersonResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountPeoplePersonResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountPeoplePerson = ( + params: Params< + t_PostAccountsAccountPeoplePersonParamSchema, + void, + t_PostAccountsAccountPeoplePersonRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountPeoplePersonResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountPersonsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_person[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountPersons = ( + params: Params< + t_GetAccountsAccountPersonsParamSchema, + t_GetAccountsAccountPersonsQuerySchema, + t_GetAccountsAccountPersonsRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountPersonsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountPersonsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountPersons = ( + params: Params< + t_PostAccountsAccountPersonsParamSchema, + void, + t_PostAccountsAccountPersonsRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountPersonsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteAccountsAccountPersonsPersonResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteAccountsAccountPersonsPerson = ( + params: Params< + t_DeleteAccountsAccountPersonsPersonParamSchema, + void, + t_DeleteAccountsAccountPersonsPersonRequestBodySchema | undefined, + void + >, + respond: DeleteAccountsAccountPersonsPersonResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAccountsAccountPersonsPersonResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAccountsAccountPersonsPerson = ( + params: Params< + t_GetAccountsAccountPersonsPersonParamSchema, + t_GetAccountsAccountPersonsPersonQuerySchema, + t_GetAccountsAccountPersonsPersonRequestBodySchema | undefined, + void + >, + respond: GetAccountsAccountPersonsPersonResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountPersonsPersonResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountPersonsPerson = ( + params: Params< + t_PostAccountsAccountPersonsPersonParamSchema, + void, + t_PostAccountsAccountPersonsPersonRequestBodySchema | undefined, + void + >, + respond: PostAccountsAccountPersonsPersonResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAccountsAccountRejectResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAccountsAccountReject = ( + params: Params< + t_PostAccountsAccountRejectParamSchema, + void, + t_PostAccountsAccountRejectRequestBodySchema, + void + >, + respond: PostAccountsAccountRejectResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetApplePayDomainsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_apple_pay_domain[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetApplePayDomains = ( + params: Params< + void, + t_GetApplePayDomainsQuerySchema, + t_GetApplePayDomainsRequestBodySchema | undefined, + void + >, + respond: GetApplePayDomainsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostApplePayDomainsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostApplePayDomains = ( + params: Params, + respond: PostApplePayDomainsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteApplePayDomainsDomainResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteApplePayDomainsDomain = ( + params: Params< + t_DeleteApplePayDomainsDomainParamSchema, + void, + t_DeleteApplePayDomainsDomainRequestBodySchema | undefined, + void + >, + respond: DeleteApplePayDomainsDomainResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetApplePayDomainsDomainResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetApplePayDomainsDomain = ( + params: Params< + t_GetApplePayDomainsDomainParamSchema, + t_GetApplePayDomainsDomainQuerySchema, + t_GetApplePayDomainsDomainRequestBodySchema | undefined, + void + >, + respond: GetApplePayDomainsDomainResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetApplicationFeesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_application_fee[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetApplicationFees = ( + params: Params< + void, + t_GetApplicationFeesQuerySchema, + t_GetApplicationFeesRequestBodySchema | undefined, + void + >, + respond: GetApplicationFeesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetApplicationFeesFeeRefundsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetApplicationFeesFeeRefundsId = ( + params: Params< + t_GetApplicationFeesFeeRefundsIdParamSchema, + t_GetApplicationFeesFeeRefundsIdQuerySchema, + t_GetApplicationFeesFeeRefundsIdRequestBodySchema | undefined, + void + >, + respond: GetApplicationFeesFeeRefundsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostApplicationFeesFeeRefundsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostApplicationFeesFeeRefundsId = ( + params: Params< + t_PostApplicationFeesFeeRefundsIdParamSchema, + void, + t_PostApplicationFeesFeeRefundsIdRequestBodySchema | undefined, + void + >, + respond: PostApplicationFeesFeeRefundsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetApplicationFeesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetApplicationFeesId = ( + params: Params< + t_GetApplicationFeesIdParamSchema, + t_GetApplicationFeesIdQuerySchema, + t_GetApplicationFeesIdRequestBodySchema | undefined, + void + >, + respond: GetApplicationFeesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostApplicationFeesIdRefundResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostApplicationFeesIdRefund = ( + params: Params< + t_PostApplicationFeesIdRefundParamSchema, + void, + t_PostApplicationFeesIdRefundRequestBodySchema | undefined, + void + >, + respond: PostApplicationFeesIdRefundResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetApplicationFeesIdRefundsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_fee_refund[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetApplicationFeesIdRefunds = ( + params: Params< + t_GetApplicationFeesIdRefundsParamSchema, + t_GetApplicationFeesIdRefundsQuerySchema, + t_GetApplicationFeesIdRefundsRequestBodySchema | undefined, + void + >, + respond: GetApplicationFeesIdRefundsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostApplicationFeesIdRefundsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostApplicationFeesIdRefunds = ( + params: Params< + t_PostApplicationFeesIdRefundsParamSchema, + void, + t_PostApplicationFeesIdRefundsRequestBodySchema | undefined, + void + >, + respond: PostApplicationFeesIdRefundsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAppsSecretsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_apps_secret[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAppsSecrets = ( + params: Params< + void, + t_GetAppsSecretsQuerySchema, + t_GetAppsSecretsRequestBodySchema | undefined, + void + >, + respond: GetAppsSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAppsSecretsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAppsSecrets = ( + params: Params, + respond: PostAppsSecretsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostAppsSecretsDeleteResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostAppsSecretsDelete = ( + params: Params, + respond: PostAppsSecretsDeleteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetAppsSecretsFindResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetAppsSecretsFind = ( + params: Params< + void, + t_GetAppsSecretsFindQuerySchema, + t_GetAppsSecretsFindRequestBodySchema | undefined, + void + >, + respond: GetAppsSecretsFindResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBalanceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBalance = ( + params: Params< + void, + t_GetBalanceQuerySchema, + t_GetBalanceRequestBodySchema | undefined, + void + >, + respond: GetBalanceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBalanceHistoryResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_balance_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBalanceHistory = ( + params: Params< + void, + t_GetBalanceHistoryQuerySchema, + t_GetBalanceHistoryRequestBodySchema | undefined, + void + >, + respond: GetBalanceHistoryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBalanceHistoryIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBalanceHistoryId = ( + params: Params< + t_GetBalanceHistoryIdParamSchema, + t_GetBalanceHistoryIdQuerySchema, + t_GetBalanceHistoryIdRequestBodySchema | undefined, + void + >, + respond: GetBalanceHistoryIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBalanceTransactionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_balance_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBalanceTransactions = ( + params: Params< + void, + t_GetBalanceTransactionsQuerySchema, + t_GetBalanceTransactionsRequestBodySchema | undefined, + void + >, + respond: GetBalanceTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBalanceTransactionsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBalanceTransactionsId = ( + params: Params< + t_GetBalanceTransactionsIdParamSchema, + t_GetBalanceTransactionsIdQuerySchema, + t_GetBalanceTransactionsIdRequestBodySchema | undefined, + void + >, + respond: GetBalanceTransactionsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingAlertsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_billing_alert[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingAlerts = ( + params: Params< + void, + t_GetBillingAlertsQuerySchema, + t_GetBillingAlertsRequestBodySchema | undefined, + void + >, + respond: GetBillingAlertsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingAlertsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingAlerts = ( + params: Params, + respond: PostBillingAlertsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingAlertsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingAlertsId = ( + params: Params< + t_GetBillingAlertsIdParamSchema, + t_GetBillingAlertsIdQuerySchema, + t_GetBillingAlertsIdRequestBodySchema | undefined, + void + >, + respond: GetBillingAlertsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingAlertsIdActivateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingAlertsIdActivate = ( + params: Params< + t_PostBillingAlertsIdActivateParamSchema, + void, + t_PostBillingAlertsIdActivateRequestBodySchema | undefined, + void + >, + respond: PostBillingAlertsIdActivateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingAlertsIdArchiveResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingAlertsIdArchive = ( + params: Params< + t_PostBillingAlertsIdArchiveParamSchema, + void, + t_PostBillingAlertsIdArchiveRequestBodySchema | undefined, + void + >, + respond: PostBillingAlertsIdArchiveResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingAlertsIdDeactivateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingAlertsIdDeactivate = ( + params: Params< + t_PostBillingAlertsIdDeactivateParamSchema, + void, + t_PostBillingAlertsIdDeactivateRequestBodySchema | undefined, + void + >, + respond: PostBillingAlertsIdDeactivateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingCreditBalanceSummaryResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingCreditBalanceSummary = ( + params: Params< + void, + t_GetBillingCreditBalanceSummaryQuerySchema, + t_GetBillingCreditBalanceSummaryRequestBodySchema | undefined, + void + >, + respond: GetBillingCreditBalanceSummaryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingCreditBalanceTransactionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_billing_credit_balance_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingCreditBalanceTransactions = ( + params: Params< + void, + t_GetBillingCreditBalanceTransactionsQuerySchema, + t_GetBillingCreditBalanceTransactionsRequestBodySchema | undefined, + void + >, + respond: GetBillingCreditBalanceTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingCreditBalanceTransactionsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingCreditBalanceTransactionsId = ( + params: Params< + t_GetBillingCreditBalanceTransactionsIdParamSchema, + t_GetBillingCreditBalanceTransactionsIdQuerySchema, + t_GetBillingCreditBalanceTransactionsIdRequestBodySchema | undefined, + void + >, + respond: GetBillingCreditBalanceTransactionsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingCreditGrantsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_billing_credit_grant[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingCreditGrants = ( + params: Params< + void, + t_GetBillingCreditGrantsQuerySchema, + t_GetBillingCreditGrantsRequestBodySchema | undefined, + void + >, + respond: GetBillingCreditGrantsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingCreditGrantsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingCreditGrants = ( + params: Params, + respond: PostBillingCreditGrantsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingCreditGrantsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingCreditGrantsId = ( + params: Params< + t_GetBillingCreditGrantsIdParamSchema, + t_GetBillingCreditGrantsIdQuerySchema, + t_GetBillingCreditGrantsIdRequestBodySchema | undefined, + void + >, + respond: GetBillingCreditGrantsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingCreditGrantsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingCreditGrantsId = ( + params: Params< + t_PostBillingCreditGrantsIdParamSchema, + void, + t_PostBillingCreditGrantsIdRequestBodySchema | undefined, + void + >, + respond: PostBillingCreditGrantsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingCreditGrantsIdExpireResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingCreditGrantsIdExpire = ( + params: Params< + t_PostBillingCreditGrantsIdExpireParamSchema, + void, + t_PostBillingCreditGrantsIdExpireRequestBodySchema | undefined, + void + >, + respond: PostBillingCreditGrantsIdExpireResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingCreditGrantsIdVoidResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingCreditGrantsIdVoid = ( + params: Params< + t_PostBillingCreditGrantsIdVoidParamSchema, + void, + t_PostBillingCreditGrantsIdVoidRequestBodySchema | undefined, + void + >, + respond: PostBillingCreditGrantsIdVoidResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingMeterEventAdjustmentsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingMeterEventAdjustments = ( + params: Params< + void, + void, + t_PostBillingMeterEventAdjustmentsRequestBodySchema, + void + >, + respond: PostBillingMeterEventAdjustmentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingMeterEventsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingMeterEvents = ( + params: Params, + respond: PostBillingMeterEventsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingMetersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_billing_meter[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingMeters = ( + params: Params< + void, + t_GetBillingMetersQuerySchema, + t_GetBillingMetersRequestBodySchema | undefined, + void + >, + respond: GetBillingMetersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingMetersResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingMeters = ( + params: Params, + respond: PostBillingMetersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingMetersIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingMetersId = ( + params: Params< + t_GetBillingMetersIdParamSchema, + t_GetBillingMetersIdQuerySchema, + t_GetBillingMetersIdRequestBodySchema | undefined, + void + >, + respond: GetBillingMetersIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingMetersIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingMetersId = ( + params: Params< + t_PostBillingMetersIdParamSchema, + void, + t_PostBillingMetersIdRequestBodySchema | undefined, + void + >, + respond: PostBillingMetersIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingMetersIdDeactivateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingMetersIdDeactivate = ( + params: Params< + t_PostBillingMetersIdDeactivateParamSchema, + void, + t_PostBillingMetersIdDeactivateRequestBodySchema | undefined, + void + >, + respond: PostBillingMetersIdDeactivateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingMetersIdEventSummariesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_billing_meter_event_summary[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingMetersIdEventSummaries = ( + params: Params< + t_GetBillingMetersIdEventSummariesParamSchema, + t_GetBillingMetersIdEventSummariesQuerySchema, + t_GetBillingMetersIdEventSummariesRequestBodySchema | undefined, + void + >, + respond: GetBillingMetersIdEventSummariesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingMetersIdReactivateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingMetersIdReactivate = ( + params: Params< + t_PostBillingMetersIdReactivateParamSchema, + void, + t_PostBillingMetersIdReactivateRequestBodySchema | undefined, + void + >, + respond: PostBillingMetersIdReactivateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingPortalConfigurationsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_billing_portal_configuration[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingPortalConfigurations = ( + params: Params< + void, + t_GetBillingPortalConfigurationsQuerySchema, + t_GetBillingPortalConfigurationsRequestBodySchema | undefined, + void + >, + respond: GetBillingPortalConfigurationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingPortalConfigurationsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingPortalConfigurations = ( + params: Params< + void, + void, + t_PostBillingPortalConfigurationsRequestBodySchema, + void + >, + respond: PostBillingPortalConfigurationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetBillingPortalConfigurationsConfigurationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetBillingPortalConfigurationsConfiguration = ( + params: Params< + t_GetBillingPortalConfigurationsConfigurationParamSchema, + t_GetBillingPortalConfigurationsConfigurationQuerySchema, + t_GetBillingPortalConfigurationsConfigurationRequestBodySchema | undefined, + void + >, + respond: GetBillingPortalConfigurationsConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingPortalConfigurationsConfigurationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingPortalConfigurationsConfiguration = ( + params: Params< + t_PostBillingPortalConfigurationsConfigurationParamSchema, + void, + t_PostBillingPortalConfigurationsConfigurationRequestBodySchema | undefined, + void + >, + respond: PostBillingPortalConfigurationsConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostBillingPortalSessionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostBillingPortalSessions = ( + params: Params< + void, + void, + t_PostBillingPortalSessionsRequestBodySchema, + void + >, + respond: PostBillingPortalSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetChargesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_charge[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCharges = ( + params: Params< + void, + t_GetChargesQuerySchema, + t_GetChargesRequestBodySchema | undefined, + void + >, + respond: GetChargesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostChargesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCharges = ( + params: Params, + respond: PostChargesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetChargesSearchResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_charge[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetChargesSearch = ( + params: Params< + void, + t_GetChargesSearchQuerySchema, + t_GetChargesSearchRequestBodySchema | undefined, + void + >, + respond: GetChargesSearchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetChargesChargeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetChargesCharge = ( + params: Params< + t_GetChargesChargeParamSchema, + t_GetChargesChargeQuerySchema, + t_GetChargesChargeRequestBodySchema | undefined, + void + >, + respond: GetChargesChargeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostChargesChargeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostChargesCharge = ( + params: Params< + t_PostChargesChargeParamSchema, + void, + t_PostChargesChargeRequestBodySchema | undefined, + void + >, + respond: PostChargesChargeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostChargesChargeCaptureResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostChargesChargeCapture = ( + params: Params< + t_PostChargesChargeCaptureParamSchema, + void, + t_PostChargesChargeCaptureRequestBodySchema | undefined, + void + >, + respond: PostChargesChargeCaptureResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetChargesChargeDisputeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetChargesChargeDispute = ( + params: Params< + t_GetChargesChargeDisputeParamSchema, + t_GetChargesChargeDisputeQuerySchema, + t_GetChargesChargeDisputeRequestBodySchema | undefined, + void + >, + respond: GetChargesChargeDisputeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostChargesChargeDisputeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostChargesChargeDispute = ( + params: Params< + t_PostChargesChargeDisputeParamSchema, + void, + t_PostChargesChargeDisputeRequestBodySchema | undefined, + void + >, + respond: PostChargesChargeDisputeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostChargesChargeDisputeCloseResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostChargesChargeDisputeClose = ( + params: Params< + t_PostChargesChargeDisputeCloseParamSchema, + void, + t_PostChargesChargeDisputeCloseRequestBodySchema | undefined, + void + >, + respond: PostChargesChargeDisputeCloseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostChargesChargeRefundResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostChargesChargeRefund = ( + params: Params< + t_PostChargesChargeRefundParamSchema, + void, + t_PostChargesChargeRefundRequestBodySchema | undefined, + void + >, + respond: PostChargesChargeRefundResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetChargesChargeRefundsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_refund[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetChargesChargeRefunds = ( + params: Params< + t_GetChargesChargeRefundsParamSchema, + t_GetChargesChargeRefundsQuerySchema, + t_GetChargesChargeRefundsRequestBodySchema | undefined, + void + >, + respond: GetChargesChargeRefundsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostChargesChargeRefundsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostChargesChargeRefunds = ( + params: Params< + t_PostChargesChargeRefundsParamSchema, + void, + t_PostChargesChargeRefundsRequestBodySchema | undefined, + void + >, + respond: PostChargesChargeRefundsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetChargesChargeRefundsRefundResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetChargesChargeRefundsRefund = ( + params: Params< + t_GetChargesChargeRefundsRefundParamSchema, + t_GetChargesChargeRefundsRefundQuerySchema, + t_GetChargesChargeRefundsRefundRequestBodySchema | undefined, + void + >, + respond: GetChargesChargeRefundsRefundResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostChargesChargeRefundsRefundResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostChargesChargeRefundsRefund = ( + params: Params< + t_PostChargesChargeRefundsRefundParamSchema, + void, + t_PostChargesChargeRefundsRefundRequestBodySchema | undefined, + void + >, + respond: PostChargesChargeRefundsRefundResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCheckoutSessionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_checkout_session[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCheckoutSessions = ( + params: Params< + void, + t_GetCheckoutSessionsQuerySchema, + t_GetCheckoutSessionsRequestBodySchema | undefined, + void + >, + respond: GetCheckoutSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCheckoutSessionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCheckoutSessions = ( + params: Params< + void, + void, + t_PostCheckoutSessionsRequestBodySchema | undefined, + void + >, + respond: PostCheckoutSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCheckoutSessionsSessionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCheckoutSessionsSession = ( + params: Params< + t_GetCheckoutSessionsSessionParamSchema, + t_GetCheckoutSessionsSessionQuerySchema, + t_GetCheckoutSessionsSessionRequestBodySchema | undefined, + void + >, + respond: GetCheckoutSessionsSessionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCheckoutSessionsSessionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCheckoutSessionsSession = ( + params: Params< + t_PostCheckoutSessionsSessionParamSchema, + void, + t_PostCheckoutSessionsSessionRequestBodySchema | undefined, + void + >, + respond: PostCheckoutSessionsSessionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCheckoutSessionsSessionExpireResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCheckoutSessionsSessionExpire = ( + params: Params< + t_PostCheckoutSessionsSessionExpireParamSchema, + void, + t_PostCheckoutSessionsSessionExpireRequestBodySchema | undefined, + void + >, + respond: PostCheckoutSessionsSessionExpireResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCheckoutSessionsSessionLineItemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCheckoutSessionsSessionLineItems = ( + params: Params< + t_GetCheckoutSessionsSessionLineItemsParamSchema, + t_GetCheckoutSessionsSessionLineItemsQuerySchema, + t_GetCheckoutSessionsSessionLineItemsRequestBodySchema | undefined, + void + >, + respond: GetCheckoutSessionsSessionLineItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetClimateOrdersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_climate_order[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetClimateOrders = ( + params: Params< + void, + t_GetClimateOrdersQuerySchema, + t_GetClimateOrdersRequestBodySchema | undefined, + void + >, + respond: GetClimateOrdersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostClimateOrdersResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostClimateOrders = ( + params: Params, + respond: PostClimateOrdersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetClimateOrdersOrderResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetClimateOrdersOrder = ( + params: Params< + t_GetClimateOrdersOrderParamSchema, + t_GetClimateOrdersOrderQuerySchema, + t_GetClimateOrdersOrderRequestBodySchema | undefined, + void + >, + respond: GetClimateOrdersOrderResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostClimateOrdersOrderResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostClimateOrdersOrder = ( + params: Params< + t_PostClimateOrdersOrderParamSchema, + void, + t_PostClimateOrdersOrderRequestBodySchema | undefined, + void + >, + respond: PostClimateOrdersOrderResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostClimateOrdersOrderCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostClimateOrdersOrderCancel = ( + params: Params< + t_PostClimateOrdersOrderCancelParamSchema, + void, + t_PostClimateOrdersOrderCancelRequestBodySchema | undefined, + void + >, + respond: PostClimateOrdersOrderCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetClimateProductsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_climate_product[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetClimateProducts = ( + params: Params< + void, + t_GetClimateProductsQuerySchema, + t_GetClimateProductsRequestBodySchema | undefined, + void + >, + respond: GetClimateProductsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetClimateProductsProductResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetClimateProductsProduct = ( + params: Params< + t_GetClimateProductsProductParamSchema, + t_GetClimateProductsProductQuerySchema, + t_GetClimateProductsProductRequestBodySchema | undefined, + void + >, + respond: GetClimateProductsProductResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetClimateSuppliersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_climate_supplier[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetClimateSuppliers = ( + params: Params< + void, + t_GetClimateSuppliersQuerySchema, + t_GetClimateSuppliersRequestBodySchema | undefined, + void + >, + respond: GetClimateSuppliersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetClimateSuppliersSupplierResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetClimateSuppliersSupplier = ( + params: Params< + t_GetClimateSuppliersSupplierParamSchema, + t_GetClimateSuppliersSupplierQuerySchema, + t_GetClimateSuppliersSupplierRequestBodySchema | undefined, + void + >, + respond: GetClimateSuppliersSupplierResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetConfirmationTokensConfirmationTokenResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetConfirmationTokensConfirmationToken = ( + params: Params< + t_GetConfirmationTokensConfirmationTokenParamSchema, + t_GetConfirmationTokensConfirmationTokenQuerySchema, + t_GetConfirmationTokensConfirmationTokenRequestBodySchema | undefined, + void + >, + respond: GetConfirmationTokensConfirmationTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCountrySpecsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_country_spec[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCountrySpecs = ( + params: Params< + void, + t_GetCountrySpecsQuerySchema, + t_GetCountrySpecsRequestBodySchema | undefined, + void + >, + respond: GetCountrySpecsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCountrySpecsCountryResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCountrySpecsCountry = ( + params: Params< + t_GetCountrySpecsCountryParamSchema, + t_GetCountrySpecsCountryQuerySchema, + t_GetCountrySpecsCountryRequestBodySchema | undefined, + void + >, + respond: GetCountrySpecsCountryResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCouponsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_coupon[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCoupons = ( + params: Params< + void, + t_GetCouponsQuerySchema, + t_GetCouponsRequestBodySchema | undefined, + void + >, + respond: GetCouponsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCouponsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCoupons = ( + params: Params, + respond: PostCouponsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCouponsCouponResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteCouponsCoupon = ( + params: Params< + t_DeleteCouponsCouponParamSchema, + void, + t_DeleteCouponsCouponRequestBodySchema | undefined, + void + >, + respond: DeleteCouponsCouponResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCouponsCouponResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCouponsCoupon = ( + params: Params< + t_GetCouponsCouponParamSchema, + t_GetCouponsCouponQuerySchema, + t_GetCouponsCouponRequestBodySchema | undefined, + void + >, + respond: GetCouponsCouponResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCouponsCouponResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCouponsCoupon = ( + params: Params< + t_PostCouponsCouponParamSchema, + void, + t_PostCouponsCouponRequestBodySchema | undefined, + void + >, + respond: PostCouponsCouponResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCreditNotesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_credit_note[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCreditNotes = ( + params: Params< + void, + t_GetCreditNotesQuerySchema, + t_GetCreditNotesRequestBodySchema | undefined, + void + >, + respond: GetCreditNotesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCreditNotesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCreditNotes = ( + params: Params, + respond: PostCreditNotesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCreditNotesPreviewResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCreditNotesPreview = ( + params: Params< + void, + t_GetCreditNotesPreviewQuerySchema, + t_GetCreditNotesPreviewRequestBodySchema | undefined, + void + >, + respond: GetCreditNotesPreviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCreditNotesPreviewLinesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_credit_note_line_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCreditNotesPreviewLines = ( + params: Params< + void, + t_GetCreditNotesPreviewLinesQuerySchema, + t_GetCreditNotesPreviewLinesRequestBodySchema | undefined, + void + >, + respond: GetCreditNotesPreviewLinesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCreditNotesCreditNoteLinesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_credit_note_line_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCreditNotesCreditNoteLines = ( + params: Params< + t_GetCreditNotesCreditNoteLinesParamSchema, + t_GetCreditNotesCreditNoteLinesQuerySchema, + t_GetCreditNotesCreditNoteLinesRequestBodySchema | undefined, + void + >, + respond: GetCreditNotesCreditNoteLinesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCreditNotesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCreditNotesId = ( + params: Params< + t_GetCreditNotesIdParamSchema, + t_GetCreditNotesIdQuerySchema, + t_GetCreditNotesIdRequestBodySchema | undefined, + void + >, + respond: GetCreditNotesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCreditNotesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCreditNotesId = ( + params: Params< + t_PostCreditNotesIdParamSchema, + void, + t_PostCreditNotesIdRequestBodySchema | undefined, + void + >, + respond: PostCreditNotesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCreditNotesIdVoidResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCreditNotesIdVoid = ( + params: Params< + t_PostCreditNotesIdVoidParamSchema, + void, + t_PostCreditNotesIdVoidRequestBodySchema | undefined, + void + >, + respond: PostCreditNotesIdVoidResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomerSessionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomerSessions = ( + params: Params, + respond: PostCustomerSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_customer[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomers = ( + params: Params< + void, + t_GetCustomersQuerySchema, + t_GetCustomersRequestBodySchema | undefined, + void + >, + respond: GetCustomersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomers = ( + params: Params< + void, + void, + t_PostCustomersRequestBodySchema | undefined, + void + >, + respond: PostCustomersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersSearchResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_customer[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersSearch = ( + params: Params< + void, + t_GetCustomersSearchQuerySchema, + t_GetCustomersSearchRequestBodySchema | undefined, + void + >, + respond: GetCustomersSearchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCustomersCustomerResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteCustomersCustomer = ( + params: Params< + t_DeleteCustomersCustomerParamSchema, + void, + t_DeleteCustomersCustomerRequestBodySchema | undefined, + void + >, + respond: DeleteCustomersCustomerResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomer = ( + params: Params< + t_GetCustomersCustomerParamSchema, + t_GetCustomersCustomerQuerySchema, + t_GetCustomersCustomerRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomer = ( + params: Params< + t_PostCustomersCustomerParamSchema, + void, + t_PostCustomersCustomerRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerBalanceTransactionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_customer_balance_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerBalanceTransactions = ( + params: Params< + t_GetCustomersCustomerBalanceTransactionsParamSchema, + t_GetCustomersCustomerBalanceTransactionsQuerySchema, + t_GetCustomersCustomerBalanceTransactionsRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerBalanceTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerBalanceTransactionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerBalanceTransactions = ( + params: Params< + t_PostCustomersCustomerBalanceTransactionsParamSchema, + void, + t_PostCustomersCustomerBalanceTransactionsRequestBodySchema, + void + >, + respond: PostCustomersCustomerBalanceTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerBalanceTransactionsTransactionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerBalanceTransactionsTransaction = ( + params: Params< + t_GetCustomersCustomerBalanceTransactionsTransactionParamSchema, + t_GetCustomersCustomerBalanceTransactionsTransactionQuerySchema, + | t_GetCustomersCustomerBalanceTransactionsTransactionRequestBodySchema + | undefined, + void + >, + respond: GetCustomersCustomerBalanceTransactionsTransactionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerBalanceTransactionsTransactionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerBalanceTransactionsTransaction = ( + params: Params< + t_PostCustomersCustomerBalanceTransactionsTransactionParamSchema, + void, + | t_PostCustomersCustomerBalanceTransactionsTransactionRequestBodySchema + | undefined, + void + >, + respond: PostCustomersCustomerBalanceTransactionsTransactionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerBankAccountsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_bank_account[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerBankAccounts = ( + params: Params< + t_GetCustomersCustomerBankAccountsParamSchema, + t_GetCustomersCustomerBankAccountsQuerySchema, + t_GetCustomersCustomerBankAccountsRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerBankAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerBankAccountsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerBankAccounts = ( + params: Params< + t_PostCustomersCustomerBankAccountsParamSchema, + void, + t_PostCustomersCustomerBankAccountsRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerBankAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCustomersCustomerBankAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteCustomersCustomerBankAccountsId = ( + params: Params< + t_DeleteCustomersCustomerBankAccountsIdParamSchema, + void, + t_DeleteCustomersCustomerBankAccountsIdRequestBodySchema | undefined, + void + >, + respond: DeleteCustomersCustomerBankAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerBankAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerBankAccountsId = ( + params: Params< + t_GetCustomersCustomerBankAccountsIdParamSchema, + t_GetCustomersCustomerBankAccountsIdQuerySchema, + t_GetCustomersCustomerBankAccountsIdRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerBankAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerBankAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerBankAccountsId = ( + params: Params< + t_PostCustomersCustomerBankAccountsIdParamSchema, + void, + t_PostCustomersCustomerBankAccountsIdRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerBankAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerBankAccountsIdVerifyResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerBankAccountsIdVerify = ( + params: Params< + t_PostCustomersCustomerBankAccountsIdVerifyParamSchema, + void, + t_PostCustomersCustomerBankAccountsIdVerifyRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerBankAccountsIdVerifyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerCardsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_card[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerCards = ( + params: Params< + t_GetCustomersCustomerCardsParamSchema, + t_GetCustomersCustomerCardsQuerySchema, + t_GetCustomersCustomerCardsRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerCardsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerCardsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerCards = ( + params: Params< + t_PostCustomersCustomerCardsParamSchema, + void, + t_PostCustomersCustomerCardsRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerCardsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCustomersCustomerCardsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteCustomersCustomerCardsId = ( + params: Params< + t_DeleteCustomersCustomerCardsIdParamSchema, + void, + t_DeleteCustomersCustomerCardsIdRequestBodySchema | undefined, + void + >, + respond: DeleteCustomersCustomerCardsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerCardsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerCardsId = ( + params: Params< + t_GetCustomersCustomerCardsIdParamSchema, + t_GetCustomersCustomerCardsIdQuerySchema, + t_GetCustomersCustomerCardsIdRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerCardsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerCardsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerCardsId = ( + params: Params< + t_PostCustomersCustomerCardsIdParamSchema, + void, + t_PostCustomersCustomerCardsIdRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerCardsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerCashBalanceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerCashBalance = ( + params: Params< + t_GetCustomersCustomerCashBalanceParamSchema, + t_GetCustomersCustomerCashBalanceQuerySchema, + t_GetCustomersCustomerCashBalanceRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerCashBalanceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerCashBalanceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerCashBalance = ( + params: Params< + t_PostCustomersCustomerCashBalanceParamSchema, + void, + t_PostCustomersCustomerCashBalanceRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerCashBalanceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerCashBalanceTransactionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_customer_cash_balance_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerCashBalanceTransactions = ( + params: Params< + t_GetCustomersCustomerCashBalanceTransactionsParamSchema, + t_GetCustomersCustomerCashBalanceTransactionsQuerySchema, + t_GetCustomersCustomerCashBalanceTransactionsRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerCashBalanceTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerCashBalanceTransactionsTransactionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerCashBalanceTransactionsTransaction = ( + params: Params< + t_GetCustomersCustomerCashBalanceTransactionsTransactionParamSchema, + t_GetCustomersCustomerCashBalanceTransactionsTransactionQuerySchema, + | t_GetCustomersCustomerCashBalanceTransactionsTransactionRequestBodySchema + | undefined, + void + >, + respond: GetCustomersCustomerCashBalanceTransactionsTransactionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCustomersCustomerDiscountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteCustomersCustomerDiscount = ( + params: Params< + t_DeleteCustomersCustomerDiscountParamSchema, + void, + t_DeleteCustomersCustomerDiscountRequestBodySchema | undefined, + void + >, + respond: DeleteCustomersCustomerDiscountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerDiscountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerDiscount = ( + params: Params< + t_GetCustomersCustomerDiscountParamSchema, + t_GetCustomersCustomerDiscountQuerySchema, + t_GetCustomersCustomerDiscountRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerDiscountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerFundingInstructionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerFundingInstructions = ( + params: Params< + t_PostCustomersCustomerFundingInstructionsParamSchema, + void, + t_PostCustomersCustomerFundingInstructionsRequestBodySchema, + void + >, + respond: PostCustomersCustomerFundingInstructionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerPaymentMethodsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_payment_method[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerPaymentMethods = ( + params: Params< + t_GetCustomersCustomerPaymentMethodsParamSchema, + t_GetCustomersCustomerPaymentMethodsQuerySchema, + t_GetCustomersCustomerPaymentMethodsRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerPaymentMethodsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerPaymentMethodsPaymentMethodResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerPaymentMethodsPaymentMethod = ( + params: Params< + t_GetCustomersCustomerPaymentMethodsPaymentMethodParamSchema, + t_GetCustomersCustomerPaymentMethodsPaymentMethodQuerySchema, + | t_GetCustomersCustomerPaymentMethodsPaymentMethodRequestBodySchema + | undefined, + void + >, + respond: GetCustomersCustomerPaymentMethodsPaymentMethodResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerSourcesResponder = { + with200(): ExpressRuntimeResponse<{ + data: (t_bank_account | t_card | t_source)[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerSources = ( + params: Params< + t_GetCustomersCustomerSourcesParamSchema, + t_GetCustomersCustomerSourcesQuerySchema, + t_GetCustomersCustomerSourcesRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerSourcesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerSourcesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerSources = ( + params: Params< + t_PostCustomersCustomerSourcesParamSchema, + void, + t_PostCustomersCustomerSourcesRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerSourcesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCustomersCustomerSourcesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteCustomersCustomerSourcesId = ( + params: Params< + t_DeleteCustomersCustomerSourcesIdParamSchema, + void, + t_DeleteCustomersCustomerSourcesIdRequestBodySchema | undefined, + void + >, + respond: DeleteCustomersCustomerSourcesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerSourcesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerSourcesId = ( + params: Params< + t_GetCustomersCustomerSourcesIdParamSchema, + t_GetCustomersCustomerSourcesIdQuerySchema, + t_GetCustomersCustomerSourcesIdRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerSourcesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerSourcesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerSourcesId = ( + params: Params< + t_PostCustomersCustomerSourcesIdParamSchema, + void, + t_PostCustomersCustomerSourcesIdRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerSourcesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerSourcesIdVerifyResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerSourcesIdVerify = ( + params: Params< + t_PostCustomersCustomerSourcesIdVerifyParamSchema, + void, + t_PostCustomersCustomerSourcesIdVerifyRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerSourcesIdVerifyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerSubscriptionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_subscription[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerSubscriptions = ( + params: Params< + t_GetCustomersCustomerSubscriptionsParamSchema, + t_GetCustomersCustomerSubscriptionsQuerySchema, + t_GetCustomersCustomerSubscriptionsRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerSubscriptionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerSubscriptionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerSubscriptions = ( + params: Params< + t_PostCustomersCustomerSubscriptionsParamSchema, + void, + t_PostCustomersCustomerSubscriptionsRequestBodySchema | undefined, + void + >, + respond: PostCustomersCustomerSubscriptionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type DeleteCustomersCustomerSubscriptionsSubscriptionExposedId = ( + params: Params< + t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + void, + | t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema + | undefined, + void + >, + respond: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerSubscriptionsSubscriptionExposedIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerSubscriptionsSubscriptionExposedId = ( + params: Params< + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema, + | t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema + | undefined, + void + >, + respond: GetCustomersCustomerSubscriptionsSubscriptionExposedIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerSubscriptionsSubscriptionExposedIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerSubscriptionsSubscriptionExposedId = ( + params: Params< + t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + void, + | t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema + | undefined, + void + >, + respond: PostCustomersCustomerSubscriptionsSubscriptionExposedIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount = + ( + params: Params< + t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema, + void, + | t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema + | undefined, + void + >, + respond: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountResponder, + req: Request, + res: Response, + next: NextFunction, + ) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount = ( + params: Params< + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema, + t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema, + | t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema + | undefined, + void + >, + respond: GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerTaxIdsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_tax_id[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerTaxIds = ( + params: Params< + t_GetCustomersCustomerTaxIdsParamSchema, + t_GetCustomersCustomerTaxIdsQuerySchema, + t_GetCustomersCustomerTaxIdsRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerTaxIdsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostCustomersCustomerTaxIdsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostCustomersCustomerTaxIds = ( + params: Params< + t_PostCustomersCustomerTaxIdsParamSchema, + void, + t_PostCustomersCustomerTaxIdsRequestBodySchema, + void + >, + respond: PostCustomersCustomerTaxIdsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteCustomersCustomerTaxIdsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteCustomersCustomerTaxIdsId = ( + params: Params< + t_DeleteCustomersCustomerTaxIdsIdParamSchema, + void, + t_DeleteCustomersCustomerTaxIdsIdRequestBodySchema | undefined, + void + >, + respond: DeleteCustomersCustomerTaxIdsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetCustomersCustomerTaxIdsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetCustomersCustomerTaxIdsId = ( + params: Params< + t_GetCustomersCustomerTaxIdsIdParamSchema, + t_GetCustomersCustomerTaxIdsIdQuerySchema, + t_GetCustomersCustomerTaxIdsIdRequestBodySchema | undefined, + void + >, + respond: GetCustomersCustomerTaxIdsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetDisputesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_dispute[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetDisputes = ( + params: Params< + void, + t_GetDisputesQuerySchema, + t_GetDisputesRequestBodySchema | undefined, + void + >, + respond: GetDisputesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetDisputesDisputeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetDisputesDispute = ( + params: Params< + t_GetDisputesDisputeParamSchema, + t_GetDisputesDisputeQuerySchema, + t_GetDisputesDisputeRequestBodySchema | undefined, + void + >, + respond: GetDisputesDisputeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostDisputesDisputeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostDisputesDispute = ( + params: Params< + t_PostDisputesDisputeParamSchema, + void, + t_PostDisputesDisputeRequestBodySchema | undefined, + void + >, + respond: PostDisputesDisputeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostDisputesDisputeCloseResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostDisputesDisputeClose = ( + params: Params< + t_PostDisputesDisputeCloseParamSchema, + void, + t_PostDisputesDisputeCloseRequestBodySchema | undefined, + void + >, + respond: PostDisputesDisputeCloseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetEntitlementsActiveEntitlementsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_entitlements_active_entitlement[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEntitlementsActiveEntitlements = ( + params: Params< + void, + t_GetEntitlementsActiveEntitlementsQuerySchema, + t_GetEntitlementsActiveEntitlementsRequestBodySchema | undefined, + void + >, + respond: GetEntitlementsActiveEntitlementsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetEntitlementsActiveEntitlementsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEntitlementsActiveEntitlementsId = ( + params: Params< + t_GetEntitlementsActiveEntitlementsIdParamSchema, + t_GetEntitlementsActiveEntitlementsIdQuerySchema, + t_GetEntitlementsActiveEntitlementsIdRequestBodySchema | undefined, + void + >, + respond: GetEntitlementsActiveEntitlementsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetEntitlementsFeaturesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_entitlements_feature[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEntitlementsFeatures = ( + params: Params< + void, + t_GetEntitlementsFeaturesQuerySchema, + t_GetEntitlementsFeaturesRequestBodySchema | undefined, + void + >, + respond: GetEntitlementsFeaturesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostEntitlementsFeaturesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostEntitlementsFeatures = ( + params: Params, + respond: PostEntitlementsFeaturesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetEntitlementsFeaturesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEntitlementsFeaturesId = ( + params: Params< + t_GetEntitlementsFeaturesIdParamSchema, + t_GetEntitlementsFeaturesIdQuerySchema, + t_GetEntitlementsFeaturesIdRequestBodySchema | undefined, + void + >, + respond: GetEntitlementsFeaturesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostEntitlementsFeaturesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostEntitlementsFeaturesId = ( + params: Params< + t_PostEntitlementsFeaturesIdParamSchema, + void, + t_PostEntitlementsFeaturesIdRequestBodySchema | undefined, + void + >, + respond: PostEntitlementsFeaturesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostEphemeralKeysResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostEphemeralKeys = ( + params: Params< + void, + void, + t_PostEphemeralKeysRequestBodySchema | undefined, + void + >, + respond: PostEphemeralKeysResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteEphemeralKeysKeyResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteEphemeralKeysKey = ( + params: Params< + t_DeleteEphemeralKeysKeyParamSchema, + void, + t_DeleteEphemeralKeysKeyRequestBodySchema | undefined, + void + >, + respond: DeleteEphemeralKeysKeyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetEventsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_event[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEvents = ( + params: Params< + void, + t_GetEventsQuerySchema, + t_GetEventsRequestBodySchema | undefined, + void + >, + respond: GetEventsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetEventsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetEventsId = ( + params: Params< + t_GetEventsIdParamSchema, + t_GetEventsIdQuerySchema, + t_GetEventsIdRequestBodySchema | undefined, + void + >, + respond: GetEventsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetExchangeRatesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_exchange_rate[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetExchangeRates = ( + params: Params< + void, + t_GetExchangeRatesQuerySchema, + t_GetExchangeRatesRequestBodySchema | undefined, + void + >, + respond: GetExchangeRatesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetExchangeRatesRateIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetExchangeRatesRateId = ( + params: Params< + t_GetExchangeRatesRateIdParamSchema, + t_GetExchangeRatesRateIdQuerySchema, + t_GetExchangeRatesRateIdRequestBodySchema | undefined, + void + >, + respond: GetExchangeRatesRateIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostExternalAccountsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostExternalAccountsId = ( + params: Params< + t_PostExternalAccountsIdParamSchema, + void, + t_PostExternalAccountsIdRequestBodySchema | undefined, + void + >, + respond: PostExternalAccountsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFileLinksResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_file_link[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFileLinks = ( + params: Params< + void, + t_GetFileLinksQuerySchema, + t_GetFileLinksRequestBodySchema | undefined, + void + >, + respond: GetFileLinksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostFileLinksResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostFileLinks = ( + params: Params, + respond: PostFileLinksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFileLinksLinkResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFileLinksLink = ( + params: Params< + t_GetFileLinksLinkParamSchema, + t_GetFileLinksLinkQuerySchema, + t_GetFileLinksLinkRequestBodySchema | undefined, + void + >, + respond: GetFileLinksLinkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostFileLinksLinkResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostFileLinksLink = ( + params: Params< + t_PostFileLinksLinkParamSchema, + void, + t_PostFileLinksLinkRequestBodySchema | undefined, + void + >, + respond: PostFileLinksLinkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFilesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_file[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFiles = ( + params: Params< + void, + t_GetFilesQuerySchema, + t_GetFilesRequestBodySchema | undefined, + void + >, + respond: GetFilesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostFilesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostFiles = ( + params: Params, + respond: PostFilesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFilesFileResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFilesFile = ( + params: Params< + t_GetFilesFileParamSchema, + t_GetFilesFileQuerySchema, + t_GetFilesFileRequestBodySchema | undefined, + void + >, + respond: GetFilesFileResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFinancialConnectionsAccountsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_financial_connections_account[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFinancialConnectionsAccounts = ( + params: Params< + void, + t_GetFinancialConnectionsAccountsQuerySchema, + t_GetFinancialConnectionsAccountsRequestBodySchema | undefined, + void + >, + respond: GetFinancialConnectionsAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFinancialConnectionsAccountsAccountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFinancialConnectionsAccountsAccount = ( + params: Params< + t_GetFinancialConnectionsAccountsAccountParamSchema, + t_GetFinancialConnectionsAccountsAccountQuerySchema, + t_GetFinancialConnectionsAccountsAccountRequestBodySchema | undefined, + void + >, + respond: GetFinancialConnectionsAccountsAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostFinancialConnectionsAccountsAccountDisconnectResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostFinancialConnectionsAccountsAccountDisconnect = ( + params: Params< + t_PostFinancialConnectionsAccountsAccountDisconnectParamSchema, + void, + | t_PostFinancialConnectionsAccountsAccountDisconnectRequestBodySchema + | undefined, + void + >, + respond: PostFinancialConnectionsAccountsAccountDisconnectResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFinancialConnectionsAccountsAccountOwnersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_financial_connections_account_owner[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFinancialConnectionsAccountsAccountOwners = ( + params: Params< + t_GetFinancialConnectionsAccountsAccountOwnersParamSchema, + t_GetFinancialConnectionsAccountsAccountOwnersQuerySchema, + t_GetFinancialConnectionsAccountsAccountOwnersRequestBodySchema | undefined, + void + >, + respond: GetFinancialConnectionsAccountsAccountOwnersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostFinancialConnectionsAccountsAccountRefreshResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostFinancialConnectionsAccountsAccountRefresh = ( + params: Params< + t_PostFinancialConnectionsAccountsAccountRefreshParamSchema, + void, + t_PostFinancialConnectionsAccountsAccountRefreshRequestBodySchema, + void + >, + respond: PostFinancialConnectionsAccountsAccountRefreshResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostFinancialConnectionsAccountsAccountSubscribeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostFinancialConnectionsAccountsAccountSubscribe = ( + params: Params< + t_PostFinancialConnectionsAccountsAccountSubscribeParamSchema, + void, + t_PostFinancialConnectionsAccountsAccountSubscribeRequestBodySchema, + void + >, + respond: PostFinancialConnectionsAccountsAccountSubscribeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostFinancialConnectionsAccountsAccountUnsubscribeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostFinancialConnectionsAccountsAccountUnsubscribe = ( + params: Params< + t_PostFinancialConnectionsAccountsAccountUnsubscribeParamSchema, + void, + t_PostFinancialConnectionsAccountsAccountUnsubscribeRequestBodySchema, + void + >, + respond: PostFinancialConnectionsAccountsAccountUnsubscribeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostFinancialConnectionsSessionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostFinancialConnectionsSessions = ( + params: Params< + void, + void, + t_PostFinancialConnectionsSessionsRequestBodySchema, + void + >, + respond: PostFinancialConnectionsSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFinancialConnectionsSessionsSessionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFinancialConnectionsSessionsSession = ( + params: Params< + t_GetFinancialConnectionsSessionsSessionParamSchema, + t_GetFinancialConnectionsSessionsSessionQuerySchema, + t_GetFinancialConnectionsSessionsSessionRequestBodySchema | undefined, + void + >, + respond: GetFinancialConnectionsSessionsSessionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFinancialConnectionsTransactionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_financial_connections_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFinancialConnectionsTransactions = ( + params: Params< + void, + t_GetFinancialConnectionsTransactionsQuerySchema, + t_GetFinancialConnectionsTransactionsRequestBodySchema | undefined, + void + >, + respond: GetFinancialConnectionsTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetFinancialConnectionsTransactionsTransactionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetFinancialConnectionsTransactionsTransaction = ( + params: Params< + t_GetFinancialConnectionsTransactionsTransactionParamSchema, + t_GetFinancialConnectionsTransactionsTransactionQuerySchema, + | t_GetFinancialConnectionsTransactionsTransactionRequestBodySchema + | undefined, + void + >, + respond: GetFinancialConnectionsTransactionsTransactionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetForwardingRequestsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_forwarding_request[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetForwardingRequests = ( + params: Params< + void, + t_GetForwardingRequestsQuerySchema, + t_GetForwardingRequestsRequestBodySchema | undefined, + void + >, + respond: GetForwardingRequestsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostForwardingRequestsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostForwardingRequests = ( + params: Params, + respond: PostForwardingRequestsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetForwardingRequestsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetForwardingRequestsId = ( + params: Params< + t_GetForwardingRequestsIdParamSchema, + t_GetForwardingRequestsIdQuerySchema, + t_GetForwardingRequestsIdRequestBodySchema | undefined, + void + >, + respond: GetForwardingRequestsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIdentityVerificationReportsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_identity_verification_report[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIdentityVerificationReports = ( + params: Params< + void, + t_GetIdentityVerificationReportsQuerySchema, + t_GetIdentityVerificationReportsRequestBodySchema | undefined, + void + >, + respond: GetIdentityVerificationReportsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIdentityVerificationReportsReportResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIdentityVerificationReportsReport = ( + params: Params< + t_GetIdentityVerificationReportsReportParamSchema, + t_GetIdentityVerificationReportsReportQuerySchema, + t_GetIdentityVerificationReportsReportRequestBodySchema | undefined, + void + >, + respond: GetIdentityVerificationReportsReportResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIdentityVerificationSessionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_identity_verification_session[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIdentityVerificationSessions = ( + params: Params< + void, + t_GetIdentityVerificationSessionsQuerySchema, + t_GetIdentityVerificationSessionsRequestBodySchema | undefined, + void + >, + respond: GetIdentityVerificationSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIdentityVerificationSessionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIdentityVerificationSessions = ( + params: Params< + void, + void, + t_PostIdentityVerificationSessionsRequestBodySchema | undefined, + void + >, + respond: PostIdentityVerificationSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIdentityVerificationSessionsSessionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIdentityVerificationSessionsSession = ( + params: Params< + t_GetIdentityVerificationSessionsSessionParamSchema, + t_GetIdentityVerificationSessionsSessionQuerySchema, + t_GetIdentityVerificationSessionsSessionRequestBodySchema | undefined, + void + >, + respond: GetIdentityVerificationSessionsSessionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIdentityVerificationSessionsSessionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIdentityVerificationSessionsSession = ( + params: Params< + t_PostIdentityVerificationSessionsSessionParamSchema, + void, + t_PostIdentityVerificationSessionsSessionRequestBodySchema | undefined, + void + >, + respond: PostIdentityVerificationSessionsSessionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIdentityVerificationSessionsSessionCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIdentityVerificationSessionsSessionCancel = ( + params: Params< + t_PostIdentityVerificationSessionsSessionCancelParamSchema, + void, + | t_PostIdentityVerificationSessionsSessionCancelRequestBodySchema + | undefined, + void + >, + respond: PostIdentityVerificationSessionsSessionCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIdentityVerificationSessionsSessionRedactResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIdentityVerificationSessionsSessionRedact = ( + params: Params< + t_PostIdentityVerificationSessionsSessionRedactParamSchema, + void, + | t_PostIdentityVerificationSessionsSessionRedactRequestBodySchema + | undefined, + void + >, + respond: PostIdentityVerificationSessionsSessionRedactResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoicePaymentsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_invoice_payment[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoicePayments = ( + params: Params< + void, + t_GetInvoicePaymentsQuerySchema, + t_GetInvoicePaymentsRequestBodySchema | undefined, + void + >, + respond: GetInvoicePaymentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoicePaymentsInvoicePaymentResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoicePaymentsInvoicePayment = ( + params: Params< + t_GetInvoicePaymentsInvoicePaymentParamSchema, + t_GetInvoicePaymentsInvoicePaymentQuerySchema, + t_GetInvoicePaymentsInvoicePaymentRequestBodySchema | undefined, + void + >, + respond: GetInvoicePaymentsInvoicePaymentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoiceRenderingTemplatesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_invoice_rendering_template[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoiceRenderingTemplates = ( + params: Params< + void, + t_GetInvoiceRenderingTemplatesQuerySchema, + t_GetInvoiceRenderingTemplatesRequestBodySchema | undefined, + void + >, + respond: GetInvoiceRenderingTemplatesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoiceRenderingTemplatesTemplateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoiceRenderingTemplatesTemplate = ( + params: Params< + t_GetInvoiceRenderingTemplatesTemplateParamSchema, + t_GetInvoiceRenderingTemplatesTemplateQuerySchema, + t_GetInvoiceRenderingTemplatesTemplateRequestBodySchema | undefined, + void + >, + respond: GetInvoiceRenderingTemplatesTemplateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoiceRenderingTemplatesTemplateArchiveResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoiceRenderingTemplatesTemplateArchive = ( + params: Params< + t_PostInvoiceRenderingTemplatesTemplateArchiveParamSchema, + void, + t_PostInvoiceRenderingTemplatesTemplateArchiveRequestBodySchema | undefined, + void + >, + respond: PostInvoiceRenderingTemplatesTemplateArchiveResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoiceRenderingTemplatesTemplateUnarchiveResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoiceRenderingTemplatesTemplateUnarchive = ( + params: Params< + t_PostInvoiceRenderingTemplatesTemplateUnarchiveParamSchema, + void, + | t_PostInvoiceRenderingTemplatesTemplateUnarchiveRequestBodySchema + | undefined, + void + >, + respond: PostInvoiceRenderingTemplatesTemplateUnarchiveResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoiceitemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_invoiceitem[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoiceitems = ( + params: Params< + void, + t_GetInvoiceitemsQuerySchema, + t_GetInvoiceitemsRequestBodySchema | undefined, + void + >, + respond: GetInvoiceitemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoiceitemsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoiceitems = ( + params: Params, + respond: PostInvoiceitemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteInvoiceitemsInvoiceitemResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteInvoiceitemsInvoiceitem = ( + params: Params< + t_DeleteInvoiceitemsInvoiceitemParamSchema, + void, + t_DeleteInvoiceitemsInvoiceitemRequestBodySchema | undefined, + void + >, + respond: DeleteInvoiceitemsInvoiceitemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoiceitemsInvoiceitemResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoiceitemsInvoiceitem = ( + params: Params< + t_GetInvoiceitemsInvoiceitemParamSchema, + t_GetInvoiceitemsInvoiceitemQuerySchema, + t_GetInvoiceitemsInvoiceitemRequestBodySchema | undefined, + void + >, + respond: GetInvoiceitemsInvoiceitemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoiceitemsInvoiceitemResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoiceitemsInvoiceitem = ( + params: Params< + t_PostInvoiceitemsInvoiceitemParamSchema, + void, + t_PostInvoiceitemsInvoiceitemRequestBodySchema | undefined, + void + >, + respond: PostInvoiceitemsInvoiceitemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoicesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_invoice[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoices = ( + params: Params< + void, + t_GetInvoicesQuerySchema, + t_GetInvoicesRequestBodySchema | undefined, + void + >, + respond: GetInvoicesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoices = ( + params: Params, + respond: PostInvoicesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesCreatePreviewResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesCreatePreview = ( + params: Params< + void, + void, + t_PostInvoicesCreatePreviewRequestBodySchema | undefined, + void + >, + respond: PostInvoicesCreatePreviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoicesSearchResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_invoice[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoicesSearch = ( + params: Params< + void, + t_GetInvoicesSearchQuerySchema, + t_GetInvoicesSearchRequestBodySchema | undefined, + void + >, + respond: GetInvoicesSearchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteInvoicesInvoiceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteInvoicesInvoice = ( + params: Params< + t_DeleteInvoicesInvoiceParamSchema, + void, + t_DeleteInvoicesInvoiceRequestBodySchema | undefined, + void + >, + respond: DeleteInvoicesInvoiceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoicesInvoiceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoicesInvoice = ( + params: Params< + t_GetInvoicesInvoiceParamSchema, + t_GetInvoicesInvoiceQuerySchema, + t_GetInvoicesInvoiceRequestBodySchema | undefined, + void + >, + respond: GetInvoicesInvoiceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoice = ( + params: Params< + t_PostInvoicesInvoiceParamSchema, + void, + t_PostInvoicesInvoiceRequestBodySchema | undefined, + void + >, + respond: PostInvoicesInvoiceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceAddLinesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoiceAddLines = ( + params: Params< + t_PostInvoicesInvoiceAddLinesParamSchema, + void, + t_PostInvoicesInvoiceAddLinesRequestBodySchema, + void + >, + respond: PostInvoicesInvoiceAddLinesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceFinalizeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoiceFinalize = ( + params: Params< + t_PostInvoicesInvoiceFinalizeParamSchema, + void, + t_PostInvoicesInvoiceFinalizeRequestBodySchema | undefined, + void + >, + respond: PostInvoicesInvoiceFinalizeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetInvoicesInvoiceLinesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_line_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetInvoicesInvoiceLines = ( + params: Params< + t_GetInvoicesInvoiceLinesParamSchema, + t_GetInvoicesInvoiceLinesQuerySchema, + t_GetInvoicesInvoiceLinesRequestBodySchema | undefined, + void + >, + respond: GetInvoicesInvoiceLinesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceLinesLineItemIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoiceLinesLineItemId = ( + params: Params< + t_PostInvoicesInvoiceLinesLineItemIdParamSchema, + void, + t_PostInvoicesInvoiceLinesLineItemIdRequestBodySchema | undefined, + void + >, + respond: PostInvoicesInvoiceLinesLineItemIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceMarkUncollectibleResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoiceMarkUncollectible = ( + params: Params< + t_PostInvoicesInvoiceMarkUncollectibleParamSchema, + void, + t_PostInvoicesInvoiceMarkUncollectibleRequestBodySchema | undefined, + void + >, + respond: PostInvoicesInvoiceMarkUncollectibleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoicePayResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoicePay = ( + params: Params< + t_PostInvoicesInvoicePayParamSchema, + void, + t_PostInvoicesInvoicePayRequestBodySchema | undefined, + void + >, + respond: PostInvoicesInvoicePayResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceRemoveLinesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoiceRemoveLines = ( + params: Params< + t_PostInvoicesInvoiceRemoveLinesParamSchema, + void, + t_PostInvoicesInvoiceRemoveLinesRequestBodySchema, + void + >, + respond: PostInvoicesInvoiceRemoveLinesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceSendResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoiceSend = ( + params: Params< + t_PostInvoicesInvoiceSendParamSchema, + void, + t_PostInvoicesInvoiceSendRequestBodySchema | undefined, + void + >, + respond: PostInvoicesInvoiceSendResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceUpdateLinesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoiceUpdateLines = ( + params: Params< + t_PostInvoicesInvoiceUpdateLinesParamSchema, + void, + t_PostInvoicesInvoiceUpdateLinesRequestBodySchema, + void + >, + respond: PostInvoicesInvoiceUpdateLinesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostInvoicesInvoiceVoidResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostInvoicesInvoiceVoid = ( + params: Params< + t_PostInvoicesInvoiceVoidParamSchema, + void, + t_PostInvoicesInvoiceVoidRequestBodySchema | undefined, + void + >, + respond: PostInvoicesInvoiceVoidResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingAuthorizationsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_issuing_authorization[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingAuthorizations = ( + params: Params< + void, + t_GetIssuingAuthorizationsQuerySchema, + t_GetIssuingAuthorizationsRequestBodySchema | undefined, + void + >, + respond: GetIssuingAuthorizationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingAuthorizationsAuthorizationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingAuthorizationsAuthorization = ( + params: Params< + t_GetIssuingAuthorizationsAuthorizationParamSchema, + t_GetIssuingAuthorizationsAuthorizationQuerySchema, + t_GetIssuingAuthorizationsAuthorizationRequestBodySchema | undefined, + void + >, + respond: GetIssuingAuthorizationsAuthorizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingAuthorizationsAuthorizationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingAuthorizationsAuthorization = ( + params: Params< + t_PostIssuingAuthorizationsAuthorizationParamSchema, + void, + t_PostIssuingAuthorizationsAuthorizationRequestBodySchema | undefined, + void + >, + respond: PostIssuingAuthorizationsAuthorizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingAuthorizationsAuthorizationApproveResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingAuthorizationsAuthorizationApprove = ( + params: Params< + t_PostIssuingAuthorizationsAuthorizationApproveParamSchema, + void, + | t_PostIssuingAuthorizationsAuthorizationApproveRequestBodySchema + | undefined, + void + >, + respond: PostIssuingAuthorizationsAuthorizationApproveResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingAuthorizationsAuthorizationDeclineResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingAuthorizationsAuthorizationDecline = ( + params: Params< + t_PostIssuingAuthorizationsAuthorizationDeclineParamSchema, + void, + | t_PostIssuingAuthorizationsAuthorizationDeclineRequestBodySchema + | undefined, + void + >, + respond: PostIssuingAuthorizationsAuthorizationDeclineResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingCardholdersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_issuing_cardholder[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingCardholders = ( + params: Params< + void, + t_GetIssuingCardholdersQuerySchema, + t_GetIssuingCardholdersRequestBodySchema | undefined, + void + >, + respond: GetIssuingCardholdersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingCardholdersResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingCardholders = ( + params: Params, + respond: PostIssuingCardholdersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingCardholdersCardholderResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingCardholdersCardholder = ( + params: Params< + t_GetIssuingCardholdersCardholderParamSchema, + t_GetIssuingCardholdersCardholderQuerySchema, + t_GetIssuingCardholdersCardholderRequestBodySchema | undefined, + void + >, + respond: GetIssuingCardholdersCardholderResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingCardholdersCardholderResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingCardholdersCardholder = ( + params: Params< + t_PostIssuingCardholdersCardholderParamSchema, + void, + t_PostIssuingCardholdersCardholderRequestBodySchema | undefined, + void + >, + respond: PostIssuingCardholdersCardholderResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingCardsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_issuing_card[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingCards = ( + params: Params< + void, + t_GetIssuingCardsQuerySchema, + t_GetIssuingCardsRequestBodySchema | undefined, + void + >, + respond: GetIssuingCardsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingCardsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingCards = ( + params: Params, + respond: PostIssuingCardsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingCardsCardResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingCardsCard = ( + params: Params< + t_GetIssuingCardsCardParamSchema, + t_GetIssuingCardsCardQuerySchema, + t_GetIssuingCardsCardRequestBodySchema | undefined, + void + >, + respond: GetIssuingCardsCardResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingCardsCardResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingCardsCard = ( + params: Params< + t_PostIssuingCardsCardParamSchema, + void, + t_PostIssuingCardsCardRequestBodySchema | undefined, + void + >, + respond: PostIssuingCardsCardResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingDisputesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_issuing_dispute[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingDisputes = ( + params: Params< + void, + t_GetIssuingDisputesQuerySchema, + t_GetIssuingDisputesRequestBodySchema | undefined, + void + >, + respond: GetIssuingDisputesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingDisputesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingDisputes = ( + params: Params< + void, + void, + t_PostIssuingDisputesRequestBodySchema | undefined, + void + >, + respond: PostIssuingDisputesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingDisputesDisputeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingDisputesDispute = ( + params: Params< + t_GetIssuingDisputesDisputeParamSchema, + t_GetIssuingDisputesDisputeQuerySchema, + t_GetIssuingDisputesDisputeRequestBodySchema | undefined, + void + >, + respond: GetIssuingDisputesDisputeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingDisputesDisputeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingDisputesDispute = ( + params: Params< + t_PostIssuingDisputesDisputeParamSchema, + void, + t_PostIssuingDisputesDisputeRequestBodySchema | undefined, + void + >, + respond: PostIssuingDisputesDisputeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingDisputesDisputeSubmitResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingDisputesDisputeSubmit = ( + params: Params< + t_PostIssuingDisputesDisputeSubmitParamSchema, + void, + t_PostIssuingDisputesDisputeSubmitRequestBodySchema | undefined, + void + >, + respond: PostIssuingDisputesDisputeSubmitResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingPersonalizationDesignsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_issuing_personalization_design[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingPersonalizationDesigns = ( + params: Params< + void, + t_GetIssuingPersonalizationDesignsQuerySchema, + t_GetIssuingPersonalizationDesignsRequestBodySchema | undefined, + void + >, + respond: GetIssuingPersonalizationDesignsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingPersonalizationDesignsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingPersonalizationDesigns = ( + params: Params< + void, + void, + t_PostIssuingPersonalizationDesignsRequestBodySchema, + void + >, + respond: PostIssuingPersonalizationDesignsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingPersonalizationDesignsPersonalizationDesignResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingPersonalizationDesignsPersonalizationDesign = ( + params: Params< + t_GetIssuingPersonalizationDesignsPersonalizationDesignParamSchema, + t_GetIssuingPersonalizationDesignsPersonalizationDesignQuerySchema, + | t_GetIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema + | undefined, + void + >, + respond: GetIssuingPersonalizationDesignsPersonalizationDesignResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingPersonalizationDesignsPersonalizationDesignResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingPersonalizationDesignsPersonalizationDesign = ( + params: Params< + t_PostIssuingPersonalizationDesignsPersonalizationDesignParamSchema, + void, + | t_PostIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema + | undefined, + void + >, + respond: PostIssuingPersonalizationDesignsPersonalizationDesignResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingPhysicalBundlesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_issuing_physical_bundle[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingPhysicalBundles = ( + params: Params< + void, + t_GetIssuingPhysicalBundlesQuerySchema, + t_GetIssuingPhysicalBundlesRequestBodySchema | undefined, + void + >, + respond: GetIssuingPhysicalBundlesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingPhysicalBundlesPhysicalBundleResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingPhysicalBundlesPhysicalBundle = ( + params: Params< + t_GetIssuingPhysicalBundlesPhysicalBundleParamSchema, + t_GetIssuingPhysicalBundlesPhysicalBundleQuerySchema, + t_GetIssuingPhysicalBundlesPhysicalBundleRequestBodySchema | undefined, + void + >, + respond: GetIssuingPhysicalBundlesPhysicalBundleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingSettlementsSettlementResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingSettlementsSettlement = ( + params: Params< + t_GetIssuingSettlementsSettlementParamSchema, + t_GetIssuingSettlementsSettlementQuerySchema, + t_GetIssuingSettlementsSettlementRequestBodySchema | undefined, + void + >, + respond: GetIssuingSettlementsSettlementResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingSettlementsSettlementResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingSettlementsSettlement = ( + params: Params< + t_PostIssuingSettlementsSettlementParamSchema, + void, + t_PostIssuingSettlementsSettlementRequestBodySchema | undefined, + void + >, + respond: PostIssuingSettlementsSettlementResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingTokensResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_issuing_token[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingTokens = ( + params: Params< + void, + t_GetIssuingTokensQuerySchema, + t_GetIssuingTokensRequestBodySchema | undefined, + void + >, + respond: GetIssuingTokensResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingTokensTokenResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingTokensToken = ( + params: Params< + t_GetIssuingTokensTokenParamSchema, + t_GetIssuingTokensTokenQuerySchema, + t_GetIssuingTokensTokenRequestBodySchema | undefined, + void + >, + respond: GetIssuingTokensTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingTokensTokenResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingTokensToken = ( + params: Params< + t_PostIssuingTokensTokenParamSchema, + void, + t_PostIssuingTokensTokenRequestBodySchema, + void + >, + respond: PostIssuingTokensTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingTransactionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_issuing_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingTransactions = ( + params: Params< + void, + t_GetIssuingTransactionsQuerySchema, + t_GetIssuingTransactionsRequestBodySchema | undefined, + void + >, + respond: GetIssuingTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetIssuingTransactionsTransactionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetIssuingTransactionsTransaction = ( + params: Params< + t_GetIssuingTransactionsTransactionParamSchema, + t_GetIssuingTransactionsTransactionQuerySchema, + t_GetIssuingTransactionsTransactionRequestBodySchema | undefined, + void + >, + respond: GetIssuingTransactionsTransactionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostIssuingTransactionsTransactionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostIssuingTransactionsTransaction = ( + params: Params< + t_PostIssuingTransactionsTransactionParamSchema, + void, + t_PostIssuingTransactionsTransactionRequestBodySchema | undefined, + void + >, + respond: PostIssuingTransactionsTransactionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostLinkAccountSessionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostLinkAccountSessions = ( + params: Params, + respond: PostLinkAccountSessionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetLinkAccountSessionsSessionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetLinkAccountSessionsSession = ( + params: Params< + t_GetLinkAccountSessionsSessionParamSchema, + t_GetLinkAccountSessionsSessionQuerySchema, + t_GetLinkAccountSessionsSessionRequestBodySchema | undefined, + void + >, + respond: GetLinkAccountSessionsSessionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetLinkedAccountsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_financial_connections_account[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetLinkedAccounts = ( + params: Params< + void, + t_GetLinkedAccountsQuerySchema, + t_GetLinkedAccountsRequestBodySchema | undefined, + void + >, + respond: GetLinkedAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetLinkedAccountsAccountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetLinkedAccountsAccount = ( + params: Params< + t_GetLinkedAccountsAccountParamSchema, + t_GetLinkedAccountsAccountQuerySchema, + t_GetLinkedAccountsAccountRequestBodySchema | undefined, + void + >, + respond: GetLinkedAccountsAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostLinkedAccountsAccountDisconnectResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostLinkedAccountsAccountDisconnect = ( + params: Params< + t_PostLinkedAccountsAccountDisconnectParamSchema, + void, + t_PostLinkedAccountsAccountDisconnectRequestBodySchema | undefined, + void + >, + respond: PostLinkedAccountsAccountDisconnectResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetLinkedAccountsAccountOwnersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_financial_connections_account_owner[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetLinkedAccountsAccountOwners = ( + params: Params< + t_GetLinkedAccountsAccountOwnersParamSchema, + t_GetLinkedAccountsAccountOwnersQuerySchema, + t_GetLinkedAccountsAccountOwnersRequestBodySchema | undefined, + void + >, + respond: GetLinkedAccountsAccountOwnersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostLinkedAccountsAccountRefreshResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostLinkedAccountsAccountRefresh = ( + params: Params< + t_PostLinkedAccountsAccountRefreshParamSchema, + void, + t_PostLinkedAccountsAccountRefreshRequestBodySchema, + void + >, + respond: PostLinkedAccountsAccountRefreshResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetMandatesMandateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetMandatesMandate = ( + params: Params< + t_GetMandatesMandateParamSchema, + t_GetMandatesMandateQuerySchema, + t_GetMandatesMandateRequestBodySchema | undefined, + void + >, + respond: GetMandatesMandateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentIntentsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_payment_intent[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentIntents = ( + params: Params< + void, + t_GetPaymentIntentsQuerySchema, + t_GetPaymentIntentsRequestBodySchema | undefined, + void + >, + respond: GetPaymentIntentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentIntentsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentIntents = ( + params: Params, + respond: PostPaymentIntentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentIntentsSearchResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_payment_intent[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentIntentsSearch = ( + params: Params< + void, + t_GetPaymentIntentsSearchQuerySchema, + t_GetPaymentIntentsSearchRequestBodySchema | undefined, + void + >, + respond: GetPaymentIntentsSearchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentIntentsIntentResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentIntentsIntent = ( + params: Params< + t_GetPaymentIntentsIntentParamSchema, + t_GetPaymentIntentsIntentQuerySchema, + t_GetPaymentIntentsIntentRequestBodySchema | undefined, + void + >, + respond: GetPaymentIntentsIntentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentIntentsIntentResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentIntentsIntent = ( + params: Params< + t_PostPaymentIntentsIntentParamSchema, + void, + t_PostPaymentIntentsIntentRequestBodySchema | undefined, + void + >, + respond: PostPaymentIntentsIntentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentIntentsIntentApplyCustomerBalanceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentIntentsIntentApplyCustomerBalance = ( + params: Params< + t_PostPaymentIntentsIntentApplyCustomerBalanceParamSchema, + void, + t_PostPaymentIntentsIntentApplyCustomerBalanceRequestBodySchema | undefined, + void + >, + respond: PostPaymentIntentsIntentApplyCustomerBalanceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentIntentsIntentCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentIntentsIntentCancel = ( + params: Params< + t_PostPaymentIntentsIntentCancelParamSchema, + void, + t_PostPaymentIntentsIntentCancelRequestBodySchema | undefined, + void + >, + respond: PostPaymentIntentsIntentCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentIntentsIntentCaptureResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentIntentsIntentCapture = ( + params: Params< + t_PostPaymentIntentsIntentCaptureParamSchema, + void, + t_PostPaymentIntentsIntentCaptureRequestBodySchema | undefined, + void + >, + respond: PostPaymentIntentsIntentCaptureResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentIntentsIntentConfirmResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentIntentsIntentConfirm = ( + params: Params< + t_PostPaymentIntentsIntentConfirmParamSchema, + void, + t_PostPaymentIntentsIntentConfirmRequestBodySchema | undefined, + void + >, + respond: PostPaymentIntentsIntentConfirmResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentIntentsIntentIncrementAuthorizationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentIntentsIntentIncrementAuthorization = ( + params: Params< + t_PostPaymentIntentsIntentIncrementAuthorizationParamSchema, + void, + t_PostPaymentIntentsIntentIncrementAuthorizationRequestBodySchema, + void + >, + respond: PostPaymentIntentsIntentIncrementAuthorizationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentIntentsIntentVerifyMicrodepositsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentIntentsIntentVerifyMicrodeposits = ( + params: Params< + t_PostPaymentIntentsIntentVerifyMicrodepositsParamSchema, + void, + t_PostPaymentIntentsIntentVerifyMicrodepositsRequestBodySchema | undefined, + void + >, + respond: PostPaymentIntentsIntentVerifyMicrodepositsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentLinksResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_payment_link[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentLinks = ( + params: Params< + void, + t_GetPaymentLinksQuerySchema, + t_GetPaymentLinksRequestBodySchema | undefined, + void + >, + respond: GetPaymentLinksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentLinksResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentLinks = ( + params: Params, + respond: PostPaymentLinksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentLinksPaymentLinkResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentLinksPaymentLink = ( + params: Params< + t_GetPaymentLinksPaymentLinkParamSchema, + t_GetPaymentLinksPaymentLinkQuerySchema, + t_GetPaymentLinksPaymentLinkRequestBodySchema | undefined, + void + >, + respond: GetPaymentLinksPaymentLinkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentLinksPaymentLinkResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentLinksPaymentLink = ( + params: Params< + t_PostPaymentLinksPaymentLinkParamSchema, + void, + t_PostPaymentLinksPaymentLinkRequestBodySchema | undefined, + void + >, + respond: PostPaymentLinksPaymentLinkResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentLinksPaymentLinkLineItemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentLinksPaymentLinkLineItems = ( + params: Params< + t_GetPaymentLinksPaymentLinkLineItemsParamSchema, + t_GetPaymentLinksPaymentLinkLineItemsQuerySchema, + t_GetPaymentLinksPaymentLinkLineItemsRequestBodySchema | undefined, + void + >, + respond: GetPaymentLinksPaymentLinkLineItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentMethodConfigurationsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_payment_method_configuration[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentMethodConfigurations = ( + params: Params< + void, + t_GetPaymentMethodConfigurationsQuerySchema, + t_GetPaymentMethodConfigurationsRequestBodySchema | undefined, + void + >, + respond: GetPaymentMethodConfigurationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodConfigurationsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethodConfigurations = ( + params: Params< + void, + void, + t_PostPaymentMethodConfigurationsRequestBodySchema | undefined, + void + >, + respond: PostPaymentMethodConfigurationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentMethodConfigurationsConfigurationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentMethodConfigurationsConfiguration = ( + params: Params< + t_GetPaymentMethodConfigurationsConfigurationParamSchema, + t_GetPaymentMethodConfigurationsConfigurationQuerySchema, + t_GetPaymentMethodConfigurationsConfigurationRequestBodySchema | undefined, + void + >, + respond: GetPaymentMethodConfigurationsConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodConfigurationsConfigurationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethodConfigurationsConfiguration = ( + params: Params< + t_PostPaymentMethodConfigurationsConfigurationParamSchema, + void, + t_PostPaymentMethodConfigurationsConfigurationRequestBodySchema | undefined, + void + >, + respond: PostPaymentMethodConfigurationsConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentMethodDomainsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_payment_method_domain[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentMethodDomains = ( + params: Params< + void, + t_GetPaymentMethodDomainsQuerySchema, + t_GetPaymentMethodDomainsRequestBodySchema | undefined, + void + >, + respond: GetPaymentMethodDomainsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodDomainsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethodDomains = ( + params: Params, + respond: PostPaymentMethodDomainsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentMethodDomainsPaymentMethodDomainResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentMethodDomainsPaymentMethodDomain = ( + params: Params< + t_GetPaymentMethodDomainsPaymentMethodDomainParamSchema, + t_GetPaymentMethodDomainsPaymentMethodDomainQuerySchema, + t_GetPaymentMethodDomainsPaymentMethodDomainRequestBodySchema | undefined, + void + >, + respond: GetPaymentMethodDomainsPaymentMethodDomainResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodDomainsPaymentMethodDomainResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethodDomainsPaymentMethodDomain = ( + params: Params< + t_PostPaymentMethodDomainsPaymentMethodDomainParamSchema, + void, + t_PostPaymentMethodDomainsPaymentMethodDomainRequestBodySchema | undefined, + void + >, + respond: PostPaymentMethodDomainsPaymentMethodDomainResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodDomainsPaymentMethodDomainValidateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethodDomainsPaymentMethodDomainValidate = ( + params: Params< + t_PostPaymentMethodDomainsPaymentMethodDomainValidateParamSchema, + void, + | t_PostPaymentMethodDomainsPaymentMethodDomainValidateRequestBodySchema + | undefined, + void + >, + respond: PostPaymentMethodDomainsPaymentMethodDomainValidateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentMethodsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_payment_method[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentMethods = ( + params: Params< + void, + t_GetPaymentMethodsQuerySchema, + t_GetPaymentMethodsRequestBodySchema | undefined, + void + >, + respond: GetPaymentMethodsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethods = ( + params: Params< + void, + void, + t_PostPaymentMethodsRequestBodySchema | undefined, + void + >, + respond: PostPaymentMethodsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPaymentMethodsPaymentMethodResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPaymentMethodsPaymentMethod = ( + params: Params< + t_GetPaymentMethodsPaymentMethodParamSchema, + t_GetPaymentMethodsPaymentMethodQuerySchema, + t_GetPaymentMethodsPaymentMethodRequestBodySchema | undefined, + void + >, + respond: GetPaymentMethodsPaymentMethodResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodsPaymentMethodResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethodsPaymentMethod = ( + params: Params< + t_PostPaymentMethodsPaymentMethodParamSchema, + void, + t_PostPaymentMethodsPaymentMethodRequestBodySchema | undefined, + void + >, + respond: PostPaymentMethodsPaymentMethodResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodsPaymentMethodAttachResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethodsPaymentMethodAttach = ( + params: Params< + t_PostPaymentMethodsPaymentMethodAttachParamSchema, + void, + t_PostPaymentMethodsPaymentMethodAttachRequestBodySchema, + void + >, + respond: PostPaymentMethodsPaymentMethodAttachResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPaymentMethodsPaymentMethodDetachResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPaymentMethodsPaymentMethodDetach = ( + params: Params< + t_PostPaymentMethodsPaymentMethodDetachParamSchema, + void, + t_PostPaymentMethodsPaymentMethodDetachRequestBodySchema | undefined, + void + >, + respond: PostPaymentMethodsPaymentMethodDetachResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPayoutsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_payout[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPayouts = ( + params: Params< + void, + t_GetPayoutsQuerySchema, + t_GetPayoutsRequestBodySchema | undefined, + void + >, + respond: GetPayoutsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPayoutsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPayouts = ( + params: Params, + respond: PostPayoutsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPayoutsPayoutResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPayoutsPayout = ( + params: Params< + t_GetPayoutsPayoutParamSchema, + t_GetPayoutsPayoutQuerySchema, + t_GetPayoutsPayoutRequestBodySchema | undefined, + void + >, + respond: GetPayoutsPayoutResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPayoutsPayoutResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPayoutsPayout = ( + params: Params< + t_PostPayoutsPayoutParamSchema, + void, + t_PostPayoutsPayoutRequestBodySchema | undefined, + void + >, + respond: PostPayoutsPayoutResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPayoutsPayoutCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPayoutsPayoutCancel = ( + params: Params< + t_PostPayoutsPayoutCancelParamSchema, + void, + t_PostPayoutsPayoutCancelRequestBodySchema | undefined, + void + >, + respond: PostPayoutsPayoutCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPayoutsPayoutReverseResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPayoutsPayoutReverse = ( + params: Params< + t_PostPayoutsPayoutReverseParamSchema, + void, + t_PostPayoutsPayoutReverseRequestBodySchema | undefined, + void + >, + respond: PostPayoutsPayoutReverseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPlansResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_plan[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPlans = ( + params: Params< + void, + t_GetPlansQuerySchema, + t_GetPlansRequestBodySchema | undefined, + void + >, + respond: GetPlansResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPlansResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPlans = ( + params: Params, + respond: PostPlansResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeletePlansPlanResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeletePlansPlan = ( + params: Params< + t_DeletePlansPlanParamSchema, + void, + t_DeletePlansPlanRequestBodySchema | undefined, + void + >, + respond: DeletePlansPlanResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPlansPlanResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPlansPlan = ( + params: Params< + t_GetPlansPlanParamSchema, + t_GetPlansPlanQuerySchema, + t_GetPlansPlanRequestBodySchema | undefined, + void + >, + respond: GetPlansPlanResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPlansPlanResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPlansPlan = ( + params: Params< + t_PostPlansPlanParamSchema, + void, + t_PostPlansPlanRequestBodySchema | undefined, + void + >, + respond: PostPlansPlanResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPricesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_price[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPrices = ( + params: Params< + void, + t_GetPricesQuerySchema, + t_GetPricesRequestBodySchema | undefined, + void + >, + respond: GetPricesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPricesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPrices = ( + params: Params, + respond: PostPricesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPricesSearchResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_price[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPricesSearch = ( + params: Params< + void, + t_GetPricesSearchQuerySchema, + t_GetPricesSearchRequestBodySchema | undefined, + void + >, + respond: GetPricesSearchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPricesPriceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPricesPrice = ( + params: Params< + t_GetPricesPriceParamSchema, + t_GetPricesPriceQuerySchema, + t_GetPricesPriceRequestBodySchema | undefined, + void + >, + respond: GetPricesPriceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPricesPriceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPricesPrice = ( + params: Params< + t_PostPricesPriceParamSchema, + void, + t_PostPricesPriceRequestBodySchema | undefined, + void + >, + respond: PostPricesPriceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetProductsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_product[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetProducts = ( + params: Params< + void, + t_GetProductsQuerySchema, + t_GetProductsRequestBodySchema | undefined, + void + >, + respond: GetProductsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostProductsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostProducts = ( + params: Params, + respond: PostProductsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetProductsSearchResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_product[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetProductsSearch = ( + params: Params< + void, + t_GetProductsSearchQuerySchema, + t_GetProductsSearchRequestBodySchema | undefined, + void + >, + respond: GetProductsSearchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteProductsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteProductsId = ( + params: Params< + t_DeleteProductsIdParamSchema, + void, + t_DeleteProductsIdRequestBodySchema | undefined, + void + >, + respond: DeleteProductsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetProductsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetProductsId = ( + params: Params< + t_GetProductsIdParamSchema, + t_GetProductsIdQuerySchema, + t_GetProductsIdRequestBodySchema | undefined, + void + >, + respond: GetProductsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostProductsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostProductsId = ( + params: Params< + t_PostProductsIdParamSchema, + void, + t_PostProductsIdRequestBodySchema | undefined, + void + >, + respond: PostProductsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetProductsProductFeaturesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_product_feature[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetProductsProductFeatures = ( + params: Params< + t_GetProductsProductFeaturesParamSchema, + t_GetProductsProductFeaturesQuerySchema, + t_GetProductsProductFeaturesRequestBodySchema | undefined, + void + >, + respond: GetProductsProductFeaturesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostProductsProductFeaturesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostProductsProductFeatures = ( + params: Params< + t_PostProductsProductFeaturesParamSchema, + void, + t_PostProductsProductFeaturesRequestBodySchema, + void + >, + respond: PostProductsProductFeaturesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteProductsProductFeaturesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteProductsProductFeaturesId = ( + params: Params< + t_DeleteProductsProductFeaturesIdParamSchema, + void, + t_DeleteProductsProductFeaturesIdRequestBodySchema | undefined, + void + >, + respond: DeleteProductsProductFeaturesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetProductsProductFeaturesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetProductsProductFeaturesId = ( + params: Params< + t_GetProductsProductFeaturesIdParamSchema, + t_GetProductsProductFeaturesIdQuerySchema, + t_GetProductsProductFeaturesIdRequestBodySchema | undefined, + void + >, + respond: GetProductsProductFeaturesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPromotionCodesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_promotion_code[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPromotionCodes = ( + params: Params< + void, + t_GetPromotionCodesQuerySchema, + t_GetPromotionCodesRequestBodySchema | undefined, + void + >, + respond: GetPromotionCodesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPromotionCodesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPromotionCodes = ( + params: Params, + respond: PostPromotionCodesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetPromotionCodesPromotionCodeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetPromotionCodesPromotionCode = ( + params: Params< + t_GetPromotionCodesPromotionCodeParamSchema, + t_GetPromotionCodesPromotionCodeQuerySchema, + t_GetPromotionCodesPromotionCodeRequestBodySchema | undefined, + void + >, + respond: GetPromotionCodesPromotionCodeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostPromotionCodesPromotionCodeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostPromotionCodesPromotionCode = ( + params: Params< + t_PostPromotionCodesPromotionCodeParamSchema, + void, + t_PostPromotionCodesPromotionCodeRequestBodySchema | undefined, + void + >, + respond: PostPromotionCodesPromotionCodeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetQuotesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_quote[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetQuotes = ( + params: Params< + void, + t_GetQuotesQuerySchema, + t_GetQuotesRequestBodySchema | undefined, + void + >, + respond: GetQuotesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostQuotesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostQuotes = ( + params: Params, + respond: PostQuotesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetQuotesQuoteResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetQuotesQuote = ( + params: Params< + t_GetQuotesQuoteParamSchema, + t_GetQuotesQuoteQuerySchema, + t_GetQuotesQuoteRequestBodySchema | undefined, + void + >, + respond: GetQuotesQuoteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostQuotesQuoteResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostQuotesQuote = ( + params: Params< + t_PostQuotesQuoteParamSchema, + void, + t_PostQuotesQuoteRequestBodySchema | undefined, + void + >, + respond: PostQuotesQuoteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostQuotesQuoteAcceptResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostQuotesQuoteAccept = ( + params: Params< + t_PostQuotesQuoteAcceptParamSchema, + void, + t_PostQuotesQuoteAcceptRequestBodySchema | undefined, + void + >, + respond: PostQuotesQuoteAcceptResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostQuotesQuoteCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostQuotesQuoteCancel = ( + params: Params< + t_PostQuotesQuoteCancelParamSchema, + void, + t_PostQuotesQuoteCancelRequestBodySchema | undefined, + void + >, + respond: PostQuotesQuoteCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetQuotesQuoteComputedUpfrontLineItemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetQuotesQuoteComputedUpfrontLineItems = ( + params: Params< + t_GetQuotesQuoteComputedUpfrontLineItemsParamSchema, + t_GetQuotesQuoteComputedUpfrontLineItemsQuerySchema, + t_GetQuotesQuoteComputedUpfrontLineItemsRequestBodySchema | undefined, + void + >, + respond: GetQuotesQuoteComputedUpfrontLineItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostQuotesQuoteFinalizeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostQuotesQuoteFinalize = ( + params: Params< + t_PostQuotesQuoteFinalizeParamSchema, + void, + t_PostQuotesQuoteFinalizeRequestBodySchema | undefined, + void + >, + respond: PostQuotesQuoteFinalizeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetQuotesQuoteLineItemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetQuotesQuoteLineItems = ( + params: Params< + t_GetQuotesQuoteLineItemsParamSchema, + t_GetQuotesQuoteLineItemsQuerySchema, + t_GetQuotesQuoteLineItemsRequestBodySchema | undefined, + void + >, + respond: GetQuotesQuoteLineItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetQuotesQuotePdfResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetQuotesQuotePdf = ( + params: Params< + t_GetQuotesQuotePdfParamSchema, + t_GetQuotesQuotePdfQuerySchema, + t_GetQuotesQuotePdfRequestBodySchema | undefined, + void + >, + respond: GetQuotesQuotePdfResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetRadarEarlyFraudWarningsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_radar_early_fraud_warning[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetRadarEarlyFraudWarnings = ( + params: Params< + void, + t_GetRadarEarlyFraudWarningsQuerySchema, + t_GetRadarEarlyFraudWarningsRequestBodySchema | undefined, + void + >, + respond: GetRadarEarlyFraudWarningsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetRadarEarlyFraudWarningsEarlyFraudWarningResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetRadarEarlyFraudWarningsEarlyFraudWarning = ( + params: Params< + t_GetRadarEarlyFraudWarningsEarlyFraudWarningParamSchema, + t_GetRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema, + t_GetRadarEarlyFraudWarningsEarlyFraudWarningRequestBodySchema | undefined, + void + >, + respond: GetRadarEarlyFraudWarningsEarlyFraudWarningResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetRadarValueListItemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_radar_value_list_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetRadarValueListItems = ( + params: Params< + void, + t_GetRadarValueListItemsQuerySchema, + t_GetRadarValueListItemsRequestBodySchema | undefined, + void + >, + respond: GetRadarValueListItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostRadarValueListItemsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostRadarValueListItems = ( + params: Params, + respond: PostRadarValueListItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteRadarValueListItemsItemResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteRadarValueListItemsItem = ( + params: Params< + t_DeleteRadarValueListItemsItemParamSchema, + void, + t_DeleteRadarValueListItemsItemRequestBodySchema | undefined, + void + >, + respond: DeleteRadarValueListItemsItemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetRadarValueListItemsItemResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetRadarValueListItemsItem = ( + params: Params< + t_GetRadarValueListItemsItemParamSchema, + t_GetRadarValueListItemsItemQuerySchema, + t_GetRadarValueListItemsItemRequestBodySchema | undefined, + void + >, + respond: GetRadarValueListItemsItemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetRadarValueListsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_radar_value_list[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetRadarValueLists = ( + params: Params< + void, + t_GetRadarValueListsQuerySchema, + t_GetRadarValueListsRequestBodySchema | undefined, + void + >, + respond: GetRadarValueListsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostRadarValueListsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostRadarValueLists = ( + params: Params, + respond: PostRadarValueListsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteRadarValueListsValueListResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteRadarValueListsValueList = ( + params: Params< + t_DeleteRadarValueListsValueListParamSchema, + void, + t_DeleteRadarValueListsValueListRequestBodySchema | undefined, + void + >, + respond: DeleteRadarValueListsValueListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetRadarValueListsValueListResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetRadarValueListsValueList = ( + params: Params< + t_GetRadarValueListsValueListParamSchema, + t_GetRadarValueListsValueListQuerySchema, + t_GetRadarValueListsValueListRequestBodySchema | undefined, + void + >, + respond: GetRadarValueListsValueListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostRadarValueListsValueListResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostRadarValueListsValueList = ( + params: Params< + t_PostRadarValueListsValueListParamSchema, + void, + t_PostRadarValueListsValueListRequestBodySchema | undefined, + void + >, + respond: PostRadarValueListsValueListResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetRefundsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_refund[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetRefunds = ( + params: Params< + void, + t_GetRefundsQuerySchema, + t_GetRefundsRequestBodySchema | undefined, + void + >, + respond: GetRefundsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostRefundsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostRefunds = ( + params: Params, + respond: PostRefundsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetRefundsRefundResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetRefundsRefund = ( + params: Params< + t_GetRefundsRefundParamSchema, + t_GetRefundsRefundQuerySchema, + t_GetRefundsRefundRequestBodySchema | undefined, + void + >, + respond: GetRefundsRefundResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostRefundsRefundResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostRefundsRefund = ( + params: Params< + t_PostRefundsRefundParamSchema, + void, + t_PostRefundsRefundRequestBodySchema | undefined, + void + >, + respond: PostRefundsRefundResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostRefundsRefundCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostRefundsRefundCancel = ( + params: Params< + t_PostRefundsRefundCancelParamSchema, + void, + t_PostRefundsRefundCancelRequestBodySchema | undefined, + void + >, + respond: PostRefundsRefundCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetReportingReportRunsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_reporting_report_run[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetReportingReportRuns = ( + params: Params< + void, + t_GetReportingReportRunsQuerySchema, + t_GetReportingReportRunsRequestBodySchema | undefined, + void + >, + respond: GetReportingReportRunsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostReportingReportRunsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostReportingReportRuns = ( + params: Params, + respond: PostReportingReportRunsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetReportingReportRunsReportRunResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetReportingReportRunsReportRun = ( + params: Params< + t_GetReportingReportRunsReportRunParamSchema, + t_GetReportingReportRunsReportRunQuerySchema, + t_GetReportingReportRunsReportRunRequestBodySchema | undefined, + void + >, + respond: GetReportingReportRunsReportRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetReportingReportTypesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_reporting_report_type[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetReportingReportTypes = ( + params: Params< + void, + t_GetReportingReportTypesQuerySchema, + t_GetReportingReportTypesRequestBodySchema | undefined, + void + >, + respond: GetReportingReportTypesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetReportingReportTypesReportTypeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetReportingReportTypesReportType = ( + params: Params< + t_GetReportingReportTypesReportTypeParamSchema, + t_GetReportingReportTypesReportTypeQuerySchema, + t_GetReportingReportTypesReportTypeRequestBodySchema | undefined, + void + >, + respond: GetReportingReportTypesReportTypeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetReviewsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_review[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetReviews = ( + params: Params< + void, + t_GetReviewsQuerySchema, + t_GetReviewsRequestBodySchema | undefined, + void + >, + respond: GetReviewsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetReviewsReviewResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetReviewsReview = ( + params: Params< + t_GetReviewsReviewParamSchema, + t_GetReviewsReviewQuerySchema, + t_GetReviewsReviewRequestBodySchema | undefined, + void + >, + respond: GetReviewsReviewResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostReviewsReviewApproveResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostReviewsReviewApprove = ( + params: Params< + t_PostReviewsReviewApproveParamSchema, + void, + t_PostReviewsReviewApproveRequestBodySchema | undefined, + void + >, + respond: PostReviewsReviewApproveResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSetupAttemptsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_setup_attempt[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSetupAttempts = ( + params: Params< + void, + t_GetSetupAttemptsQuerySchema, + t_GetSetupAttemptsRequestBodySchema | undefined, + void + >, + respond: GetSetupAttemptsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSetupIntentsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_setup_intent[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSetupIntents = ( + params: Params< + void, + t_GetSetupIntentsQuerySchema, + t_GetSetupIntentsRequestBodySchema | undefined, + void + >, + respond: GetSetupIntentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSetupIntentsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSetupIntents = ( + params: Params< + void, + void, + t_PostSetupIntentsRequestBodySchema | undefined, + void + >, + respond: PostSetupIntentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSetupIntentsIntentResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSetupIntentsIntent = ( + params: Params< + t_GetSetupIntentsIntentParamSchema, + t_GetSetupIntentsIntentQuerySchema, + t_GetSetupIntentsIntentRequestBodySchema | undefined, + void + >, + respond: GetSetupIntentsIntentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSetupIntentsIntentResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSetupIntentsIntent = ( + params: Params< + t_PostSetupIntentsIntentParamSchema, + void, + t_PostSetupIntentsIntentRequestBodySchema | undefined, + void + >, + respond: PostSetupIntentsIntentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSetupIntentsIntentCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSetupIntentsIntentCancel = ( + params: Params< + t_PostSetupIntentsIntentCancelParamSchema, + void, + t_PostSetupIntentsIntentCancelRequestBodySchema | undefined, + void + >, + respond: PostSetupIntentsIntentCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSetupIntentsIntentConfirmResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSetupIntentsIntentConfirm = ( + params: Params< + t_PostSetupIntentsIntentConfirmParamSchema, + void, + t_PostSetupIntentsIntentConfirmRequestBodySchema | undefined, + void + >, + respond: PostSetupIntentsIntentConfirmResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSetupIntentsIntentVerifyMicrodepositsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSetupIntentsIntentVerifyMicrodeposits = ( + params: Params< + t_PostSetupIntentsIntentVerifyMicrodepositsParamSchema, + void, + t_PostSetupIntentsIntentVerifyMicrodepositsRequestBodySchema | undefined, + void + >, + respond: PostSetupIntentsIntentVerifyMicrodepositsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetShippingRatesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_shipping_rate[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetShippingRates = ( + params: Params< + void, + t_GetShippingRatesQuerySchema, + t_GetShippingRatesRequestBodySchema | undefined, + void + >, + respond: GetShippingRatesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostShippingRatesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostShippingRates = ( + params: Params, + respond: PostShippingRatesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetShippingRatesShippingRateTokenResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetShippingRatesShippingRateToken = ( + params: Params< + t_GetShippingRatesShippingRateTokenParamSchema, + t_GetShippingRatesShippingRateTokenQuerySchema, + t_GetShippingRatesShippingRateTokenRequestBodySchema | undefined, + void + >, + respond: GetShippingRatesShippingRateTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostShippingRatesShippingRateTokenResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostShippingRatesShippingRateToken = ( + params: Params< + t_PostShippingRatesShippingRateTokenParamSchema, + void, + t_PostShippingRatesShippingRateTokenRequestBodySchema | undefined, + void + >, + respond: PostShippingRatesShippingRateTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSigmaSavedQueriesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSigmaSavedQueriesId = ( + params: Params< + t_PostSigmaSavedQueriesIdParamSchema, + void, + t_PostSigmaSavedQueriesIdRequestBodySchema | undefined, + void + >, + respond: PostSigmaSavedQueriesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSigmaScheduledQueryRunsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_scheduled_query_run[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSigmaScheduledQueryRuns = ( + params: Params< + void, + t_GetSigmaScheduledQueryRunsQuerySchema, + t_GetSigmaScheduledQueryRunsRequestBodySchema | undefined, + void + >, + respond: GetSigmaScheduledQueryRunsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSigmaScheduledQueryRunsScheduledQueryRunResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSigmaScheduledQueryRunsScheduledQueryRun = ( + params: Params< + t_GetSigmaScheduledQueryRunsScheduledQueryRunParamSchema, + t_GetSigmaScheduledQueryRunsScheduledQueryRunQuerySchema, + t_GetSigmaScheduledQueryRunsScheduledQueryRunRequestBodySchema | undefined, + void + >, + respond: GetSigmaScheduledQueryRunsScheduledQueryRunResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSourcesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSources = ( + params: Params, + respond: PostSourcesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSourcesSourceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSourcesSource = ( + params: Params< + t_GetSourcesSourceParamSchema, + t_GetSourcesSourceQuerySchema, + t_GetSourcesSourceRequestBodySchema | undefined, + void + >, + respond: GetSourcesSourceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSourcesSourceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSourcesSource = ( + params: Params< + t_PostSourcesSourceParamSchema, + void, + t_PostSourcesSourceRequestBodySchema | undefined, + void + >, + respond: PostSourcesSourceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSourcesSourceMandateNotificationsMandateNotificationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSourcesSourceMandateNotificationsMandateNotification = ( + params: Params< + t_GetSourcesSourceMandateNotificationsMandateNotificationParamSchema, + t_GetSourcesSourceMandateNotificationsMandateNotificationQuerySchema, + | t_GetSourcesSourceMandateNotificationsMandateNotificationRequestBodySchema + | undefined, + void + >, + respond: GetSourcesSourceMandateNotificationsMandateNotificationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSourcesSourceSourceTransactionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_source_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSourcesSourceSourceTransactions = ( + params: Params< + t_GetSourcesSourceSourceTransactionsParamSchema, + t_GetSourcesSourceSourceTransactionsQuerySchema, + t_GetSourcesSourceSourceTransactionsRequestBodySchema | undefined, + void + >, + respond: GetSourcesSourceSourceTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSourcesSourceSourceTransactionsSourceTransactionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSourcesSourceSourceTransactionsSourceTransaction = ( + params: Params< + t_GetSourcesSourceSourceTransactionsSourceTransactionParamSchema, + t_GetSourcesSourceSourceTransactionsSourceTransactionQuerySchema, + | t_GetSourcesSourceSourceTransactionsSourceTransactionRequestBodySchema + | undefined, + void + >, + respond: GetSourcesSourceSourceTransactionsSourceTransactionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSourcesSourceVerifyResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSourcesSourceVerify = ( + params: Params< + t_PostSourcesSourceVerifyParamSchema, + void, + t_PostSourcesSourceVerifyRequestBodySchema, + void + >, + respond: PostSourcesSourceVerifyResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSubscriptionItemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_subscription_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSubscriptionItems = ( + params: Params< + void, + t_GetSubscriptionItemsQuerySchema, + t_GetSubscriptionItemsRequestBodySchema | undefined, + void + >, + respond: GetSubscriptionItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionItemsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptionItems = ( + params: Params, + respond: PostSubscriptionItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteSubscriptionItemsItemResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteSubscriptionItemsItem = ( + params: Params< + t_DeleteSubscriptionItemsItemParamSchema, + void, + t_DeleteSubscriptionItemsItemRequestBodySchema | undefined, + void + >, + respond: DeleteSubscriptionItemsItemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSubscriptionItemsItemResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSubscriptionItemsItem = ( + params: Params< + t_GetSubscriptionItemsItemParamSchema, + t_GetSubscriptionItemsItemQuerySchema, + t_GetSubscriptionItemsItemRequestBodySchema | undefined, + void + >, + respond: GetSubscriptionItemsItemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionItemsItemResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptionItemsItem = ( + params: Params< + t_PostSubscriptionItemsItemParamSchema, + void, + t_PostSubscriptionItemsItemRequestBodySchema | undefined, + void + >, + respond: PostSubscriptionItemsItemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSubscriptionSchedulesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_subscription_schedule[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSubscriptionSchedules = ( + params: Params< + void, + t_GetSubscriptionSchedulesQuerySchema, + t_GetSubscriptionSchedulesRequestBodySchema | undefined, + void + >, + respond: GetSubscriptionSchedulesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionSchedulesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptionSchedules = ( + params: Params< + void, + void, + t_PostSubscriptionSchedulesRequestBodySchema | undefined, + void + >, + respond: PostSubscriptionSchedulesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSubscriptionSchedulesScheduleResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSubscriptionSchedulesSchedule = ( + params: Params< + t_GetSubscriptionSchedulesScheduleParamSchema, + t_GetSubscriptionSchedulesScheduleQuerySchema, + t_GetSubscriptionSchedulesScheduleRequestBodySchema | undefined, + void + >, + respond: GetSubscriptionSchedulesScheduleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionSchedulesScheduleResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptionSchedulesSchedule = ( + params: Params< + t_PostSubscriptionSchedulesScheduleParamSchema, + void, + t_PostSubscriptionSchedulesScheduleRequestBodySchema | undefined, + void + >, + respond: PostSubscriptionSchedulesScheduleResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionSchedulesScheduleCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptionSchedulesScheduleCancel = ( + params: Params< + t_PostSubscriptionSchedulesScheduleCancelParamSchema, + void, + t_PostSubscriptionSchedulesScheduleCancelRequestBodySchema | undefined, + void + >, + respond: PostSubscriptionSchedulesScheduleCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionSchedulesScheduleReleaseResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptionSchedulesScheduleRelease = ( + params: Params< + t_PostSubscriptionSchedulesScheduleReleaseParamSchema, + void, + t_PostSubscriptionSchedulesScheduleReleaseRequestBodySchema | undefined, + void + >, + respond: PostSubscriptionSchedulesScheduleReleaseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSubscriptionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_subscription[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSubscriptions = ( + params: Params< + void, + t_GetSubscriptionsQuerySchema, + t_GetSubscriptionsRequestBodySchema | undefined, + void + >, + respond: GetSubscriptionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptions = ( + params: Params, + respond: PostSubscriptionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSubscriptionsSearchResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_subscription[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSubscriptionsSearch = ( + params: Params< + void, + t_GetSubscriptionsSearchQuerySchema, + t_GetSubscriptionsSearchRequestBodySchema | undefined, + void + >, + respond: GetSubscriptionsSearchResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteSubscriptionsSubscriptionExposedIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteSubscriptionsSubscriptionExposedId = ( + params: Params< + t_DeleteSubscriptionsSubscriptionExposedIdParamSchema, + void, + t_DeleteSubscriptionsSubscriptionExposedIdRequestBodySchema | undefined, + void + >, + respond: DeleteSubscriptionsSubscriptionExposedIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetSubscriptionsSubscriptionExposedIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetSubscriptionsSubscriptionExposedId = ( + params: Params< + t_GetSubscriptionsSubscriptionExposedIdParamSchema, + t_GetSubscriptionsSubscriptionExposedIdQuerySchema, + t_GetSubscriptionsSubscriptionExposedIdRequestBodySchema | undefined, + void + >, + respond: GetSubscriptionsSubscriptionExposedIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionsSubscriptionExposedIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptionsSubscriptionExposedId = ( + params: Params< + t_PostSubscriptionsSubscriptionExposedIdParamSchema, + void, + t_PostSubscriptionsSubscriptionExposedIdRequestBodySchema | undefined, + void + >, + respond: PostSubscriptionsSubscriptionExposedIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteSubscriptionsSubscriptionExposedIdDiscountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteSubscriptionsSubscriptionExposedIdDiscount = ( + params: Params< + t_DeleteSubscriptionsSubscriptionExposedIdDiscountParamSchema, + void, + | t_DeleteSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema + | undefined, + void + >, + respond: DeleteSubscriptionsSubscriptionExposedIdDiscountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostSubscriptionsSubscriptionResumeResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostSubscriptionsSubscriptionResume = ( + params: Params< + t_PostSubscriptionsSubscriptionResumeParamSchema, + void, + t_PostSubscriptionsSubscriptionResumeRequestBodySchema | undefined, + void + >, + respond: PostSubscriptionsSubscriptionResumeResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxCalculationsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxCalculations = ( + params: Params, + respond: PostTaxCalculationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxCalculationsCalculationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxCalculationsCalculation = ( + params: Params< + t_GetTaxCalculationsCalculationParamSchema, + t_GetTaxCalculationsCalculationQuerySchema, + t_GetTaxCalculationsCalculationRequestBodySchema | undefined, + void + >, + respond: GetTaxCalculationsCalculationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxCalculationsCalculationLineItemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_tax_calculation_line_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxCalculationsCalculationLineItems = ( + params: Params< + t_GetTaxCalculationsCalculationLineItemsParamSchema, + t_GetTaxCalculationsCalculationLineItemsQuerySchema, + t_GetTaxCalculationsCalculationLineItemsRequestBodySchema | undefined, + void + >, + respond: GetTaxCalculationsCalculationLineItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxRegistrationsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_tax_registration[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxRegistrations = ( + params: Params< + void, + t_GetTaxRegistrationsQuerySchema, + t_GetTaxRegistrationsRequestBodySchema | undefined, + void + >, + respond: GetTaxRegistrationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxRegistrationsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxRegistrations = ( + params: Params, + respond: PostTaxRegistrationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxRegistrationsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxRegistrationsId = ( + params: Params< + t_GetTaxRegistrationsIdParamSchema, + t_GetTaxRegistrationsIdQuerySchema, + t_GetTaxRegistrationsIdRequestBodySchema | undefined, + void + >, + respond: GetTaxRegistrationsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxRegistrationsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxRegistrationsId = ( + params: Params< + t_PostTaxRegistrationsIdParamSchema, + void, + t_PostTaxRegistrationsIdRequestBodySchema | undefined, + void + >, + respond: PostTaxRegistrationsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxSettingsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxSettings = ( + params: Params< + void, + t_GetTaxSettingsQuerySchema, + t_GetTaxSettingsRequestBodySchema | undefined, + void + >, + respond: GetTaxSettingsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxSettingsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxSettings = ( + params: Params< + void, + void, + t_PostTaxSettingsRequestBodySchema | undefined, + void + >, + respond: PostTaxSettingsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxTransactionsCreateFromCalculationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxTransactionsCreateFromCalculation = ( + params: Params< + void, + void, + t_PostTaxTransactionsCreateFromCalculationRequestBodySchema, + void + >, + respond: PostTaxTransactionsCreateFromCalculationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxTransactionsCreateReversalResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxTransactionsCreateReversal = ( + params: Params< + void, + void, + t_PostTaxTransactionsCreateReversalRequestBodySchema, + void + >, + respond: PostTaxTransactionsCreateReversalResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxTransactionsTransactionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxTransactionsTransaction = ( + params: Params< + t_GetTaxTransactionsTransactionParamSchema, + t_GetTaxTransactionsTransactionQuerySchema, + t_GetTaxTransactionsTransactionRequestBodySchema | undefined, + void + >, + respond: GetTaxTransactionsTransactionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxTransactionsTransactionLineItemsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_tax_transaction_line_item[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxTransactionsTransactionLineItems = ( + params: Params< + t_GetTaxTransactionsTransactionLineItemsParamSchema, + t_GetTaxTransactionsTransactionLineItemsQuerySchema, + t_GetTaxTransactionsTransactionLineItemsRequestBodySchema | undefined, + void + >, + respond: GetTaxTransactionsTransactionLineItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxCodesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_tax_code[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxCodes = ( + params: Params< + void, + t_GetTaxCodesQuerySchema, + t_GetTaxCodesRequestBodySchema | undefined, + void + >, + respond: GetTaxCodesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxCodesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxCodesId = ( + params: Params< + t_GetTaxCodesIdParamSchema, + t_GetTaxCodesIdQuerySchema, + t_GetTaxCodesIdRequestBodySchema | undefined, + void + >, + respond: GetTaxCodesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxIdsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_tax_id[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxIds = ( + params: Params< + void, + t_GetTaxIdsQuerySchema, + t_GetTaxIdsRequestBodySchema | undefined, + void + >, + respond: GetTaxIdsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxIdsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxIds = ( + params: Params, + respond: PostTaxIdsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteTaxIdsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteTaxIdsId = ( + params: Params< + t_DeleteTaxIdsIdParamSchema, + void, + t_DeleteTaxIdsIdRequestBodySchema | undefined, + void + >, + respond: DeleteTaxIdsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxIdsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxIdsId = ( + params: Params< + t_GetTaxIdsIdParamSchema, + t_GetTaxIdsIdQuerySchema, + t_GetTaxIdsIdRequestBodySchema | undefined, + void + >, + respond: GetTaxIdsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxRatesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_tax_rate[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxRates = ( + params: Params< + void, + t_GetTaxRatesQuerySchema, + t_GetTaxRatesRequestBodySchema | undefined, + void + >, + respond: GetTaxRatesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxRatesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxRates = ( + params: Params, + respond: PostTaxRatesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTaxRatesTaxRateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTaxRatesTaxRate = ( + params: Params< + t_GetTaxRatesTaxRateParamSchema, + t_GetTaxRatesTaxRateQuerySchema, + t_GetTaxRatesTaxRateRequestBodySchema | undefined, + void + >, + respond: GetTaxRatesTaxRateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTaxRatesTaxRateResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTaxRatesTaxRate = ( + params: Params< + t_PostTaxRatesTaxRateParamSchema, + void, + t_PostTaxRatesTaxRateRequestBodySchema | undefined, + void + >, + respond: PostTaxRatesTaxRateResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTerminalConfigurationsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_terminal_configuration[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTerminalConfigurations = ( + params: Params< + void, + t_GetTerminalConfigurationsQuerySchema, + t_GetTerminalConfigurationsRequestBodySchema | undefined, + void + >, + respond: GetTerminalConfigurationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalConfigurationsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalConfigurations = ( + params: Params< + void, + void, + t_PostTerminalConfigurationsRequestBodySchema | undefined, + void + >, + respond: PostTerminalConfigurationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteTerminalConfigurationsConfigurationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteTerminalConfigurationsConfiguration = ( + params: Params< + t_DeleteTerminalConfigurationsConfigurationParamSchema, + void, + t_DeleteTerminalConfigurationsConfigurationRequestBodySchema | undefined, + void + >, + respond: DeleteTerminalConfigurationsConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTerminalConfigurationsConfigurationResponder = { + with200(): ExpressRuntimeResponse< + t_terminal_configuration | t_deleted_terminal_configuration + > + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTerminalConfigurationsConfiguration = ( + params: Params< + t_GetTerminalConfigurationsConfigurationParamSchema, + t_GetTerminalConfigurationsConfigurationQuerySchema, + t_GetTerminalConfigurationsConfigurationRequestBodySchema | undefined, + void + >, + respond: GetTerminalConfigurationsConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalConfigurationsConfigurationResponder = { + with200(): ExpressRuntimeResponse< + t_terminal_configuration | t_deleted_terminal_configuration + > + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalConfigurationsConfiguration = ( + params: Params< + t_PostTerminalConfigurationsConfigurationParamSchema, + void, + t_PostTerminalConfigurationsConfigurationRequestBodySchema | undefined, + void + >, + respond: PostTerminalConfigurationsConfigurationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalConnectionTokensResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalConnectionTokens = ( + params: Params< + void, + void, + t_PostTerminalConnectionTokensRequestBodySchema | undefined, + void + >, + respond: PostTerminalConnectionTokensResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTerminalLocationsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_terminal_location[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTerminalLocations = ( + params: Params< + void, + t_GetTerminalLocationsQuerySchema, + t_GetTerminalLocationsRequestBodySchema | undefined, + void + >, + respond: GetTerminalLocationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalLocationsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalLocations = ( + params: Params, + respond: PostTerminalLocationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteTerminalLocationsLocationResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteTerminalLocationsLocation = ( + params: Params< + t_DeleteTerminalLocationsLocationParamSchema, + void, + t_DeleteTerminalLocationsLocationRequestBodySchema | undefined, + void + >, + respond: DeleteTerminalLocationsLocationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTerminalLocationsLocationResponder = { + with200(): ExpressRuntimeResponse< + t_terminal_location | t_deleted_terminal_location + > + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTerminalLocationsLocation = ( + params: Params< + t_GetTerminalLocationsLocationParamSchema, + t_GetTerminalLocationsLocationQuerySchema, + t_GetTerminalLocationsLocationRequestBodySchema | undefined, + void + >, + respond: GetTerminalLocationsLocationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalLocationsLocationResponder = { + with200(): ExpressRuntimeResponse< + t_terminal_location | t_deleted_terminal_location + > + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalLocationsLocation = ( + params: Params< + t_PostTerminalLocationsLocationParamSchema, + void, + t_PostTerminalLocationsLocationRequestBodySchema | undefined, + void + >, + respond: PostTerminalLocationsLocationResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTerminalReadersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_terminal_reader[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTerminalReaders = ( + params: Params< + void, + t_GetTerminalReadersQuerySchema, + t_GetTerminalReadersRequestBodySchema | undefined, + void + >, + respond: GetTerminalReadersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalReadersResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalReaders = ( + params: Params, + respond: PostTerminalReadersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteTerminalReadersReaderResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteTerminalReadersReader = ( + params: Params< + t_DeleteTerminalReadersReaderParamSchema, + void, + t_DeleteTerminalReadersReaderRequestBodySchema | undefined, + void + >, + respond: DeleteTerminalReadersReaderResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTerminalReadersReaderResponder = { + with200(): ExpressRuntimeResponse< + t_terminal_reader | t_deleted_terminal_reader + > + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTerminalReadersReader = ( + params: Params< + t_GetTerminalReadersReaderParamSchema, + t_GetTerminalReadersReaderQuerySchema, + t_GetTerminalReadersReaderRequestBodySchema | undefined, + void + >, + respond: GetTerminalReadersReaderResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalReadersReaderResponder = { + with200(): ExpressRuntimeResponse< + t_terminal_reader | t_deleted_terminal_reader + > + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalReadersReader = ( + params: Params< + t_PostTerminalReadersReaderParamSchema, + void, + t_PostTerminalReadersReaderRequestBodySchema | undefined, + void + >, + respond: PostTerminalReadersReaderResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalReadersReaderCancelActionResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalReadersReaderCancelAction = ( + params: Params< + t_PostTerminalReadersReaderCancelActionParamSchema, + void, + t_PostTerminalReadersReaderCancelActionRequestBodySchema | undefined, + void + >, + respond: PostTerminalReadersReaderCancelActionResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalReadersReaderProcessPaymentIntentResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalReadersReaderProcessPaymentIntent = ( + params: Params< + t_PostTerminalReadersReaderProcessPaymentIntentParamSchema, + void, + t_PostTerminalReadersReaderProcessPaymentIntentRequestBodySchema, + void + >, + respond: PostTerminalReadersReaderProcessPaymentIntentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalReadersReaderProcessSetupIntentResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalReadersReaderProcessSetupIntent = ( + params: Params< + t_PostTerminalReadersReaderProcessSetupIntentParamSchema, + void, + t_PostTerminalReadersReaderProcessSetupIntentRequestBodySchema, + void + >, + respond: PostTerminalReadersReaderProcessSetupIntentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalReadersReaderRefundPaymentResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalReadersReaderRefundPayment = ( + params: Params< + t_PostTerminalReadersReaderRefundPaymentParamSchema, + void, + t_PostTerminalReadersReaderRefundPaymentRequestBodySchema | undefined, + void + >, + respond: PostTerminalReadersReaderRefundPaymentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTerminalReadersReaderSetReaderDisplayResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTerminalReadersReaderSetReaderDisplay = ( + params: Params< + t_PostTerminalReadersReaderSetReaderDisplayParamSchema, + void, + t_PostTerminalReadersReaderSetReaderDisplayRequestBodySchema, + void + >, + respond: PostTerminalReadersReaderSetReaderDisplayResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersConfirmationTokensResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersConfirmationTokens = ( + params: Params< + void, + void, + t_PostTestHelpersConfirmationTokensRequestBodySchema | undefined, + void + >, + respond: PostTestHelpersConfirmationTokensResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersCustomersCustomerFundCashBalanceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersCustomersCustomerFundCashBalance = ( + params: Params< + t_PostTestHelpersCustomersCustomerFundCashBalanceParamSchema, + void, + t_PostTestHelpersCustomersCustomerFundCashBalanceRequestBodySchema, + void + >, + respond: PostTestHelpersCustomersCustomerFundCashBalanceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingAuthorizationsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingAuthorizations = ( + params: Params< + void, + void, + t_PostTestHelpersIssuingAuthorizationsRequestBodySchema, + void + >, + respond: PostTestHelpersIssuingAuthorizationsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingAuthorizationsAuthorizationCaptureResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersIssuingAuthorizationsAuthorizationCapture = ( + params: Params< + t_PostTestHelpersIssuingAuthorizationsAuthorizationCaptureParamSchema, + void, + | t_PostTestHelpersIssuingAuthorizationsAuthorizationCaptureRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingAuthorizationsAuthorizationCaptureResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingAuthorizationsAuthorizationExpireResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingAuthorizationsAuthorizationExpire = ( + params: Params< + t_PostTestHelpersIssuingAuthorizationsAuthorizationExpireParamSchema, + void, + | t_PostTestHelpersIssuingAuthorizationsAuthorizationExpireRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingAuthorizationsAuthorizationExpireResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmount = ( + params: Params< + t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema, + void, + t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountRequestBodySchema, + void + >, + respond: PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespond = + ( + params: Params< + t_PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondParamSchema, + void, + t_PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondRequestBodySchema, + void + >, + respond: PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondResponder, + req: Request, + res: Response, + next: NextFunction, + ) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingAuthorizationsAuthorizationIncrementResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersIssuingAuthorizationsAuthorizationIncrement = ( + params: Params< + t_PostTestHelpersIssuingAuthorizationsAuthorizationIncrementParamSchema, + void, + t_PostTestHelpersIssuingAuthorizationsAuthorizationIncrementRequestBodySchema, + void + >, + respond: PostTestHelpersIssuingAuthorizationsAuthorizationIncrementResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingAuthorizationsAuthorizationReverseResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersIssuingAuthorizationsAuthorizationReverse = ( + params: Params< + t_PostTestHelpersIssuingAuthorizationsAuthorizationReverseParamSchema, + void, + | t_PostTestHelpersIssuingAuthorizationsAuthorizationReverseRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingAuthorizationsAuthorizationReverseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingCardsCardShippingDeliverResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingCardsCardShippingDeliver = ( + params: Params< + t_PostTestHelpersIssuingCardsCardShippingDeliverParamSchema, + void, + | t_PostTestHelpersIssuingCardsCardShippingDeliverRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingCardsCardShippingDeliverResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingCardsCardShippingFailResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingCardsCardShippingFail = ( + params: Params< + t_PostTestHelpersIssuingCardsCardShippingFailParamSchema, + void, + t_PostTestHelpersIssuingCardsCardShippingFailRequestBodySchema | undefined, + void + >, + respond: PostTestHelpersIssuingCardsCardShippingFailResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingCardsCardShippingReturnResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingCardsCardShippingReturn = ( + params: Params< + t_PostTestHelpersIssuingCardsCardShippingReturnParamSchema, + void, + | t_PostTestHelpersIssuingCardsCardShippingReturnRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingCardsCardShippingReturnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingCardsCardShippingShipResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingCardsCardShippingShip = ( + params: Params< + t_PostTestHelpersIssuingCardsCardShippingShipParamSchema, + void, + t_PostTestHelpersIssuingCardsCardShippingShipRequestBodySchema | undefined, + void + >, + respond: PostTestHelpersIssuingCardsCardShippingShipResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingCardsCardShippingSubmitResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingCardsCardShippingSubmit = ( + params: Params< + t_PostTestHelpersIssuingCardsCardShippingSubmitParamSchema, + void, + | t_PostTestHelpersIssuingCardsCardShippingSubmitRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingCardsCardShippingSubmitResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate = + ( + params: Params< + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateParamSchema, + void, + | t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateResponder, + req: Request, + res: Response, + next: NextFunction, + ) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate = + ( + params: Params< + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateParamSchema, + void, + | t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateResponder, + req: Request, + res: Response, + next: NextFunction, + ) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject = + ( + params: Params< + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectParamSchema, + void, + t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectRequestBodySchema, + void + >, + respond: PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectResponder, + req: Request, + res: Response, + next: NextFunction, + ) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingSettlementsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingSettlements = ( + params: Params< + void, + void, + t_PostTestHelpersIssuingSettlementsRequestBodySchema, + void + >, + respond: PostTestHelpersIssuingSettlementsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingSettlementsSettlementCompleteResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingSettlementsSettlementComplete = ( + params: Params< + t_PostTestHelpersIssuingSettlementsSettlementCompleteParamSchema, + void, + | t_PostTestHelpersIssuingSettlementsSettlementCompleteRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingSettlementsSettlementCompleteResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingTransactionsCreateForceCaptureResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingTransactionsCreateForceCapture = ( + params: Params< + void, + void, + t_PostTestHelpersIssuingTransactionsCreateForceCaptureRequestBodySchema, + void + >, + respond: PostTestHelpersIssuingTransactionsCreateForceCaptureResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingTransactionsCreateUnlinkedRefundResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingTransactionsCreateUnlinkedRefund = ( + params: Params< + void, + void, + t_PostTestHelpersIssuingTransactionsCreateUnlinkedRefundRequestBodySchema, + void + >, + respond: PostTestHelpersIssuingTransactionsCreateUnlinkedRefundResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersIssuingTransactionsTransactionRefundResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersIssuingTransactionsTransactionRefund = ( + params: Params< + t_PostTestHelpersIssuingTransactionsTransactionRefundParamSchema, + void, + | t_PostTestHelpersIssuingTransactionsTransactionRefundRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersIssuingTransactionsTransactionRefundResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersRefundsRefundExpireResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersRefundsRefundExpire = ( + params: Params< + t_PostTestHelpersRefundsRefundExpireParamSchema, + void, + t_PostTestHelpersRefundsRefundExpireRequestBodySchema | undefined, + void + >, + respond: PostTestHelpersRefundsRefundExpireResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTerminalReadersReaderPresentPaymentMethodResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersTerminalReadersReaderPresentPaymentMethod = ( + params: Params< + t_PostTestHelpersTerminalReadersReaderPresentPaymentMethodParamSchema, + void, + | t_PostTestHelpersTerminalReadersReaderPresentPaymentMethodRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTerminalReadersReaderPresentPaymentMethodResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTestHelpersTestClocksResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_test_helpers_test_clock[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTestHelpersTestClocks = ( + params: Params< + void, + t_GetTestHelpersTestClocksQuerySchema, + t_GetTestHelpersTestClocksRequestBodySchema | undefined, + void + >, + respond: GetTestHelpersTestClocksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTestClocksResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTestClocks = ( + params: Params< + void, + void, + t_PostTestHelpersTestClocksRequestBodySchema, + void + >, + respond: PostTestHelpersTestClocksResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteTestHelpersTestClocksTestClockResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteTestHelpersTestClocksTestClock = ( + params: Params< + t_DeleteTestHelpersTestClocksTestClockParamSchema, + void, + t_DeleteTestHelpersTestClocksTestClockRequestBodySchema | undefined, + void + >, + respond: DeleteTestHelpersTestClocksTestClockResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTestHelpersTestClocksTestClockResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTestHelpersTestClocksTestClock = ( + params: Params< + t_GetTestHelpersTestClocksTestClockParamSchema, + t_GetTestHelpersTestClocksTestClockQuerySchema, + t_GetTestHelpersTestClocksTestClockRequestBodySchema | undefined, + void + >, + respond: GetTestHelpersTestClocksTestClockResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTestClocksTestClockAdvanceResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTestClocksTestClockAdvance = ( + params: Params< + t_PostTestHelpersTestClocksTestClockAdvanceParamSchema, + void, + t_PostTestHelpersTestClocksTestClockAdvanceRequestBodySchema, + void + >, + respond: PostTestHelpersTestClocksTestClockAdvanceResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryInboundTransfersIdFailResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryInboundTransfersIdFail = ( + params: Params< + t_PostTestHelpersTreasuryInboundTransfersIdFailParamSchema, + void, + | t_PostTestHelpersTreasuryInboundTransfersIdFailRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryInboundTransfersIdFailResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryInboundTransfersIdReturnResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryInboundTransfersIdReturn = ( + params: Params< + t_PostTestHelpersTreasuryInboundTransfersIdReturnParamSchema, + void, + | t_PostTestHelpersTreasuryInboundTransfersIdReturnRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryInboundTransfersIdReturnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryInboundTransfersIdSucceedResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryInboundTransfersIdSucceed = ( + params: Params< + t_PostTestHelpersTreasuryInboundTransfersIdSucceedParamSchema, + void, + | t_PostTestHelpersTreasuryInboundTransfersIdSucceedRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryInboundTransfersIdSucceedResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryOutboundPaymentsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryOutboundPaymentsId = ( + params: Params< + t_PostTestHelpersTreasuryOutboundPaymentsIdParamSchema, + void, + t_PostTestHelpersTreasuryOutboundPaymentsIdRequestBodySchema, + void + >, + respond: PostTestHelpersTreasuryOutboundPaymentsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryOutboundPaymentsIdFailResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryOutboundPaymentsIdFail = ( + params: Params< + t_PostTestHelpersTreasuryOutboundPaymentsIdFailParamSchema, + void, + | t_PostTestHelpersTreasuryOutboundPaymentsIdFailRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryOutboundPaymentsIdFailResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryOutboundPaymentsIdPostResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryOutboundPaymentsIdPost = ( + params: Params< + t_PostTestHelpersTreasuryOutboundPaymentsIdPostParamSchema, + void, + | t_PostTestHelpersTreasuryOutboundPaymentsIdPostRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryOutboundPaymentsIdPostResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryOutboundPaymentsIdReturnResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryOutboundPaymentsIdReturn = ( + params: Params< + t_PostTestHelpersTreasuryOutboundPaymentsIdReturnParamSchema, + void, + | t_PostTestHelpersTreasuryOutboundPaymentsIdReturnRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryOutboundPaymentsIdReturnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransferResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransfer = ( + params: Params< + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema, + void, + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferRequestBodySchema, + void + >, + respond: PostTestHelpersTreasuryOutboundTransfersOutboundTransferResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransferFail = ( + params: Params< + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailParamSchema, + void, + | t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransferPostResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransferPost = ( + params: Params< + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferPostParamSchema, + void, + | t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferPostRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryOutboundTransfersOutboundTransferPostResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturnResponder = + { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse + } & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturn = ( + params: Params< + t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturnParamSchema, + void, + | t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturnRequestBodySchema + | undefined, + void + >, + respond: PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturnResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryReceivedCreditsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryReceivedCredits = ( + params: Params< + void, + void, + t_PostTestHelpersTreasuryReceivedCreditsRequestBodySchema, + void + >, + respond: PostTestHelpersTreasuryReceivedCreditsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTestHelpersTreasuryReceivedDebitsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTestHelpersTreasuryReceivedDebits = ( + params: Params< + void, + void, + t_PostTestHelpersTreasuryReceivedDebitsRequestBodySchema, + void + >, + respond: PostTestHelpersTreasuryReceivedDebitsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTokensResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTokens = ( + params: Params, + respond: PostTokensResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTokensTokenResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTokensToken = ( + params: Params< + t_GetTokensTokenParamSchema, + t_GetTokensTokenQuerySchema, + t_GetTokensTokenRequestBodySchema | undefined, + void + >, + respond: GetTokensTokenResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTopupsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_topup[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTopups = ( + params: Params< + void, + t_GetTopupsQuerySchema, + t_GetTopupsRequestBodySchema | undefined, + void + >, + respond: GetTopupsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTopupsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTopups = ( + params: Params, + respond: PostTopupsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTopupsTopupResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTopupsTopup = ( + params: Params< + t_GetTopupsTopupParamSchema, + t_GetTopupsTopupQuerySchema, + t_GetTopupsTopupRequestBodySchema | undefined, + void + >, + respond: GetTopupsTopupResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTopupsTopupResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTopupsTopup = ( + params: Params< + t_PostTopupsTopupParamSchema, + void, + t_PostTopupsTopupRequestBodySchema | undefined, + void + >, + respond: PostTopupsTopupResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTopupsTopupCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTopupsTopupCancel = ( + params: Params< + t_PostTopupsTopupCancelParamSchema, + void, + t_PostTopupsTopupCancelRequestBodySchema | undefined, + void + >, + respond: PostTopupsTopupCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTransfersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_transfer[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTransfers = ( + params: Params< + void, + t_GetTransfersQuerySchema, + t_GetTransfersRequestBodySchema | undefined, + void + >, + respond: GetTransfersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTransfersResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTransfers = ( + params: Params, + respond: PostTransfersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTransfersIdReversalsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_transfer_reversal[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTransfersIdReversals = ( + params: Params< + t_GetTransfersIdReversalsParamSchema, + t_GetTransfersIdReversalsQuerySchema, + t_GetTransfersIdReversalsRequestBodySchema | undefined, + void + >, + respond: GetTransfersIdReversalsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTransfersIdReversalsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTransfersIdReversals = ( + params: Params< + t_PostTransfersIdReversalsParamSchema, + void, + t_PostTransfersIdReversalsRequestBodySchema | undefined, + void + >, + respond: PostTransfersIdReversalsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTransfersTransferResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTransfersTransfer = ( + params: Params< + t_GetTransfersTransferParamSchema, + t_GetTransfersTransferQuerySchema, + t_GetTransfersTransferRequestBodySchema | undefined, + void + >, + respond: GetTransfersTransferResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTransfersTransferResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTransfersTransfer = ( + params: Params< + t_PostTransfersTransferParamSchema, + void, + t_PostTransfersTransferRequestBodySchema | undefined, + void + >, + respond: PostTransfersTransferResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTransfersTransferReversalsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTransfersTransferReversalsId = ( + params: Params< + t_GetTransfersTransferReversalsIdParamSchema, + t_GetTransfersTransferReversalsIdQuerySchema, + t_GetTransfersTransferReversalsIdRequestBodySchema | undefined, + void + >, + respond: GetTransfersTransferReversalsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTransfersTransferReversalsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTransfersTransferReversalsId = ( + params: Params< + t_PostTransfersTransferReversalsIdParamSchema, + void, + t_PostTransfersTransferReversalsIdRequestBodySchema | undefined, + void + >, + respond: PostTransfersTransferReversalsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryCreditReversalsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_credit_reversal[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryCreditReversals = ( + params: Params< + void, + t_GetTreasuryCreditReversalsQuerySchema, + t_GetTreasuryCreditReversalsRequestBodySchema | undefined, + void + >, + respond: GetTreasuryCreditReversalsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryCreditReversalsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryCreditReversals = ( + params: Params< + void, + void, + t_PostTreasuryCreditReversalsRequestBodySchema, + void + >, + respond: PostTreasuryCreditReversalsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryCreditReversalsCreditReversalResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryCreditReversalsCreditReversal = ( + params: Params< + t_GetTreasuryCreditReversalsCreditReversalParamSchema, + t_GetTreasuryCreditReversalsCreditReversalQuerySchema, + t_GetTreasuryCreditReversalsCreditReversalRequestBodySchema | undefined, + void + >, + respond: GetTreasuryCreditReversalsCreditReversalResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryDebitReversalsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_debit_reversal[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryDebitReversals = ( + params: Params< + void, + t_GetTreasuryDebitReversalsQuerySchema, + t_GetTreasuryDebitReversalsRequestBodySchema | undefined, + void + >, + respond: GetTreasuryDebitReversalsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryDebitReversalsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryDebitReversals = ( + params: Params< + void, + void, + t_PostTreasuryDebitReversalsRequestBodySchema, + void + >, + respond: PostTreasuryDebitReversalsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryDebitReversalsDebitReversalResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryDebitReversalsDebitReversal = ( + params: Params< + t_GetTreasuryDebitReversalsDebitReversalParamSchema, + t_GetTreasuryDebitReversalsDebitReversalQuerySchema, + t_GetTreasuryDebitReversalsDebitReversalRequestBodySchema | undefined, + void + >, + respond: GetTreasuryDebitReversalsDebitReversalResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryFinancialAccountsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_financial_account[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryFinancialAccounts = ( + params: Params< + void, + t_GetTreasuryFinancialAccountsQuerySchema, + t_GetTreasuryFinancialAccountsRequestBodySchema | undefined, + void + >, + respond: GetTreasuryFinancialAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryFinancialAccountsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryFinancialAccounts = ( + params: Params< + void, + void, + t_PostTreasuryFinancialAccountsRequestBodySchema, + void + >, + respond: PostTreasuryFinancialAccountsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryFinancialAccountsFinancialAccountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryFinancialAccountsFinancialAccount = ( + params: Params< + t_GetTreasuryFinancialAccountsFinancialAccountParamSchema, + t_GetTreasuryFinancialAccountsFinancialAccountQuerySchema, + t_GetTreasuryFinancialAccountsFinancialAccountRequestBodySchema | undefined, + void + >, + respond: GetTreasuryFinancialAccountsFinancialAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryFinancialAccountsFinancialAccountResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryFinancialAccountsFinancialAccount = ( + params: Params< + t_PostTreasuryFinancialAccountsFinancialAccountParamSchema, + void, + | t_PostTreasuryFinancialAccountsFinancialAccountRequestBodySchema + | undefined, + void + >, + respond: PostTreasuryFinancialAccountsFinancialAccountResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryFinancialAccountsFinancialAccountCloseResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryFinancialAccountsFinancialAccountClose = ( + params: Params< + t_PostTreasuryFinancialAccountsFinancialAccountCloseParamSchema, + void, + | t_PostTreasuryFinancialAccountsFinancialAccountCloseRequestBodySchema + | undefined, + void + >, + respond: PostTreasuryFinancialAccountsFinancialAccountCloseResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryFinancialAccountsFinancialAccountFeaturesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryFinancialAccountsFinancialAccountFeatures = ( + params: Params< + t_GetTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema, + t_GetTreasuryFinancialAccountsFinancialAccountFeaturesQuerySchema, + | t_GetTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema + | undefined, + void + >, + respond: GetTreasuryFinancialAccountsFinancialAccountFeaturesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryFinancialAccountsFinancialAccountFeaturesResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryFinancialAccountsFinancialAccountFeatures = ( + params: Params< + t_PostTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema, + void, + | t_PostTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema + | undefined, + void + >, + respond: PostTreasuryFinancialAccountsFinancialAccountFeaturesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryInboundTransfersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_inbound_transfer[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryInboundTransfers = ( + params: Params< + void, + t_GetTreasuryInboundTransfersQuerySchema, + t_GetTreasuryInboundTransfersRequestBodySchema | undefined, + void + >, + respond: GetTreasuryInboundTransfersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryInboundTransfersResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryInboundTransfers = ( + params: Params< + void, + void, + t_PostTreasuryInboundTransfersRequestBodySchema, + void + >, + respond: PostTreasuryInboundTransfersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryInboundTransfersIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryInboundTransfersId = ( + params: Params< + t_GetTreasuryInboundTransfersIdParamSchema, + t_GetTreasuryInboundTransfersIdQuerySchema, + t_GetTreasuryInboundTransfersIdRequestBodySchema | undefined, + void + >, + respond: GetTreasuryInboundTransfersIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryInboundTransfersInboundTransferCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryInboundTransfersInboundTransferCancel = ( + params: Params< + t_PostTreasuryInboundTransfersInboundTransferCancelParamSchema, + void, + | t_PostTreasuryInboundTransfersInboundTransferCancelRequestBodySchema + | undefined, + void + >, + respond: PostTreasuryInboundTransfersInboundTransferCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryOutboundPaymentsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_outbound_payment[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryOutboundPayments = ( + params: Params< + void, + t_GetTreasuryOutboundPaymentsQuerySchema, + t_GetTreasuryOutboundPaymentsRequestBodySchema | undefined, + void + >, + respond: GetTreasuryOutboundPaymentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryOutboundPaymentsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryOutboundPayments = ( + params: Params< + void, + void, + t_PostTreasuryOutboundPaymentsRequestBodySchema, + void + >, + respond: PostTreasuryOutboundPaymentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryOutboundPaymentsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryOutboundPaymentsId = ( + params: Params< + t_GetTreasuryOutboundPaymentsIdParamSchema, + t_GetTreasuryOutboundPaymentsIdQuerySchema, + t_GetTreasuryOutboundPaymentsIdRequestBodySchema | undefined, + void + >, + respond: GetTreasuryOutboundPaymentsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryOutboundPaymentsIdCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryOutboundPaymentsIdCancel = ( + params: Params< + t_PostTreasuryOutboundPaymentsIdCancelParamSchema, + void, + t_PostTreasuryOutboundPaymentsIdCancelRequestBodySchema | undefined, + void + >, + respond: PostTreasuryOutboundPaymentsIdCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryOutboundTransfersResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_outbound_transfer[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryOutboundTransfers = ( + params: Params< + void, + t_GetTreasuryOutboundTransfersQuerySchema, + t_GetTreasuryOutboundTransfersRequestBodySchema | undefined, + void + >, + respond: GetTreasuryOutboundTransfersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryOutboundTransfersResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryOutboundTransfers = ( + params: Params< + void, + void, + t_PostTreasuryOutboundTransfersRequestBodySchema, + void + >, + respond: PostTreasuryOutboundTransfersResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryOutboundTransfersOutboundTransferResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryOutboundTransfersOutboundTransfer = ( + params: Params< + t_GetTreasuryOutboundTransfersOutboundTransferParamSchema, + t_GetTreasuryOutboundTransfersOutboundTransferQuerySchema, + t_GetTreasuryOutboundTransfersOutboundTransferRequestBodySchema | undefined, + void + >, + respond: GetTreasuryOutboundTransfersOutboundTransferResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostTreasuryOutboundTransfersOutboundTransferCancelResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostTreasuryOutboundTransfersOutboundTransferCancel = ( + params: Params< + t_PostTreasuryOutboundTransfersOutboundTransferCancelParamSchema, + void, + | t_PostTreasuryOutboundTransfersOutboundTransferCancelRequestBodySchema + | undefined, + void + >, + respond: PostTreasuryOutboundTransfersOutboundTransferCancelResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryReceivedCreditsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_received_credit[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryReceivedCredits = ( + params: Params< + void, + t_GetTreasuryReceivedCreditsQuerySchema, + t_GetTreasuryReceivedCreditsRequestBodySchema | undefined, + void + >, + respond: GetTreasuryReceivedCreditsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryReceivedCreditsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryReceivedCreditsId = ( + params: Params< + t_GetTreasuryReceivedCreditsIdParamSchema, + t_GetTreasuryReceivedCreditsIdQuerySchema, + t_GetTreasuryReceivedCreditsIdRequestBodySchema | undefined, + void + >, + respond: GetTreasuryReceivedCreditsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryReceivedDebitsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_received_debit[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryReceivedDebits = ( + params: Params< + void, + t_GetTreasuryReceivedDebitsQuerySchema, + t_GetTreasuryReceivedDebitsRequestBodySchema | undefined, + void + >, + respond: GetTreasuryReceivedDebitsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryReceivedDebitsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryReceivedDebitsId = ( + params: Params< + t_GetTreasuryReceivedDebitsIdParamSchema, + t_GetTreasuryReceivedDebitsIdQuerySchema, + t_GetTreasuryReceivedDebitsIdRequestBodySchema | undefined, + void + >, + respond: GetTreasuryReceivedDebitsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryTransactionEntriesResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_transaction_entry[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryTransactionEntries = ( + params: Params< + void, + t_GetTreasuryTransactionEntriesQuerySchema, + t_GetTreasuryTransactionEntriesRequestBodySchema | undefined, + void + >, + respond: GetTreasuryTransactionEntriesResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryTransactionEntriesIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryTransactionEntriesId = ( + params: Params< + t_GetTreasuryTransactionEntriesIdParamSchema, + t_GetTreasuryTransactionEntriesIdQuerySchema, + t_GetTreasuryTransactionEntriesIdRequestBodySchema | undefined, + void + >, + respond: GetTreasuryTransactionEntriesIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryTransactionsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_treasury_transaction[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryTransactions = ( + params: Params< + void, + t_GetTreasuryTransactionsQuerySchema, + t_GetTreasuryTransactionsRequestBodySchema | undefined, + void + >, + respond: GetTreasuryTransactionsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTreasuryTransactionsIdResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTreasuryTransactionsId = ( + params: Params< + t_GetTreasuryTransactionsIdParamSchema, + t_GetTreasuryTransactionsIdQuerySchema, + t_GetTreasuryTransactionsIdRequestBodySchema | undefined, + void + >, + respond: GetTreasuryTransactionsIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetWebhookEndpointsResponder = { + with200(): ExpressRuntimeResponse<{ + data: t_webhook_endpoint[] + has_more: boolean + object: "list" + url: string + }> + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetWebhookEndpoints = ( + params: Params< + void, + t_GetWebhookEndpointsQuerySchema, + t_GetWebhookEndpointsRequestBodySchema | undefined, + void + >, + respond: GetWebhookEndpointsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostWebhookEndpointsResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostWebhookEndpoints = ( + params: Params, + respond: PostWebhookEndpointsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteWebhookEndpointsWebhookEndpointResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteWebhookEndpointsWebhookEndpoint = ( + params: Params< + t_DeleteWebhookEndpointsWebhookEndpointParamSchema, + void, + t_DeleteWebhookEndpointsWebhookEndpointRequestBodySchema | undefined, + void + >, + respond: DeleteWebhookEndpointsWebhookEndpointResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetWebhookEndpointsWebhookEndpointResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetWebhookEndpointsWebhookEndpoint = ( + params: Params< + t_GetWebhookEndpointsWebhookEndpointParamSchema, + t_GetWebhookEndpointsWebhookEndpointQuerySchema, + t_GetWebhookEndpointsWebhookEndpointRequestBodySchema | undefined, + void + >, + respond: GetWebhookEndpointsWebhookEndpointResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type PostWebhookEndpointsWebhookEndpointResponder = { + with200(): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type PostWebhookEndpointsWebhookEndpoint = ( + params: Params< + t_PostWebhookEndpointsWebhookEndpointParamSchema, + void, + t_PostWebhookEndpointsWebhookEndpointRequestBodySchema | undefined, + void + >, + respond: PostWebhookEndpointsWebhookEndpointResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type Implementation = { + getAccount: GetAccount + postAccountLinks: PostAccountLinks + postAccountSessions: PostAccountSessions + getAccounts: GetAccounts + postAccounts: PostAccounts + deleteAccountsAccount: DeleteAccountsAccount + getAccountsAccount: GetAccountsAccount + postAccountsAccount: PostAccountsAccount + postAccountsAccountBankAccounts: PostAccountsAccountBankAccounts + deleteAccountsAccountBankAccountsId: DeleteAccountsAccountBankAccountsId + getAccountsAccountBankAccountsId: GetAccountsAccountBankAccountsId + postAccountsAccountBankAccountsId: PostAccountsAccountBankAccountsId + getAccountsAccountCapabilities: GetAccountsAccountCapabilities + getAccountsAccountCapabilitiesCapability: GetAccountsAccountCapabilitiesCapability + postAccountsAccountCapabilitiesCapability: PostAccountsAccountCapabilitiesCapability + getAccountsAccountExternalAccounts: GetAccountsAccountExternalAccounts + postAccountsAccountExternalAccounts: PostAccountsAccountExternalAccounts + deleteAccountsAccountExternalAccountsId: DeleteAccountsAccountExternalAccountsId + getAccountsAccountExternalAccountsId: GetAccountsAccountExternalAccountsId + postAccountsAccountExternalAccountsId: PostAccountsAccountExternalAccountsId + postAccountsAccountLoginLinks: PostAccountsAccountLoginLinks + getAccountsAccountPeople: GetAccountsAccountPeople + postAccountsAccountPeople: PostAccountsAccountPeople + deleteAccountsAccountPeoplePerson: DeleteAccountsAccountPeoplePerson + getAccountsAccountPeoplePerson: GetAccountsAccountPeoplePerson + postAccountsAccountPeoplePerson: PostAccountsAccountPeoplePerson + getAccountsAccountPersons: GetAccountsAccountPersons + postAccountsAccountPersons: PostAccountsAccountPersons + deleteAccountsAccountPersonsPerson: DeleteAccountsAccountPersonsPerson + getAccountsAccountPersonsPerson: GetAccountsAccountPersonsPerson + postAccountsAccountPersonsPerson: PostAccountsAccountPersonsPerson + postAccountsAccountReject: PostAccountsAccountReject + getApplePayDomains: GetApplePayDomains + postApplePayDomains: PostApplePayDomains + deleteApplePayDomainsDomain: DeleteApplePayDomainsDomain + getApplePayDomainsDomain: GetApplePayDomainsDomain + getApplicationFees: GetApplicationFees + getApplicationFeesFeeRefundsId: GetApplicationFeesFeeRefundsId + postApplicationFeesFeeRefundsId: PostApplicationFeesFeeRefundsId + getApplicationFeesId: GetApplicationFeesId + postApplicationFeesIdRefund: PostApplicationFeesIdRefund + getApplicationFeesIdRefunds: GetApplicationFeesIdRefunds + postApplicationFeesIdRefunds: PostApplicationFeesIdRefunds + getAppsSecrets: GetAppsSecrets + postAppsSecrets: PostAppsSecrets + postAppsSecretsDelete: PostAppsSecretsDelete + getAppsSecretsFind: GetAppsSecretsFind + getBalance: GetBalance + getBalanceHistory: GetBalanceHistory + getBalanceHistoryId: GetBalanceHistoryId + getBalanceTransactions: GetBalanceTransactions + getBalanceTransactionsId: GetBalanceTransactionsId + getBillingAlerts: GetBillingAlerts + postBillingAlerts: PostBillingAlerts + getBillingAlertsId: GetBillingAlertsId + postBillingAlertsIdActivate: PostBillingAlertsIdActivate + postBillingAlertsIdArchive: PostBillingAlertsIdArchive + postBillingAlertsIdDeactivate: PostBillingAlertsIdDeactivate + getBillingCreditBalanceSummary: GetBillingCreditBalanceSummary + getBillingCreditBalanceTransactions: GetBillingCreditBalanceTransactions + getBillingCreditBalanceTransactionsId: GetBillingCreditBalanceTransactionsId + getBillingCreditGrants: GetBillingCreditGrants + postBillingCreditGrants: PostBillingCreditGrants + getBillingCreditGrantsId: GetBillingCreditGrantsId + postBillingCreditGrantsId: PostBillingCreditGrantsId + postBillingCreditGrantsIdExpire: PostBillingCreditGrantsIdExpire + postBillingCreditGrantsIdVoid: PostBillingCreditGrantsIdVoid + postBillingMeterEventAdjustments: PostBillingMeterEventAdjustments + postBillingMeterEvents: PostBillingMeterEvents + getBillingMeters: GetBillingMeters + postBillingMeters: PostBillingMeters + getBillingMetersId: GetBillingMetersId + postBillingMetersId: PostBillingMetersId + postBillingMetersIdDeactivate: PostBillingMetersIdDeactivate + getBillingMetersIdEventSummaries: GetBillingMetersIdEventSummaries + postBillingMetersIdReactivate: PostBillingMetersIdReactivate + getBillingPortalConfigurations: GetBillingPortalConfigurations + postBillingPortalConfigurations: PostBillingPortalConfigurations + getBillingPortalConfigurationsConfiguration: GetBillingPortalConfigurationsConfiguration + postBillingPortalConfigurationsConfiguration: PostBillingPortalConfigurationsConfiguration + postBillingPortalSessions: PostBillingPortalSessions + getCharges: GetCharges + postCharges: PostCharges + getChargesSearch: GetChargesSearch + getChargesCharge: GetChargesCharge + postChargesCharge: PostChargesCharge + postChargesChargeCapture: PostChargesChargeCapture + getChargesChargeDispute: GetChargesChargeDispute + postChargesChargeDispute: PostChargesChargeDispute + postChargesChargeDisputeClose: PostChargesChargeDisputeClose + postChargesChargeRefund: PostChargesChargeRefund + getChargesChargeRefunds: GetChargesChargeRefunds + postChargesChargeRefunds: PostChargesChargeRefunds + getChargesChargeRefundsRefund: GetChargesChargeRefundsRefund + postChargesChargeRefundsRefund: PostChargesChargeRefundsRefund + getCheckoutSessions: GetCheckoutSessions + postCheckoutSessions: PostCheckoutSessions + getCheckoutSessionsSession: GetCheckoutSessionsSession + postCheckoutSessionsSession: PostCheckoutSessionsSession + postCheckoutSessionsSessionExpire: PostCheckoutSessionsSessionExpire + getCheckoutSessionsSessionLineItems: GetCheckoutSessionsSessionLineItems + getClimateOrders: GetClimateOrders + postClimateOrders: PostClimateOrders + getClimateOrdersOrder: GetClimateOrdersOrder + postClimateOrdersOrder: PostClimateOrdersOrder + postClimateOrdersOrderCancel: PostClimateOrdersOrderCancel + getClimateProducts: GetClimateProducts + getClimateProductsProduct: GetClimateProductsProduct + getClimateSuppliers: GetClimateSuppliers + getClimateSuppliersSupplier: GetClimateSuppliersSupplier + getConfirmationTokensConfirmationToken: GetConfirmationTokensConfirmationToken + getCountrySpecs: GetCountrySpecs + getCountrySpecsCountry: GetCountrySpecsCountry + getCoupons: GetCoupons + postCoupons: PostCoupons + deleteCouponsCoupon: DeleteCouponsCoupon + getCouponsCoupon: GetCouponsCoupon + postCouponsCoupon: PostCouponsCoupon + getCreditNotes: GetCreditNotes + postCreditNotes: PostCreditNotes + getCreditNotesPreview: GetCreditNotesPreview + getCreditNotesPreviewLines: GetCreditNotesPreviewLines + getCreditNotesCreditNoteLines: GetCreditNotesCreditNoteLines + getCreditNotesId: GetCreditNotesId + postCreditNotesId: PostCreditNotesId + postCreditNotesIdVoid: PostCreditNotesIdVoid + postCustomerSessions: PostCustomerSessions + getCustomers: GetCustomers + postCustomers: PostCustomers + getCustomersSearch: GetCustomersSearch + deleteCustomersCustomer: DeleteCustomersCustomer + getCustomersCustomer: GetCustomersCustomer + postCustomersCustomer: PostCustomersCustomer + getCustomersCustomerBalanceTransactions: GetCustomersCustomerBalanceTransactions + postCustomersCustomerBalanceTransactions: PostCustomersCustomerBalanceTransactions + getCustomersCustomerBalanceTransactionsTransaction: GetCustomersCustomerBalanceTransactionsTransaction + postCustomersCustomerBalanceTransactionsTransaction: PostCustomersCustomerBalanceTransactionsTransaction + getCustomersCustomerBankAccounts: GetCustomersCustomerBankAccounts + postCustomersCustomerBankAccounts: PostCustomersCustomerBankAccounts + deleteCustomersCustomerBankAccountsId: DeleteCustomersCustomerBankAccountsId + getCustomersCustomerBankAccountsId: GetCustomersCustomerBankAccountsId + postCustomersCustomerBankAccountsId: PostCustomersCustomerBankAccountsId + postCustomersCustomerBankAccountsIdVerify: PostCustomersCustomerBankAccountsIdVerify + getCustomersCustomerCards: GetCustomersCustomerCards + postCustomersCustomerCards: PostCustomersCustomerCards + deleteCustomersCustomerCardsId: DeleteCustomersCustomerCardsId + getCustomersCustomerCardsId: GetCustomersCustomerCardsId + postCustomersCustomerCardsId: PostCustomersCustomerCardsId + getCustomersCustomerCashBalance: GetCustomersCustomerCashBalance + postCustomersCustomerCashBalance: PostCustomersCustomerCashBalance + getCustomersCustomerCashBalanceTransactions: GetCustomersCustomerCashBalanceTransactions + getCustomersCustomerCashBalanceTransactionsTransaction: GetCustomersCustomerCashBalanceTransactionsTransaction + deleteCustomersCustomerDiscount: DeleteCustomersCustomerDiscount + getCustomersCustomerDiscount: GetCustomersCustomerDiscount + postCustomersCustomerFundingInstructions: PostCustomersCustomerFundingInstructions + getCustomersCustomerPaymentMethods: GetCustomersCustomerPaymentMethods + getCustomersCustomerPaymentMethodsPaymentMethod: GetCustomersCustomerPaymentMethodsPaymentMethod + getCustomersCustomerSources: GetCustomersCustomerSources + postCustomersCustomerSources: PostCustomersCustomerSources + deleteCustomersCustomerSourcesId: DeleteCustomersCustomerSourcesId + getCustomersCustomerSourcesId: GetCustomersCustomerSourcesId + postCustomersCustomerSourcesId: PostCustomersCustomerSourcesId + postCustomersCustomerSourcesIdVerify: PostCustomersCustomerSourcesIdVerify + getCustomersCustomerSubscriptions: GetCustomersCustomerSubscriptions + postCustomersCustomerSubscriptions: PostCustomersCustomerSubscriptions + deleteCustomersCustomerSubscriptionsSubscriptionExposedId: DeleteCustomersCustomerSubscriptionsSubscriptionExposedId + getCustomersCustomerSubscriptionsSubscriptionExposedId: GetCustomersCustomerSubscriptionsSubscriptionExposedId + postCustomersCustomerSubscriptionsSubscriptionExposedId: PostCustomersCustomerSubscriptionsSubscriptionExposedId + deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount: DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount + getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount: GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount + getCustomersCustomerTaxIds: GetCustomersCustomerTaxIds + postCustomersCustomerTaxIds: PostCustomersCustomerTaxIds + deleteCustomersCustomerTaxIdsId: DeleteCustomersCustomerTaxIdsId + getCustomersCustomerTaxIdsId: GetCustomersCustomerTaxIdsId + getDisputes: GetDisputes + getDisputesDispute: GetDisputesDispute + postDisputesDispute: PostDisputesDispute + postDisputesDisputeClose: PostDisputesDisputeClose + getEntitlementsActiveEntitlements: GetEntitlementsActiveEntitlements + getEntitlementsActiveEntitlementsId: GetEntitlementsActiveEntitlementsId + getEntitlementsFeatures: GetEntitlementsFeatures + postEntitlementsFeatures: PostEntitlementsFeatures + getEntitlementsFeaturesId: GetEntitlementsFeaturesId + postEntitlementsFeaturesId: PostEntitlementsFeaturesId + postEphemeralKeys: PostEphemeralKeys + deleteEphemeralKeysKey: DeleteEphemeralKeysKey + getEvents: GetEvents + getEventsId: GetEventsId + getExchangeRates: GetExchangeRates + getExchangeRatesRateId: GetExchangeRatesRateId + postExternalAccountsId: PostExternalAccountsId + getFileLinks: GetFileLinks + postFileLinks: PostFileLinks + getFileLinksLink: GetFileLinksLink + postFileLinksLink: PostFileLinksLink + getFiles: GetFiles + postFiles: PostFiles + getFilesFile: GetFilesFile + getFinancialConnectionsAccounts: GetFinancialConnectionsAccounts + getFinancialConnectionsAccountsAccount: GetFinancialConnectionsAccountsAccount + postFinancialConnectionsAccountsAccountDisconnect: PostFinancialConnectionsAccountsAccountDisconnect + getFinancialConnectionsAccountsAccountOwners: GetFinancialConnectionsAccountsAccountOwners + postFinancialConnectionsAccountsAccountRefresh: PostFinancialConnectionsAccountsAccountRefresh + postFinancialConnectionsAccountsAccountSubscribe: PostFinancialConnectionsAccountsAccountSubscribe + postFinancialConnectionsAccountsAccountUnsubscribe: PostFinancialConnectionsAccountsAccountUnsubscribe + postFinancialConnectionsSessions: PostFinancialConnectionsSessions + getFinancialConnectionsSessionsSession: GetFinancialConnectionsSessionsSession + getFinancialConnectionsTransactions: GetFinancialConnectionsTransactions + getFinancialConnectionsTransactionsTransaction: GetFinancialConnectionsTransactionsTransaction + getForwardingRequests: GetForwardingRequests + postForwardingRequests: PostForwardingRequests + getForwardingRequestsId: GetForwardingRequestsId + getIdentityVerificationReports: GetIdentityVerificationReports + getIdentityVerificationReportsReport: GetIdentityVerificationReportsReport + getIdentityVerificationSessions: GetIdentityVerificationSessions + postIdentityVerificationSessions: PostIdentityVerificationSessions + getIdentityVerificationSessionsSession: GetIdentityVerificationSessionsSession + postIdentityVerificationSessionsSession: PostIdentityVerificationSessionsSession + postIdentityVerificationSessionsSessionCancel: PostIdentityVerificationSessionsSessionCancel + postIdentityVerificationSessionsSessionRedact: PostIdentityVerificationSessionsSessionRedact + getInvoicePayments: GetInvoicePayments + getInvoicePaymentsInvoicePayment: GetInvoicePaymentsInvoicePayment + getInvoiceRenderingTemplates: GetInvoiceRenderingTemplates + getInvoiceRenderingTemplatesTemplate: GetInvoiceRenderingTemplatesTemplate + postInvoiceRenderingTemplatesTemplateArchive: PostInvoiceRenderingTemplatesTemplateArchive + postInvoiceRenderingTemplatesTemplateUnarchive: PostInvoiceRenderingTemplatesTemplateUnarchive + getInvoiceitems: GetInvoiceitems + postInvoiceitems: PostInvoiceitems + deleteInvoiceitemsInvoiceitem: DeleteInvoiceitemsInvoiceitem + getInvoiceitemsInvoiceitem: GetInvoiceitemsInvoiceitem + postInvoiceitemsInvoiceitem: PostInvoiceitemsInvoiceitem + getInvoices: GetInvoices + postInvoices: PostInvoices + postInvoicesCreatePreview: PostInvoicesCreatePreview + getInvoicesSearch: GetInvoicesSearch + deleteInvoicesInvoice: DeleteInvoicesInvoice + getInvoicesInvoice: GetInvoicesInvoice + postInvoicesInvoice: PostInvoicesInvoice + postInvoicesInvoiceAddLines: PostInvoicesInvoiceAddLines + postInvoicesInvoiceFinalize: PostInvoicesInvoiceFinalize + getInvoicesInvoiceLines: GetInvoicesInvoiceLines + postInvoicesInvoiceLinesLineItemId: PostInvoicesInvoiceLinesLineItemId + postInvoicesInvoiceMarkUncollectible: PostInvoicesInvoiceMarkUncollectible + postInvoicesInvoicePay: PostInvoicesInvoicePay + postInvoicesInvoiceRemoveLines: PostInvoicesInvoiceRemoveLines + postInvoicesInvoiceSend: PostInvoicesInvoiceSend + postInvoicesInvoiceUpdateLines: PostInvoicesInvoiceUpdateLines + postInvoicesInvoiceVoid: PostInvoicesInvoiceVoid + getIssuingAuthorizations: GetIssuingAuthorizations + getIssuingAuthorizationsAuthorization: GetIssuingAuthorizationsAuthorization + postIssuingAuthorizationsAuthorization: PostIssuingAuthorizationsAuthorization + postIssuingAuthorizationsAuthorizationApprove: PostIssuingAuthorizationsAuthorizationApprove + postIssuingAuthorizationsAuthorizationDecline: PostIssuingAuthorizationsAuthorizationDecline + getIssuingCardholders: GetIssuingCardholders + postIssuingCardholders: PostIssuingCardholders + getIssuingCardholdersCardholder: GetIssuingCardholdersCardholder + postIssuingCardholdersCardholder: PostIssuingCardholdersCardholder + getIssuingCards: GetIssuingCards + postIssuingCards: PostIssuingCards + getIssuingCardsCard: GetIssuingCardsCard + postIssuingCardsCard: PostIssuingCardsCard + getIssuingDisputes: GetIssuingDisputes + postIssuingDisputes: PostIssuingDisputes + getIssuingDisputesDispute: GetIssuingDisputesDispute + postIssuingDisputesDispute: PostIssuingDisputesDispute + postIssuingDisputesDisputeSubmit: PostIssuingDisputesDisputeSubmit + getIssuingPersonalizationDesigns: GetIssuingPersonalizationDesigns + postIssuingPersonalizationDesigns: PostIssuingPersonalizationDesigns + getIssuingPersonalizationDesignsPersonalizationDesign: GetIssuingPersonalizationDesignsPersonalizationDesign + postIssuingPersonalizationDesignsPersonalizationDesign: PostIssuingPersonalizationDesignsPersonalizationDesign + getIssuingPhysicalBundles: GetIssuingPhysicalBundles + getIssuingPhysicalBundlesPhysicalBundle: GetIssuingPhysicalBundlesPhysicalBundle + getIssuingSettlementsSettlement: GetIssuingSettlementsSettlement + postIssuingSettlementsSettlement: PostIssuingSettlementsSettlement + getIssuingTokens: GetIssuingTokens + getIssuingTokensToken: GetIssuingTokensToken + postIssuingTokensToken: PostIssuingTokensToken + getIssuingTransactions: GetIssuingTransactions + getIssuingTransactionsTransaction: GetIssuingTransactionsTransaction + postIssuingTransactionsTransaction: PostIssuingTransactionsTransaction + postLinkAccountSessions: PostLinkAccountSessions + getLinkAccountSessionsSession: GetLinkAccountSessionsSession + getLinkedAccounts: GetLinkedAccounts + getLinkedAccountsAccount: GetLinkedAccountsAccount + postLinkedAccountsAccountDisconnect: PostLinkedAccountsAccountDisconnect + getLinkedAccountsAccountOwners: GetLinkedAccountsAccountOwners + postLinkedAccountsAccountRefresh: PostLinkedAccountsAccountRefresh + getMandatesMandate: GetMandatesMandate + getPaymentIntents: GetPaymentIntents + postPaymentIntents: PostPaymentIntents + getPaymentIntentsSearch: GetPaymentIntentsSearch + getPaymentIntentsIntent: GetPaymentIntentsIntent + postPaymentIntentsIntent: PostPaymentIntentsIntent + postPaymentIntentsIntentApplyCustomerBalance: PostPaymentIntentsIntentApplyCustomerBalance + postPaymentIntentsIntentCancel: PostPaymentIntentsIntentCancel + postPaymentIntentsIntentCapture: PostPaymentIntentsIntentCapture + postPaymentIntentsIntentConfirm: PostPaymentIntentsIntentConfirm + postPaymentIntentsIntentIncrementAuthorization: PostPaymentIntentsIntentIncrementAuthorization + postPaymentIntentsIntentVerifyMicrodeposits: PostPaymentIntentsIntentVerifyMicrodeposits + getPaymentLinks: GetPaymentLinks + postPaymentLinks: PostPaymentLinks + getPaymentLinksPaymentLink: GetPaymentLinksPaymentLink + postPaymentLinksPaymentLink: PostPaymentLinksPaymentLink + getPaymentLinksPaymentLinkLineItems: GetPaymentLinksPaymentLinkLineItems + getPaymentMethodConfigurations: GetPaymentMethodConfigurations + postPaymentMethodConfigurations: PostPaymentMethodConfigurations + getPaymentMethodConfigurationsConfiguration: GetPaymentMethodConfigurationsConfiguration + postPaymentMethodConfigurationsConfiguration: PostPaymentMethodConfigurationsConfiguration + getPaymentMethodDomains: GetPaymentMethodDomains + postPaymentMethodDomains: PostPaymentMethodDomains + getPaymentMethodDomainsPaymentMethodDomain: GetPaymentMethodDomainsPaymentMethodDomain + postPaymentMethodDomainsPaymentMethodDomain: PostPaymentMethodDomainsPaymentMethodDomain + postPaymentMethodDomainsPaymentMethodDomainValidate: PostPaymentMethodDomainsPaymentMethodDomainValidate + getPaymentMethods: GetPaymentMethods + postPaymentMethods: PostPaymentMethods + getPaymentMethodsPaymentMethod: GetPaymentMethodsPaymentMethod + postPaymentMethodsPaymentMethod: PostPaymentMethodsPaymentMethod + postPaymentMethodsPaymentMethodAttach: PostPaymentMethodsPaymentMethodAttach + postPaymentMethodsPaymentMethodDetach: PostPaymentMethodsPaymentMethodDetach + getPayouts: GetPayouts + postPayouts: PostPayouts + getPayoutsPayout: GetPayoutsPayout + postPayoutsPayout: PostPayoutsPayout + postPayoutsPayoutCancel: PostPayoutsPayoutCancel + postPayoutsPayoutReverse: PostPayoutsPayoutReverse + getPlans: GetPlans + postPlans: PostPlans + deletePlansPlan: DeletePlansPlan + getPlansPlan: GetPlansPlan + postPlansPlan: PostPlansPlan + getPrices: GetPrices + postPrices: PostPrices + getPricesSearch: GetPricesSearch + getPricesPrice: GetPricesPrice + postPricesPrice: PostPricesPrice + getProducts: GetProducts + postProducts: PostProducts + getProductsSearch: GetProductsSearch + deleteProductsId: DeleteProductsId + getProductsId: GetProductsId + postProductsId: PostProductsId + getProductsProductFeatures: GetProductsProductFeatures + postProductsProductFeatures: PostProductsProductFeatures + deleteProductsProductFeaturesId: DeleteProductsProductFeaturesId + getProductsProductFeaturesId: GetProductsProductFeaturesId + getPromotionCodes: GetPromotionCodes + postPromotionCodes: PostPromotionCodes + getPromotionCodesPromotionCode: GetPromotionCodesPromotionCode + postPromotionCodesPromotionCode: PostPromotionCodesPromotionCode + getQuotes: GetQuotes + postQuotes: PostQuotes + getQuotesQuote: GetQuotesQuote + postQuotesQuote: PostQuotesQuote + postQuotesQuoteAccept: PostQuotesQuoteAccept + postQuotesQuoteCancel: PostQuotesQuoteCancel + getQuotesQuoteComputedUpfrontLineItems: GetQuotesQuoteComputedUpfrontLineItems + postQuotesQuoteFinalize: PostQuotesQuoteFinalize + getQuotesQuoteLineItems: GetQuotesQuoteLineItems + getQuotesQuotePdf: GetQuotesQuotePdf + getRadarEarlyFraudWarnings: GetRadarEarlyFraudWarnings + getRadarEarlyFraudWarningsEarlyFraudWarning: GetRadarEarlyFraudWarningsEarlyFraudWarning + getRadarValueListItems: GetRadarValueListItems + postRadarValueListItems: PostRadarValueListItems + deleteRadarValueListItemsItem: DeleteRadarValueListItemsItem + getRadarValueListItemsItem: GetRadarValueListItemsItem + getRadarValueLists: GetRadarValueLists + postRadarValueLists: PostRadarValueLists + deleteRadarValueListsValueList: DeleteRadarValueListsValueList + getRadarValueListsValueList: GetRadarValueListsValueList + postRadarValueListsValueList: PostRadarValueListsValueList + getRefunds: GetRefunds + postRefunds: PostRefunds + getRefundsRefund: GetRefundsRefund + postRefundsRefund: PostRefundsRefund + postRefundsRefundCancel: PostRefundsRefundCancel + getReportingReportRuns: GetReportingReportRuns + postReportingReportRuns: PostReportingReportRuns + getReportingReportRunsReportRun: GetReportingReportRunsReportRun + getReportingReportTypes: GetReportingReportTypes + getReportingReportTypesReportType: GetReportingReportTypesReportType + getReviews: GetReviews + getReviewsReview: GetReviewsReview + postReviewsReviewApprove: PostReviewsReviewApprove + getSetupAttempts: GetSetupAttempts + getSetupIntents: GetSetupIntents + postSetupIntents: PostSetupIntents + getSetupIntentsIntent: GetSetupIntentsIntent + postSetupIntentsIntent: PostSetupIntentsIntent + postSetupIntentsIntentCancel: PostSetupIntentsIntentCancel + postSetupIntentsIntentConfirm: PostSetupIntentsIntentConfirm + postSetupIntentsIntentVerifyMicrodeposits: PostSetupIntentsIntentVerifyMicrodeposits + getShippingRates: GetShippingRates + postShippingRates: PostShippingRates + getShippingRatesShippingRateToken: GetShippingRatesShippingRateToken + postShippingRatesShippingRateToken: PostShippingRatesShippingRateToken + postSigmaSavedQueriesId: PostSigmaSavedQueriesId + getSigmaScheduledQueryRuns: GetSigmaScheduledQueryRuns + getSigmaScheduledQueryRunsScheduledQueryRun: GetSigmaScheduledQueryRunsScheduledQueryRun + postSources: PostSources + getSourcesSource: GetSourcesSource + postSourcesSource: PostSourcesSource + getSourcesSourceMandateNotificationsMandateNotification: GetSourcesSourceMandateNotificationsMandateNotification + getSourcesSourceSourceTransactions: GetSourcesSourceSourceTransactions + getSourcesSourceSourceTransactionsSourceTransaction: GetSourcesSourceSourceTransactionsSourceTransaction + postSourcesSourceVerify: PostSourcesSourceVerify + getSubscriptionItems: GetSubscriptionItems + postSubscriptionItems: PostSubscriptionItems + deleteSubscriptionItemsItem: DeleteSubscriptionItemsItem + getSubscriptionItemsItem: GetSubscriptionItemsItem + postSubscriptionItemsItem: PostSubscriptionItemsItem + getSubscriptionSchedules: GetSubscriptionSchedules + postSubscriptionSchedules: PostSubscriptionSchedules + getSubscriptionSchedulesSchedule: GetSubscriptionSchedulesSchedule + postSubscriptionSchedulesSchedule: PostSubscriptionSchedulesSchedule + postSubscriptionSchedulesScheduleCancel: PostSubscriptionSchedulesScheduleCancel + postSubscriptionSchedulesScheduleRelease: PostSubscriptionSchedulesScheduleRelease + getSubscriptions: GetSubscriptions + postSubscriptions: PostSubscriptions + getSubscriptionsSearch: GetSubscriptionsSearch + deleteSubscriptionsSubscriptionExposedId: DeleteSubscriptionsSubscriptionExposedId + getSubscriptionsSubscriptionExposedId: GetSubscriptionsSubscriptionExposedId + postSubscriptionsSubscriptionExposedId: PostSubscriptionsSubscriptionExposedId + deleteSubscriptionsSubscriptionExposedIdDiscount: DeleteSubscriptionsSubscriptionExposedIdDiscount + postSubscriptionsSubscriptionResume: PostSubscriptionsSubscriptionResume + postTaxCalculations: PostTaxCalculations + getTaxCalculationsCalculation: GetTaxCalculationsCalculation + getTaxCalculationsCalculationLineItems: GetTaxCalculationsCalculationLineItems + getTaxRegistrations: GetTaxRegistrations + postTaxRegistrations: PostTaxRegistrations + getTaxRegistrationsId: GetTaxRegistrationsId + postTaxRegistrationsId: PostTaxRegistrationsId + getTaxSettings: GetTaxSettings + postTaxSettings: PostTaxSettings + postTaxTransactionsCreateFromCalculation: PostTaxTransactionsCreateFromCalculation + postTaxTransactionsCreateReversal: PostTaxTransactionsCreateReversal + getTaxTransactionsTransaction: GetTaxTransactionsTransaction + getTaxTransactionsTransactionLineItems: GetTaxTransactionsTransactionLineItems + getTaxCodes: GetTaxCodes + getTaxCodesId: GetTaxCodesId + getTaxIds: GetTaxIds + postTaxIds: PostTaxIds + deleteTaxIdsId: DeleteTaxIdsId + getTaxIdsId: GetTaxIdsId + getTaxRates: GetTaxRates + postTaxRates: PostTaxRates + getTaxRatesTaxRate: GetTaxRatesTaxRate + postTaxRatesTaxRate: PostTaxRatesTaxRate + getTerminalConfigurations: GetTerminalConfigurations + postTerminalConfigurations: PostTerminalConfigurations + deleteTerminalConfigurationsConfiguration: DeleteTerminalConfigurationsConfiguration + getTerminalConfigurationsConfiguration: GetTerminalConfigurationsConfiguration + postTerminalConfigurationsConfiguration: PostTerminalConfigurationsConfiguration + postTerminalConnectionTokens: PostTerminalConnectionTokens + getTerminalLocations: GetTerminalLocations + postTerminalLocations: PostTerminalLocations + deleteTerminalLocationsLocation: DeleteTerminalLocationsLocation + getTerminalLocationsLocation: GetTerminalLocationsLocation + postTerminalLocationsLocation: PostTerminalLocationsLocation + getTerminalReaders: GetTerminalReaders + postTerminalReaders: PostTerminalReaders + deleteTerminalReadersReader: DeleteTerminalReadersReader + getTerminalReadersReader: GetTerminalReadersReader + postTerminalReadersReader: PostTerminalReadersReader + postTerminalReadersReaderCancelAction: PostTerminalReadersReaderCancelAction + postTerminalReadersReaderProcessPaymentIntent: PostTerminalReadersReaderProcessPaymentIntent + postTerminalReadersReaderProcessSetupIntent: PostTerminalReadersReaderProcessSetupIntent + postTerminalReadersReaderRefundPayment: PostTerminalReadersReaderRefundPayment + postTerminalReadersReaderSetReaderDisplay: PostTerminalReadersReaderSetReaderDisplay + postTestHelpersConfirmationTokens: PostTestHelpersConfirmationTokens + postTestHelpersCustomersCustomerFundCashBalance: PostTestHelpersCustomersCustomerFundCashBalance + postTestHelpersIssuingAuthorizations: PostTestHelpersIssuingAuthorizations + postTestHelpersIssuingAuthorizationsAuthorizationCapture: PostTestHelpersIssuingAuthorizationsAuthorizationCapture + postTestHelpersIssuingAuthorizationsAuthorizationExpire: PostTestHelpersIssuingAuthorizationsAuthorizationExpire + postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmount: PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmount + postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespond: PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespond + postTestHelpersIssuingAuthorizationsAuthorizationIncrement: PostTestHelpersIssuingAuthorizationsAuthorizationIncrement + postTestHelpersIssuingAuthorizationsAuthorizationReverse: PostTestHelpersIssuingAuthorizationsAuthorizationReverse + postTestHelpersIssuingCardsCardShippingDeliver: PostTestHelpersIssuingCardsCardShippingDeliver + postTestHelpersIssuingCardsCardShippingFail: PostTestHelpersIssuingCardsCardShippingFail + postTestHelpersIssuingCardsCardShippingReturn: PostTestHelpersIssuingCardsCardShippingReturn + postTestHelpersIssuingCardsCardShippingShip: PostTestHelpersIssuingCardsCardShippingShip + postTestHelpersIssuingCardsCardShippingSubmit: PostTestHelpersIssuingCardsCardShippingSubmit + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate: PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate: PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject: PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject + postTestHelpersIssuingSettlements: PostTestHelpersIssuingSettlements + postTestHelpersIssuingSettlementsSettlementComplete: PostTestHelpersIssuingSettlementsSettlementComplete + postTestHelpersIssuingTransactionsCreateForceCapture: PostTestHelpersIssuingTransactionsCreateForceCapture + postTestHelpersIssuingTransactionsCreateUnlinkedRefund: PostTestHelpersIssuingTransactionsCreateUnlinkedRefund + postTestHelpersIssuingTransactionsTransactionRefund: PostTestHelpersIssuingTransactionsTransactionRefund + postTestHelpersRefundsRefundExpire: PostTestHelpersRefundsRefundExpire + postTestHelpersTerminalReadersReaderPresentPaymentMethod: PostTestHelpersTerminalReadersReaderPresentPaymentMethod + getTestHelpersTestClocks: GetTestHelpersTestClocks + postTestHelpersTestClocks: PostTestHelpersTestClocks + deleteTestHelpersTestClocksTestClock: DeleteTestHelpersTestClocksTestClock + getTestHelpersTestClocksTestClock: GetTestHelpersTestClocksTestClock + postTestHelpersTestClocksTestClockAdvance: PostTestHelpersTestClocksTestClockAdvance + postTestHelpersTreasuryInboundTransfersIdFail: PostTestHelpersTreasuryInboundTransfersIdFail + postTestHelpersTreasuryInboundTransfersIdReturn: PostTestHelpersTreasuryInboundTransfersIdReturn + postTestHelpersTreasuryInboundTransfersIdSucceed: PostTestHelpersTreasuryInboundTransfersIdSucceed + postTestHelpersTreasuryOutboundPaymentsId: PostTestHelpersTreasuryOutboundPaymentsId + postTestHelpersTreasuryOutboundPaymentsIdFail: PostTestHelpersTreasuryOutboundPaymentsIdFail + postTestHelpersTreasuryOutboundPaymentsIdPost: PostTestHelpersTreasuryOutboundPaymentsIdPost + postTestHelpersTreasuryOutboundPaymentsIdReturn: PostTestHelpersTreasuryOutboundPaymentsIdReturn + postTestHelpersTreasuryOutboundTransfersOutboundTransfer: PostTestHelpersTreasuryOutboundTransfersOutboundTransfer + postTestHelpersTreasuryOutboundTransfersOutboundTransferFail: PostTestHelpersTreasuryOutboundTransfersOutboundTransferFail + postTestHelpersTreasuryOutboundTransfersOutboundTransferPost: PostTestHelpersTreasuryOutboundTransfersOutboundTransferPost + postTestHelpersTreasuryOutboundTransfersOutboundTransferReturn: PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturn + postTestHelpersTreasuryReceivedCredits: PostTestHelpersTreasuryReceivedCredits + postTestHelpersTreasuryReceivedDebits: PostTestHelpersTreasuryReceivedDebits + postTokens: PostTokens + getTokensToken: GetTokensToken + getTopups: GetTopups + postTopups: PostTopups + getTopupsTopup: GetTopupsTopup + postTopupsTopup: PostTopupsTopup + postTopupsTopupCancel: PostTopupsTopupCancel + getTransfers: GetTransfers + postTransfers: PostTransfers + getTransfersIdReversals: GetTransfersIdReversals + postTransfersIdReversals: PostTransfersIdReversals + getTransfersTransfer: GetTransfersTransfer + postTransfersTransfer: PostTransfersTransfer + getTransfersTransferReversalsId: GetTransfersTransferReversalsId + postTransfersTransferReversalsId: PostTransfersTransferReversalsId + getTreasuryCreditReversals: GetTreasuryCreditReversals + postTreasuryCreditReversals: PostTreasuryCreditReversals + getTreasuryCreditReversalsCreditReversal: GetTreasuryCreditReversalsCreditReversal + getTreasuryDebitReversals: GetTreasuryDebitReversals + postTreasuryDebitReversals: PostTreasuryDebitReversals + getTreasuryDebitReversalsDebitReversal: GetTreasuryDebitReversalsDebitReversal + getTreasuryFinancialAccounts: GetTreasuryFinancialAccounts + postTreasuryFinancialAccounts: PostTreasuryFinancialAccounts + getTreasuryFinancialAccountsFinancialAccount: GetTreasuryFinancialAccountsFinancialAccount + postTreasuryFinancialAccountsFinancialAccount: PostTreasuryFinancialAccountsFinancialAccount + postTreasuryFinancialAccountsFinancialAccountClose: PostTreasuryFinancialAccountsFinancialAccountClose + getTreasuryFinancialAccountsFinancialAccountFeatures: GetTreasuryFinancialAccountsFinancialAccountFeatures + postTreasuryFinancialAccountsFinancialAccountFeatures: PostTreasuryFinancialAccountsFinancialAccountFeatures + getTreasuryInboundTransfers: GetTreasuryInboundTransfers + postTreasuryInboundTransfers: PostTreasuryInboundTransfers + getTreasuryInboundTransfersId: GetTreasuryInboundTransfersId + postTreasuryInboundTransfersInboundTransferCancel: PostTreasuryInboundTransfersInboundTransferCancel + getTreasuryOutboundPayments: GetTreasuryOutboundPayments + postTreasuryOutboundPayments: PostTreasuryOutboundPayments + getTreasuryOutboundPaymentsId: GetTreasuryOutboundPaymentsId + postTreasuryOutboundPaymentsIdCancel: PostTreasuryOutboundPaymentsIdCancel + getTreasuryOutboundTransfers: GetTreasuryOutboundTransfers + postTreasuryOutboundTransfers: PostTreasuryOutboundTransfers + getTreasuryOutboundTransfersOutboundTransfer: GetTreasuryOutboundTransfersOutboundTransfer + postTreasuryOutboundTransfersOutboundTransferCancel: PostTreasuryOutboundTransfersOutboundTransferCancel + getTreasuryReceivedCredits: GetTreasuryReceivedCredits + getTreasuryReceivedCreditsId: GetTreasuryReceivedCreditsId + getTreasuryReceivedDebits: GetTreasuryReceivedDebits + getTreasuryReceivedDebitsId: GetTreasuryReceivedDebitsId + getTreasuryTransactionEntries: GetTreasuryTransactionEntries + getTreasuryTransactionEntriesId: GetTreasuryTransactionEntriesId + getTreasuryTransactions: GetTreasuryTransactions + getTreasuryTransactionsId: GetTreasuryTransactionsId + getWebhookEndpoints: GetWebhookEndpoints + postWebhookEndpoints: PostWebhookEndpoints + deleteWebhookEndpointsWebhookEndpoint: DeleteWebhookEndpointsWebhookEndpoint + getWebhookEndpointsWebhookEndpoint: GetWebhookEndpointsWebhookEndpoint + postWebhookEndpointsWebhookEndpoint: PostWebhookEndpointsWebhookEndpoint +} + +export function createRouter(implementation: Implementation): Router { + const router = Router() + + const getAccountQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getAccountRequestBodySchema = z.object({}).optional() + + const getAccountResponseBodyValidator = responseValidationFactory( + [["200", s_account]], + s_error, + ) + + // getAccount + router.get( + `/v1/account`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getAccountQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccount(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getAccountResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountLinksRequestBodySchema = z.object({ + account: z.string().max(5000), + collect: z.enum(["currently_due", "eventually_due"]).optional(), + collection_options: z + .object({ + fields: z.enum(["currently_due", "eventually_due"]).optional(), + future_requirements: z.enum(["include", "omit"]).optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + refresh_url: z.string().optional(), + return_url: z.string().optional(), + type: z.enum(["account_onboarding", "account_update"]), + }) + + const postAccountLinksResponseBodyValidator = responseValidationFactory( + [["200", s_account_link]], + s_error, + ) + + // postAccountLinks + router.post( + `/v1/account_links`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postAccountLinksRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountLinks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postAccountLinksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountSessionsRequestBodySchema = z.object({ + account: z.string(), + components: z.object({ + account_management: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + disable_stripe_user_authentication: PermissiveBoolean.optional(), + external_account_collection: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + account_onboarding: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + disable_stripe_user_authentication: PermissiveBoolean.optional(), + external_account_collection: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + balances: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + disable_stripe_user_authentication: PermissiveBoolean.optional(), + edit_payout_schedule: PermissiveBoolean.optional(), + external_account_collection: PermissiveBoolean.optional(), + instant_payouts: PermissiveBoolean.optional(), + standard_payouts: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + documents: z + .object({ + enabled: PermissiveBoolean, + features: z.object({}).optional(), + }) + .optional(), + financial_account: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + disable_stripe_user_authentication: PermissiveBoolean.optional(), + external_account_collection: PermissiveBoolean.optional(), + send_money: PermissiveBoolean.optional(), + transfer_balance: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + financial_account_transactions: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + card_spend_dispute_management: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + issuing_card: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + card_management: PermissiveBoolean.optional(), + card_spend_dispute_management: PermissiveBoolean.optional(), + cardholder_management: PermissiveBoolean.optional(), + spend_control_management: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + issuing_cards_list: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + card_management: PermissiveBoolean.optional(), + card_spend_dispute_management: PermissiveBoolean.optional(), + cardholder_management: PermissiveBoolean.optional(), + disable_stripe_user_authentication: PermissiveBoolean.optional(), + spend_control_management: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + notification_banner: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + disable_stripe_user_authentication: PermissiveBoolean.optional(), + external_account_collection: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + payment_details: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + capture_payments: PermissiveBoolean.optional(), + destination_on_behalf_of_charge_management: + PermissiveBoolean.optional(), + dispute_management: PermissiveBoolean.optional(), + refund_management: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + payments: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + capture_payments: PermissiveBoolean.optional(), + destination_on_behalf_of_charge_management: + PermissiveBoolean.optional(), + dispute_management: PermissiveBoolean.optional(), + refund_management: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + payouts: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + disable_stripe_user_authentication: PermissiveBoolean.optional(), + edit_payout_schedule: PermissiveBoolean.optional(), + external_account_collection: PermissiveBoolean.optional(), + instant_payouts: PermissiveBoolean.optional(), + standard_payouts: PermissiveBoolean.optional(), + }) + .optional(), + }) + .optional(), + payouts_list: z + .object({ + enabled: PermissiveBoolean, + features: z.object({}).optional(), + }) + .optional(), + tax_registrations: z + .object({ + enabled: PermissiveBoolean, + features: z.object({}).optional(), + }) + .optional(), + tax_settings: z + .object({ + enabled: PermissiveBoolean, + features: z.object({}).optional(), + }) + .optional(), + }), + expand: z.array(z.string().max(5000)).optional(), + }) + + const postAccountSessionsResponseBodyValidator = responseValidationFactory( + [["200", s_account_session]], + s_error, + ) + + // postAccountSessions + router.post( + `/v1/account_sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postAccountSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postAccountSessionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().optional(), + }) + + const getAccountsRequestBodySchema = z.object({}).optional() + + const getAccountsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_account)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/accounts")), + }), + ], + ], + s_error, + ) + + // getAccounts + router.get( + `/v1/accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getAccountsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_account[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getAccountsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsRequestBodySchema = z + .object({ + account_token: z.string().max(5000).optional(), + bank_account: z + .union([ + z.object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000), + account_type: z + .enum(["checking", "futsu", "savings", "toza"]) + .optional(), + country: z.string().max(5000), + currency: z.string().optional(), + documents: z + .object({ + bank_account_ownership_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + }) + .optional(), + object: z.enum(["bank_account"]).optional(), + routing_number: z.string().max(5000).optional(), + }), + z.string().max(5000), + ]) + .optional(), + business_profile: z + .object({ + annual_revenue: z + .object({ + amount: z.coerce.number(), + currency: z.string(), + fiscal_year_end: z.string().max(5000), + }) + .optional(), + estimated_worker_count: z.coerce.number().optional(), + mcc: z.string().max(4).optional(), + monthly_estimated_revenue: z + .object({ amount: z.coerce.number(), currency: z.string() }) + .optional(), + name: z.string().max(5000).optional(), + product_description: z.string().max(40000).optional(), + support_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + support_email: z.string().optional(), + support_phone: z.string().max(5000).optional(), + support_url: z.union([z.string(), z.enum([""])]).optional(), + url: z.string().optional(), + }) + .optional(), + business_type: z + .enum(["company", "government_entity", "individual", "non_profit"]) + .optional(), + capabilities: z + .object({ + acss_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + affirm_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + afterpay_clearpay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + alma_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + amazon_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + au_becs_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + bacs_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + bancontact_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + billie_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + blik_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + boleto_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + card_issuing: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + card_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + cartes_bancaires_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + cashapp_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + eps_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + fpx_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + gb_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + giropay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + grabpay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + ideal_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + india_international_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + jcb_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + jp_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + kakao_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + klarna_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + konbini_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + kr_card_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + legacy_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + link_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + mobilepay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + multibanco_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + mx_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + naver_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + nz_bank_account_becs_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + oxxo_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + p24_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + pay_by_bank_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + payco_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + paynow_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + promptpay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + revolut_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + samsung_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + satispay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + sepa_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + sepa_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + sofort_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + swish_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + tax_reporting_us_1099_k: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + tax_reporting_us_1099_misc: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + transfers: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + treasury: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + twint_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + us_bank_account_ach_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + us_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + zip_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + }) + .optional(), + company: z + .object({ + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + directors_provided: PermissiveBoolean.optional(), + directorship_declaration: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + executives_provided: PermissiveBoolean.optional(), + export_license_id: z.string().max(5000).optional(), + export_purpose_code: z.string().max(5000).optional(), + name: z.string().max(100).optional(), + name_kana: z.string().max(100).optional(), + name_kanji: z.string().max(100).optional(), + owners_provided: PermissiveBoolean.optional(), + ownership_declaration: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + ownership_exemption_reason: z + .enum([ + "", + "qualified_entity_exceeds_ownership_threshold", + "qualifies_as_financial_institution", + ]) + .optional(), + phone: z.string().max(5000).optional(), + registration_number: z.string().max(5000).optional(), + structure: z + .enum([ + "", + "free_zone_establishment", + "free_zone_llc", + "government_instrumentality", + "governmental_unit", + "incorporated_non_profit", + "incorporated_partnership", + "limited_liability_partnership", + "llc", + "multi_member_llc", + "private_company", + "private_corporation", + "private_partnership", + "public_company", + "public_corporation", + "public_partnership", + "registered_charity", + "single_member_llc", + "sole_establishment", + "sole_proprietorship", + "tax_exempt_government_instrumentality", + "unincorporated_association", + "unincorporated_non_profit", + "unincorporated_partnership", + ]) + .optional(), + tax_id: z.string().max(5000).optional(), + tax_id_registrar: z.string().max(5000).optional(), + vat_id: z.string().max(5000).optional(), + verification: z + .object({ + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + controller: z + .object({ + fees: z + .object({ payer: z.enum(["account", "application"]).optional() }) + .optional(), + losses: z + .object({ payments: z.enum(["application", "stripe"]).optional() }) + .optional(), + requirement_collection: z.enum(["application", "stripe"]).optional(), + stripe_dashboard: z + .object({ type: z.enum(["express", "full", "none"]).optional() }) + .optional(), + }) + .optional(), + country: z.string().max(5000).optional(), + default_currency: z.string().optional(), + documents: z + .object({ + bank_account_ownership_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_license: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_memorandum_of_association: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_ministerial_decree: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_registration_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_tax_id_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + proof_of_registration: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + proof_of_ultimate_beneficial_ownership: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + }) + .optional(), + email: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + external_account: z.string().max(5000).optional(), + groups: z + .object({ + payments_pricing: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + individual: z + .object({ + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + dob: z + .union([ + z.object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + email: z.string().optional(), + first_name: z.string().max(100).optional(), + first_name_kana: z.string().max(5000).optional(), + first_name_kanji: z.string().max(5000).optional(), + full_name_aliases: z + .union([z.array(z.string().max(300)), z.enum([""])]) + .optional(), + gender: z.string().optional(), + id_number: z.string().max(5000).optional(), + id_number_secondary: z.string().max(5000).optional(), + last_name: z.string().max(100).optional(), + last_name_kana: z.string().max(5000).optional(), + last_name_kanji: z.string().max(5000).optional(), + maiden_name: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + phone: z.string().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + relationship: z + .object({ + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + percent_ownership: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + title: z.string().max(5000).optional(), + }) + .optional(), + ssn_last_4: z.string().max(5000).optional(), + verification: z + .object({ + additional_document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + settings: z + .object({ + bacs_debit_payments: z + .object({ display_name: z.string().optional() }) + .optional(), + branding: z + .object({ + icon: z.string().max(5000).optional(), + logo: z.string().max(5000).optional(), + primary_color: z.string().max(5000).optional(), + secondary_color: z.string().max(5000).optional(), + }) + .optional(), + card_issuing: z + .object({ + tos_acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + card_payments: z + .object({ + decline_on: z + .object({ + avs_failure: PermissiveBoolean.optional(), + cvc_failure: PermissiveBoolean.optional(), + }) + .optional(), + statement_descriptor_prefix: z.string().max(10).optional(), + statement_descriptor_prefix_kana: z + .union([z.string().max(10), z.enum([""])]) + .optional(), + statement_descriptor_prefix_kanji: z + .union([z.string().max(10), z.enum([""])]) + .optional(), + }) + .optional(), + invoices: z + .object({ + hosted_payment_method_save: z + .enum(["always", "never", "offer"]) + .optional(), + }) + .optional(), + payments: z + .object({ + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_kana: z.string().max(22).optional(), + statement_descriptor_kanji: z.string().max(22).optional(), + }) + .optional(), + payouts: z + .object({ + debit_negative_balances: PermissiveBoolean.optional(), + schedule: z + .object({ + delay_days: z + .union([z.enum(["minimum"]), z.coerce.number()]) + .optional(), + interval: z + .enum(["daily", "manual", "monthly", "weekly"]) + .optional(), + monthly_anchor: z.coerce.number().optional(), + weekly_anchor: z + .enum([ + "friday", + "monday", + "saturday", + "sunday", + "thursday", + "tuesday", + "wednesday", + ]) + .optional(), + }) + .optional(), + statement_descriptor: z.string().max(22).optional(), + }) + .optional(), + treasury: z + .object({ + tos_acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + tos_acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + service_agreement: z.string().max(5000).optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + type: z.enum(["custom", "express", "standard"]).optional(), + }) + .optional() + + const postAccountsResponseBodyValidator = responseValidationFactory( + [["200", s_account]], + s_error, + ) + + // postAccounts + router.post( + `/v1/accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postAccountsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteAccountsAccountParamSchema = z.object({ + account: z.string().max(5000), + }) + + const deleteAccountsAccountRequestBodySchema = z.object({}).optional() + + const deleteAccountsAccountResponseBodyValidator = responseValidationFactory( + [["200", s_deleted_account]], + s_error, + ) + + // deleteAccountsAccount + router.delete( + `/v1/accounts/:account`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteAccountsAccountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteAccountsAccountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteAccountsAccount(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteAccountsAccountResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getAccountsAccountQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getAccountsAccountRequestBodySchema = z.object({}).optional() + + const getAccountsAccountResponseBodyValidator = responseValidationFactory( + [["200", s_account]], + s_error, + ) + + // getAccountsAccount + router.get( + `/v1/accounts/:account`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccount(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getAccountsAccountResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postAccountsAccountRequestBodySchema = z + .object({ + account_token: z.string().max(5000).optional(), + business_profile: z + .object({ + annual_revenue: z + .object({ + amount: z.coerce.number(), + currency: z.string(), + fiscal_year_end: z.string().max(5000), + }) + .optional(), + estimated_worker_count: z.coerce.number().optional(), + mcc: z.string().max(4).optional(), + monthly_estimated_revenue: z + .object({ amount: z.coerce.number(), currency: z.string() }) + .optional(), + name: z.string().max(5000).optional(), + product_description: z.string().max(40000).optional(), + support_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + support_email: z.string().optional(), + support_phone: z.string().max(5000).optional(), + support_url: z.union([z.string(), z.enum([""])]).optional(), + url: z.string().optional(), + }) + .optional(), + business_type: z + .enum(["company", "government_entity", "individual", "non_profit"]) + .optional(), + capabilities: z + .object({ + acss_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + affirm_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + afterpay_clearpay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + alma_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + amazon_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + au_becs_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + bacs_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + bancontact_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + billie_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + blik_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + boleto_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + card_issuing: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + card_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + cartes_bancaires_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + cashapp_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + eps_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + fpx_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + gb_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + giropay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + grabpay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + ideal_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + india_international_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + jcb_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + jp_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + kakao_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + klarna_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + konbini_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + kr_card_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + legacy_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + link_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + mobilepay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + multibanco_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + mx_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + naver_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + nz_bank_account_becs_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + oxxo_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + p24_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + pay_by_bank_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + payco_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + paynow_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + promptpay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + revolut_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + samsung_pay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + satispay_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + sepa_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + sepa_debit_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + sofort_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + swish_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + tax_reporting_us_1099_k: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + tax_reporting_us_1099_misc: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + transfers: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + treasury: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + twint_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + us_bank_account_ach_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + us_bank_transfer_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + zip_payments: z + .object({ requested: PermissiveBoolean.optional() }) + .optional(), + }) + .optional(), + company: z + .object({ + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + directors_provided: PermissiveBoolean.optional(), + directorship_declaration: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + executives_provided: PermissiveBoolean.optional(), + export_license_id: z.string().max(5000).optional(), + export_purpose_code: z.string().max(5000).optional(), + name: z.string().max(100).optional(), + name_kana: z.string().max(100).optional(), + name_kanji: z.string().max(100).optional(), + owners_provided: PermissiveBoolean.optional(), + ownership_declaration: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + ownership_exemption_reason: z + .enum([ + "", + "qualified_entity_exceeds_ownership_threshold", + "qualifies_as_financial_institution", + ]) + .optional(), + phone: z.string().max(5000).optional(), + registration_number: z.string().max(5000).optional(), + structure: z + .enum([ + "", + "free_zone_establishment", + "free_zone_llc", + "government_instrumentality", + "governmental_unit", + "incorporated_non_profit", + "incorporated_partnership", + "limited_liability_partnership", + "llc", + "multi_member_llc", + "private_company", + "private_corporation", + "private_partnership", + "public_company", + "public_corporation", + "public_partnership", + "registered_charity", + "single_member_llc", + "sole_establishment", + "sole_proprietorship", + "tax_exempt_government_instrumentality", + "unincorporated_association", + "unincorporated_non_profit", + "unincorporated_partnership", + ]) + .optional(), + tax_id: z.string().max(5000).optional(), + tax_id_registrar: z.string().max(5000).optional(), + vat_id: z.string().max(5000).optional(), + verification: z + .object({ + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + default_currency: z.string().optional(), + documents: z + .object({ + bank_account_ownership_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_license: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_memorandum_of_association: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_ministerial_decree: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_registration_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + company_tax_id_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + proof_of_registration: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + proof_of_ultimate_beneficial_ownership: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + }) + .optional(), + email: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + external_account: z.string().max(5000).optional(), + groups: z + .object({ + payments_pricing: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + individual: z + .object({ + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + dob: z + .union([ + z.object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + email: z.string().optional(), + first_name: z.string().max(100).optional(), + first_name_kana: z.string().max(5000).optional(), + first_name_kanji: z.string().max(5000).optional(), + full_name_aliases: z + .union([z.array(z.string().max(300)), z.enum([""])]) + .optional(), + gender: z.string().optional(), + id_number: z.string().max(5000).optional(), + id_number_secondary: z.string().max(5000).optional(), + last_name: z.string().max(100).optional(), + last_name_kana: z.string().max(5000).optional(), + last_name_kanji: z.string().max(5000).optional(), + maiden_name: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + phone: z.string().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + relationship: z + .object({ + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + percent_ownership: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + title: z.string().max(5000).optional(), + }) + .optional(), + ssn_last_4: z.string().max(5000).optional(), + verification: z + .object({ + additional_document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + settings: z + .object({ + bacs_debit_payments: z + .object({ display_name: z.string().optional() }) + .optional(), + branding: z + .object({ + icon: z.string().max(5000).optional(), + logo: z.string().max(5000).optional(), + primary_color: z.string().max(5000).optional(), + secondary_color: z.string().max(5000).optional(), + }) + .optional(), + card_issuing: z + .object({ + tos_acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + card_payments: z + .object({ + decline_on: z + .object({ + avs_failure: PermissiveBoolean.optional(), + cvc_failure: PermissiveBoolean.optional(), + }) + .optional(), + statement_descriptor_prefix: z.string().max(10).optional(), + statement_descriptor_prefix_kana: z + .union([z.string().max(10), z.enum([""])]) + .optional(), + statement_descriptor_prefix_kanji: z + .union([z.string().max(10), z.enum([""])]) + .optional(), + }) + .optional(), + invoices: z + .object({ + default_account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + hosted_payment_method_save: z + .enum(["always", "never", "offer"]) + .optional(), + }) + .optional(), + payments: z + .object({ + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_kana: z.string().max(22).optional(), + statement_descriptor_kanji: z.string().max(22).optional(), + }) + .optional(), + payouts: z + .object({ + debit_negative_balances: PermissiveBoolean.optional(), + schedule: z + .object({ + delay_days: z + .union([z.enum(["minimum"]), z.coerce.number()]) + .optional(), + interval: z + .enum(["daily", "manual", "monthly", "weekly"]) + .optional(), + monthly_anchor: z.coerce.number().optional(), + weekly_anchor: z + .enum([ + "friday", + "monday", + "saturday", + "sunday", + "thursday", + "tuesday", + "wednesday", + ]) + .optional(), + }) + .optional(), + statement_descriptor: z.string().max(22).optional(), + }) + .optional(), + treasury: z + .object({ + tos_acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + tos_acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + service_agreement: z.string().max(5000).optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional() + + const postAccountsAccountResponseBodyValidator = responseValidationFactory( + [["200", s_account]], + s_error, + ) + + // postAccountsAccount + router.post( + `/v1/accounts/:account`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccount(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postAccountsAccountResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountBankAccountsParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postAccountsAccountBankAccountsRequestBodySchema = z + .object({ + bank_account: z + .union([ + z.object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000), + account_type: z + .enum(["checking", "futsu", "savings", "toza"]) + .optional(), + country: z.string().max(5000), + currency: z.string().optional(), + documents: z + .object({ + bank_account_ownership_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + }) + .optional(), + object: z.enum(["bank_account"]).optional(), + routing_number: z.string().max(5000).optional(), + }), + z.string().max(5000), + ]) + .optional(), + default_for_currency: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + external_account: z.string().max(5000).optional(), + metadata: z.record(z.string()).optional(), + }) + .optional() + + const postAccountsAccountBankAccountsResponseBodyValidator = + responseValidationFactory([["200", s_external_account]], s_error) + + // postAccountsAccountBankAccounts + router.post( + `/v1/accounts/:account/bank_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountBankAccountsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountBankAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountBankAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountBankAccountsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteAccountsAccountBankAccountsIdParamSchema = z.object({ + account: z.string().max(5000), + id: z.string(), + }) + + const deleteAccountsAccountBankAccountsIdRequestBodySchema = z + .object({}) + .optional() + + const deleteAccountsAccountBankAccountsIdResponseBodyValidator = + responseValidationFactory([["200", s_deleted_external_account]], s_error) + + // deleteAccountsAccountBankAccountsId + router.delete( + `/v1/accounts/:account/bank_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteAccountsAccountBankAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteAccountsAccountBankAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteAccountsAccountBankAccountsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteAccountsAccountBankAccountsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountBankAccountsIdParamSchema = z.object({ + account: z.string().max(5000), + id: z.string(), + }) + + const getAccountsAccountBankAccountsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getAccountsAccountBankAccountsIdRequestBodySchema = z + .object({}) + .optional() + + const getAccountsAccountBankAccountsIdResponseBodyValidator = + responseValidationFactory([["200", s_external_account]], s_error) + + // getAccountsAccountBankAccountsId + router.get( + `/v1/accounts/:account/bank_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountBankAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountBankAccountsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountBankAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountBankAccountsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getAccountsAccountBankAccountsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountBankAccountsIdParamSchema = z.object({ + account: z.string().max(5000), + id: z.string(), + }) + + const postAccountsAccountBankAccountsIdRequestBodySchema = z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["", "company", "individual"]).optional(), + account_type: z.enum(["checking", "futsu", "savings", "toza"]).optional(), + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + default_for_currency: PermissiveBoolean.optional(), + documents: z + .object({ + bank_account_ownership_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + }) + .optional(), + exp_month: z.string().max(5000).optional(), + exp_year: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(5000).optional(), + }) + .optional() + + const postAccountsAccountBankAccountsIdResponseBodyValidator = + responseValidationFactory([["200", s_external_account]], s_error) + + // postAccountsAccountBankAccountsId + router.post( + `/v1/accounts/:account/bank_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountBankAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountBankAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountBankAccountsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountBankAccountsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountCapabilitiesParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getAccountsAccountCapabilitiesQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getAccountsAccountCapabilitiesRequestBodySchema = z + .object({}) + .optional() + + const getAccountsAccountCapabilitiesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_capability)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getAccountsAccountCapabilities + router.get( + `/v1/accounts/:account/capabilities`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountCapabilitiesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountCapabilitiesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountCapabilitiesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_capability[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountCapabilities(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getAccountsAccountCapabilitiesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountCapabilitiesCapabilityParamSchema = z.object({ + account: z.string().max(5000), + capability: z.string(), + }) + + const getAccountsAccountCapabilitiesCapabilityQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getAccountsAccountCapabilitiesCapabilityRequestBodySchema = z + .object({}) + .optional() + + const getAccountsAccountCapabilitiesCapabilityResponseBodyValidator = + responseValidationFactory([["200", s_capability]], s_error) + + // getAccountsAccountCapabilitiesCapability + router.get( + `/v1/accounts/:account/capabilities/:capability`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountCapabilitiesCapabilityParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountCapabilitiesCapabilityQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountCapabilitiesCapabilityRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountCapabilitiesCapability( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getAccountsAccountCapabilitiesCapabilityResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountCapabilitiesCapabilityParamSchema = z.object({ + account: z.string().max(5000), + capability: z.string(), + }) + + const postAccountsAccountCapabilitiesCapabilityRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + requested: PermissiveBoolean.optional(), + }) + .optional() + + const postAccountsAccountCapabilitiesCapabilityResponseBodyValidator = + responseValidationFactory([["200", s_capability]], s_error) + + // postAccountsAccountCapabilitiesCapability + router.post( + `/v1/accounts/:account/capabilities/:capability`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountCapabilitiesCapabilityParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountCapabilitiesCapabilityRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountCapabilitiesCapability( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountCapabilitiesCapabilityResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountExternalAccountsParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getAccountsAccountExternalAccountsQuerySchema = z.object({ + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + object: z.enum(["bank_account", "card"]).optional(), + starting_after: z.string().optional(), + }) + + const getAccountsAccountExternalAccountsRequestBodySchema = z + .object({}) + .optional() + + const getAccountsAccountExternalAccountsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array( + z.union([z.lazy(() => s_bank_account), z.lazy(() => s_card)]), + ), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getAccountsAccountExternalAccounts + router.get( + `/v1/accounts/:account/external_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountExternalAccountsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountExternalAccountsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountExternalAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: (t_bank_account | t_card)[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountExternalAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getAccountsAccountExternalAccountsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountExternalAccountsParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postAccountsAccountExternalAccountsRequestBodySchema = z + .object({ + bank_account: z + .union([ + z.object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000), + account_type: z + .enum(["checking", "futsu", "savings", "toza"]) + .optional(), + country: z.string().max(5000), + currency: z.string().optional(), + documents: z + .object({ + bank_account_ownership_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + }) + .optional(), + object: z.enum(["bank_account"]).optional(), + routing_number: z.string().max(5000).optional(), + }), + z.string().max(5000), + ]) + .optional(), + default_for_currency: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + external_account: z.string().max(5000).optional(), + metadata: z.record(z.string()).optional(), + }) + .optional() + + const postAccountsAccountExternalAccountsResponseBodyValidator = + responseValidationFactory([["200", s_external_account]], s_error) + + // postAccountsAccountExternalAccounts + router.post( + `/v1/accounts/:account/external_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountExternalAccountsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountExternalAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountExternalAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountExternalAccountsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteAccountsAccountExternalAccountsIdParamSchema = z.object({ + account: z.string().max(5000), + id: z.string(), + }) + + const deleteAccountsAccountExternalAccountsIdRequestBodySchema = z + .object({}) + .optional() + + const deleteAccountsAccountExternalAccountsIdResponseBodyValidator = + responseValidationFactory([["200", s_deleted_external_account]], s_error) + + // deleteAccountsAccountExternalAccountsId + router.delete( + `/v1/accounts/:account/external_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteAccountsAccountExternalAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteAccountsAccountExternalAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteAccountsAccountExternalAccountsId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteAccountsAccountExternalAccountsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountExternalAccountsIdParamSchema = z.object({ + account: z.string().max(5000), + id: z.string(), + }) + + const getAccountsAccountExternalAccountsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getAccountsAccountExternalAccountsIdRequestBodySchema = z + .object({}) + .optional() + + const getAccountsAccountExternalAccountsIdResponseBodyValidator = + responseValidationFactory([["200", s_external_account]], s_error) + + // getAccountsAccountExternalAccountsId + router.get( + `/v1/accounts/:account/external_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountExternalAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountExternalAccountsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountExternalAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountExternalAccountsId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getAccountsAccountExternalAccountsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountExternalAccountsIdParamSchema = z.object({ + account: z.string().max(5000), + id: z.string(), + }) + + const postAccountsAccountExternalAccountsIdRequestBodySchema = z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["", "company", "individual"]).optional(), + account_type: z.enum(["checking", "futsu", "savings", "toza"]).optional(), + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + default_for_currency: PermissiveBoolean.optional(), + documents: z + .object({ + bank_account_ownership_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + }) + .optional(), + exp_month: z.string().max(5000).optional(), + exp_year: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(5000).optional(), + }) + .optional() + + const postAccountsAccountExternalAccountsIdResponseBodyValidator = + responseValidationFactory([["200", s_external_account]], s_error) + + // postAccountsAccountExternalAccountsId + router.post( + `/v1/accounts/:account/external_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountExternalAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountExternalAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountExternalAccountsId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountExternalAccountsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountLoginLinksParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postAccountsAccountLoginLinksRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postAccountsAccountLoginLinksResponseBodyValidator = + responseValidationFactory([["200", s_login_link]], s_error) + + // postAccountsAccountLoginLinks + router.post( + `/v1/accounts/:account/login_links`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountLoginLinksParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountLoginLinksRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountLoginLinks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountLoginLinksResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountPeopleParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getAccountsAccountPeopleQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + relationship: z + .object({ + authorizer: PermissiveBoolean.optional(), + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + legal_guardian: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + representative: PermissiveBoolean.optional(), + }) + .optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getAccountsAccountPeopleRequestBodySchema = z.object({}).optional() + + const getAccountsAccountPeopleResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_person)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getAccountsAccountPeople + router.get( + `/v1/accounts/:account/people`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountPeopleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountPeopleQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountPeopleRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_person[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountPeople(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getAccountsAccountPeopleResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountPeopleParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postAccountsAccountPeopleRequestBodySchema = z + .object({ + additional_tos_acceptances: z + .object({ + account: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + dob: z + .union([ + z.object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + documents: z + .object({ + company_authorization: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + passport: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + visa: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + }) + .optional(), + email: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + first_name: z.string().max(5000).optional(), + first_name_kana: z.string().max(5000).optional(), + first_name_kanji: z.string().max(5000).optional(), + full_name_aliases: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + gender: z.string().optional(), + id_number: z.string().max(5000).optional(), + id_number_secondary: z.string().max(5000).optional(), + last_name: z.string().max(5000).optional(), + last_name_kana: z.string().max(5000).optional(), + last_name_kanji: z.string().max(5000).optional(), + maiden_name: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + nationality: z.string().max(5000).optional(), + person_token: z.string().max(5000).optional(), + phone: z.string().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + relationship: z + .object({ + authorizer: PermissiveBoolean.optional(), + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + legal_guardian: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + percent_ownership: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + representative: PermissiveBoolean.optional(), + title: z.string().max(5000).optional(), + }) + .optional(), + ssn_last_4: z.string().optional(), + verification: z + .object({ + additional_document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional() + + const postAccountsAccountPeopleResponseBodyValidator = + responseValidationFactory([["200", s_person]], s_error) + + // postAccountsAccountPeople + router.post( + `/v1/accounts/:account/people`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountPeopleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountPeopleRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountPeople(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postAccountsAccountPeopleResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteAccountsAccountPeoplePersonParamSchema = z.object({ + account: z.string().max(5000), + person: z.string().max(5000), + }) + + const deleteAccountsAccountPeoplePersonRequestBodySchema = z + .object({}) + .optional() + + const deleteAccountsAccountPeoplePersonResponseBodyValidator = + responseValidationFactory([["200", s_deleted_person]], s_error) + + // deleteAccountsAccountPeoplePerson + router.delete( + `/v1/accounts/:account/people/:person`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteAccountsAccountPeoplePersonParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteAccountsAccountPeoplePersonRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteAccountsAccountPeoplePerson(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteAccountsAccountPeoplePersonResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountPeoplePersonParamSchema = z.object({ + account: z.string().max(5000), + person: z.string().max(5000), + }) + + const getAccountsAccountPeoplePersonQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getAccountsAccountPeoplePersonRequestBodySchema = z + .object({}) + .optional() + + const getAccountsAccountPeoplePersonResponseBodyValidator = + responseValidationFactory([["200", s_person]], s_error) + + // getAccountsAccountPeoplePerson + router.get( + `/v1/accounts/:account/people/:person`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountPeoplePersonParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountPeoplePersonQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountPeoplePersonRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountPeoplePerson(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getAccountsAccountPeoplePersonResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountPeoplePersonParamSchema = z.object({ + account: z.string().max(5000), + person: z.string().max(5000), + }) + + const postAccountsAccountPeoplePersonRequestBodySchema = z + .object({ + additional_tos_acceptances: z + .object({ + account: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + dob: z + .union([ + z.object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + documents: z + .object({ + company_authorization: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + passport: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + visa: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + }) + .optional(), + email: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + first_name: z.string().max(5000).optional(), + first_name_kana: z.string().max(5000).optional(), + first_name_kanji: z.string().max(5000).optional(), + full_name_aliases: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + gender: z.string().optional(), + id_number: z.string().max(5000).optional(), + id_number_secondary: z.string().max(5000).optional(), + last_name: z.string().max(5000).optional(), + last_name_kana: z.string().max(5000).optional(), + last_name_kanji: z.string().max(5000).optional(), + maiden_name: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + nationality: z.string().max(5000).optional(), + person_token: z.string().max(5000).optional(), + phone: z.string().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + relationship: z + .object({ + authorizer: PermissiveBoolean.optional(), + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + legal_guardian: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + percent_ownership: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + representative: PermissiveBoolean.optional(), + title: z.string().max(5000).optional(), + }) + .optional(), + ssn_last_4: z.string().optional(), + verification: z + .object({ + additional_document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional() + + const postAccountsAccountPeoplePersonResponseBodyValidator = + responseValidationFactory([["200", s_person]], s_error) + + // postAccountsAccountPeoplePerson + router.post( + `/v1/accounts/:account/people/:person`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountPeoplePersonParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountPeoplePersonRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountPeoplePerson(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountPeoplePersonResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountPersonsParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getAccountsAccountPersonsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + relationship: z + .object({ + authorizer: PermissiveBoolean.optional(), + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + legal_guardian: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + representative: PermissiveBoolean.optional(), + }) + .optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getAccountsAccountPersonsRequestBodySchema = z.object({}).optional() + + const getAccountsAccountPersonsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_person)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getAccountsAccountPersons + router.get( + `/v1/accounts/:account/persons`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountPersonsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountPersonsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountPersonsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_person[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountPersons(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getAccountsAccountPersonsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountPersonsParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postAccountsAccountPersonsRequestBodySchema = z + .object({ + additional_tos_acceptances: z + .object({ + account: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + dob: z + .union([ + z.object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + documents: z + .object({ + company_authorization: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + passport: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + visa: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + }) + .optional(), + email: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + first_name: z.string().max(5000).optional(), + first_name_kana: z.string().max(5000).optional(), + first_name_kanji: z.string().max(5000).optional(), + full_name_aliases: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + gender: z.string().optional(), + id_number: z.string().max(5000).optional(), + id_number_secondary: z.string().max(5000).optional(), + last_name: z.string().max(5000).optional(), + last_name_kana: z.string().max(5000).optional(), + last_name_kanji: z.string().max(5000).optional(), + maiden_name: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + nationality: z.string().max(5000).optional(), + person_token: z.string().max(5000).optional(), + phone: z.string().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + relationship: z + .object({ + authorizer: PermissiveBoolean.optional(), + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + legal_guardian: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + percent_ownership: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + representative: PermissiveBoolean.optional(), + title: z.string().max(5000).optional(), + }) + .optional(), + ssn_last_4: z.string().optional(), + verification: z + .object({ + additional_document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional() + + const postAccountsAccountPersonsResponseBodyValidator = + responseValidationFactory([["200", s_person]], s_error) + + // postAccountsAccountPersons + router.post( + `/v1/accounts/:account/persons`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountPersonsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountPersonsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountPersons(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountPersonsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteAccountsAccountPersonsPersonParamSchema = z.object({ + account: z.string().max(5000), + person: z.string().max(5000), + }) + + const deleteAccountsAccountPersonsPersonRequestBodySchema = z + .object({}) + .optional() + + const deleteAccountsAccountPersonsPersonResponseBodyValidator = + responseValidationFactory([["200", s_deleted_person]], s_error) + + // deleteAccountsAccountPersonsPerson + router.delete( + `/v1/accounts/:account/persons/:person`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteAccountsAccountPersonsPersonParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteAccountsAccountPersonsPersonRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteAccountsAccountPersonsPerson(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteAccountsAccountPersonsPersonResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAccountsAccountPersonsPersonParamSchema = z.object({ + account: z.string().max(5000), + person: z.string().max(5000), + }) + + const getAccountsAccountPersonsPersonQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getAccountsAccountPersonsPersonRequestBodySchema = z + .object({}) + .optional() + + const getAccountsAccountPersonsPersonResponseBodyValidator = + responseValidationFactory([["200", s_person]], s_error) + + // getAccountsAccountPersonsPerson + router.get( + `/v1/accounts/:account/persons/:person`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getAccountsAccountPersonsPersonParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getAccountsAccountPersonsPersonQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAccountsAccountPersonsPersonRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAccountsAccountPersonsPerson(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getAccountsAccountPersonsPersonResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountPersonsPersonParamSchema = z.object({ + account: z.string().max(5000), + person: z.string().max(5000), + }) + + const postAccountsAccountPersonsPersonRequestBodySchema = z + .object({ + additional_tos_acceptances: z + .object({ + account: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + dob: z + .union([ + z.object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + documents: z + .object({ + company_authorization: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + passport: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + visa: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + }) + .optional(), + email: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + first_name: z.string().max(5000).optional(), + first_name_kana: z.string().max(5000).optional(), + first_name_kanji: z.string().max(5000).optional(), + full_name_aliases: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + gender: z.string().optional(), + id_number: z.string().max(5000).optional(), + id_number_secondary: z.string().max(5000).optional(), + last_name: z.string().max(5000).optional(), + last_name_kana: z.string().max(5000).optional(), + last_name_kanji: z.string().max(5000).optional(), + maiden_name: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + nationality: z.string().max(5000).optional(), + person_token: z.string().max(5000).optional(), + phone: z.string().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + relationship: z + .object({ + authorizer: PermissiveBoolean.optional(), + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + legal_guardian: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + percent_ownership: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + representative: PermissiveBoolean.optional(), + title: z.string().max(5000).optional(), + }) + .optional(), + ssn_last_4: z.string().optional(), + verification: z + .object({ + additional_document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional() + + const postAccountsAccountPersonsPersonResponseBodyValidator = + responseValidationFactory([["200", s_person]], s_error) + + // postAccountsAccountPersonsPerson + router.post( + `/v1/accounts/:account/persons/:person`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountPersonsPersonParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountPersonsPersonRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountPersonsPerson(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postAccountsAccountPersonsPersonResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAccountsAccountRejectParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postAccountsAccountRejectRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + reason: z.string().max(5000), + }) + + const postAccountsAccountRejectResponseBodyValidator = + responseValidationFactory([["200", s_account]], s_error) + + // postAccountsAccountReject + router.post( + `/v1/accounts/:account/reject`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postAccountsAccountRejectParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postAccountsAccountRejectRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAccountsAccountReject(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postAccountsAccountRejectResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getApplePayDomainsQuerySchema = z.object({ + domain_name: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getApplePayDomainsRequestBodySchema = z.object({}).optional() + + const getApplePayDomainsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_apple_pay_domain), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/apple_pay/domains")), + }), + ], + ], + s_error, + ) + + // getApplePayDomains + router.get( + `/v1/apple_pay/domains`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getApplePayDomainsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getApplePayDomainsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_apple_pay_domain[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getApplePayDomains(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getApplePayDomainsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postApplePayDomainsRequestBodySchema = z.object({ + domain_name: z.string(), + expand: z.array(z.string().max(5000)).optional(), + }) + + const postApplePayDomainsResponseBodyValidator = responseValidationFactory( + [["200", s_apple_pay_domain]], + s_error, + ) + + // postApplePayDomains + router.post( + `/v1/apple_pay/domains`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postApplePayDomainsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postApplePayDomains(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postApplePayDomainsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteApplePayDomainsDomainParamSchema = z.object({ + domain: z.string().max(5000), + }) + + const deleteApplePayDomainsDomainRequestBodySchema = z.object({}).optional() + + const deleteApplePayDomainsDomainResponseBodyValidator = + responseValidationFactory([["200", s_deleted_apple_pay_domain]], s_error) + + // deleteApplePayDomainsDomain + router.delete( + `/v1/apple_pay/domains/:domain`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteApplePayDomainsDomainParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteApplePayDomainsDomainRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteApplePayDomainsDomain(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteApplePayDomainsDomainResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getApplePayDomainsDomainParamSchema = z.object({ + domain: z.string().max(5000), + }) + + const getApplePayDomainsDomainQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getApplePayDomainsDomainRequestBodySchema = z.object({}).optional() + + const getApplePayDomainsDomainResponseBodyValidator = + responseValidationFactory([["200", s_apple_pay_domain]], s_error) + + // getApplePayDomainsDomain + router.get( + `/v1/apple_pay/domains/:domain`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getApplePayDomainsDomainParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getApplePayDomainsDomainQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getApplePayDomainsDomainRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getApplePayDomainsDomain(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getApplePayDomainsDomainResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getApplicationFeesQuerySchema = z.object({ + charge: z.string().max(5000).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getApplicationFeesRequestBodySchema = z.object({}).optional() + + const getApplicationFeesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_application_fee)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/application_fees")), + }), + ], + ], + s_error, + ) + + // getApplicationFees + router.get( + `/v1/application_fees`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getApplicationFeesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getApplicationFeesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_application_fee[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getApplicationFees(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getApplicationFeesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getApplicationFeesFeeRefundsIdParamSchema = z.object({ + fee: z.string().max(5000), + id: z.string().max(5000), + }) + + const getApplicationFeesFeeRefundsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getApplicationFeesFeeRefundsIdRequestBodySchema = z + .object({}) + .optional() + + const getApplicationFeesFeeRefundsIdResponseBodyValidator = + responseValidationFactory([["200", s_fee_refund]], s_error) + + // getApplicationFeesFeeRefundsId + router.get( + `/v1/application_fees/:fee/refunds/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getApplicationFeesFeeRefundsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getApplicationFeesFeeRefundsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getApplicationFeesFeeRefundsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getApplicationFeesFeeRefundsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getApplicationFeesFeeRefundsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postApplicationFeesFeeRefundsIdParamSchema = z.object({ + fee: z.string().max(5000), + id: z.string().max(5000), + }) + + const postApplicationFeesFeeRefundsIdRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postApplicationFeesFeeRefundsIdResponseBodyValidator = + responseValidationFactory([["200", s_fee_refund]], s_error) + + // postApplicationFeesFeeRefundsId + router.post( + `/v1/application_fees/:fee/refunds/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postApplicationFeesFeeRefundsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postApplicationFeesFeeRefundsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postApplicationFeesFeeRefundsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postApplicationFeesFeeRefundsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getApplicationFeesIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getApplicationFeesIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getApplicationFeesIdRequestBodySchema = z.object({}).optional() + + const getApplicationFeesIdResponseBodyValidator = responseValidationFactory( + [["200", s_application_fee]], + s_error, + ) + + // getApplicationFeesId + router.get( + `/v1/application_fees/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getApplicationFeesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getApplicationFeesIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getApplicationFeesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getApplicationFeesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getApplicationFeesIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postApplicationFeesIdRefundParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postApplicationFeesIdRefundRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + directive: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postApplicationFeesIdRefundResponseBodyValidator = + responseValidationFactory([["200", s_application_fee]], s_error) + + // postApplicationFeesIdRefund + router.post( + `/v1/application_fees/:id/refund`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postApplicationFeesIdRefundParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postApplicationFeesIdRefundRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postApplicationFeesIdRefund(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postApplicationFeesIdRefundResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getApplicationFeesIdRefundsParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getApplicationFeesIdRefundsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getApplicationFeesIdRefundsRequestBodySchema = z.object({}).optional() + + const getApplicationFeesIdRefundsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_fee_refund)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getApplicationFeesIdRefunds + router.get( + `/v1/application_fees/:id/refunds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getApplicationFeesIdRefundsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getApplicationFeesIdRefundsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getApplicationFeesIdRefundsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_fee_refund[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getApplicationFeesIdRefunds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getApplicationFeesIdRefundsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postApplicationFeesIdRefundsParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postApplicationFeesIdRefundsRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + }) + .optional() + + const postApplicationFeesIdRefundsResponseBodyValidator = + responseValidationFactory([["200", s_fee_refund]], s_error) + + // postApplicationFeesIdRefunds + router.post( + `/v1/application_fees/:id/refunds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postApplicationFeesIdRefundsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postApplicationFeesIdRefundsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postApplicationFeesIdRefunds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postApplicationFeesIdRefundsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAppsSecretsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + scope: z.object({ + type: z.enum(["account", "user"]), + user: z.string().max(5000).optional(), + }), + starting_after: z.string().max(5000).optional(), + }) + + const getAppsSecretsRequestBodySchema = z.object({}).optional() + + const getAppsSecretsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_apps_secret), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/apps/secrets")), + }), + ], + ], + s_error, + ) + + // getAppsSecrets + router.get( + `/v1/apps/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getAppsSecretsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAppsSecretsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_apps_secret[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAppsSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getAppsSecretsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAppsSecretsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + name: z.string().max(5000), + payload: z.string().max(5000), + scope: z.object({ + type: z.enum(["account", "user"]), + user: z.string().max(5000).optional(), + }), + }) + + const postAppsSecretsResponseBodyValidator = responseValidationFactory( + [["200", s_apps_secret]], + s_error, + ) + + // postAppsSecrets + router.post( + `/v1/apps/secrets`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postAppsSecretsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAppsSecrets(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postAppsSecretsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postAppsSecretsDeleteRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + name: z.string().max(5000), + scope: z.object({ + type: z.enum(["account", "user"]), + user: z.string().max(5000).optional(), + }), + }) + + const postAppsSecretsDeleteResponseBodyValidator = responseValidationFactory( + [["200", s_apps_secret]], + s_error, + ) + + // postAppsSecretsDelete + router.post( + `/v1/apps/secrets/delete`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postAppsSecretsDeleteRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postAppsSecretsDelete(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postAppsSecretsDeleteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getAppsSecretsFindQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + name: z.string().max(5000), + scope: z.object({ + type: z.enum(["account", "user"]), + user: z.string().max(5000).optional(), + }), + }) + + const getAppsSecretsFindRequestBodySchema = z.object({}).optional() + + const getAppsSecretsFindResponseBodyValidator = responseValidationFactory( + [["200", s_apps_secret]], + s_error, + ) + + // getAppsSecretsFind + router.get( + `/v1/apps/secrets/find`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getAppsSecretsFindQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getAppsSecretsFindRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getAppsSecretsFind(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getAppsSecretsFindResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBalanceQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getBalanceRequestBodySchema = z.object({}).optional() + + const getBalanceResponseBodyValidator = responseValidationFactory( + [["200", s_balance]], + s_error, + ) + + // getBalance + router.get( + `/v1/balance`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBalanceQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBalanceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBalance(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBalanceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBalanceHistoryQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + currency: z.string().optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + payout: z.string().max(5000).optional(), + source: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + type: z.string().max(5000).optional(), + }) + + const getBalanceHistoryRequestBodySchema = z.object({}).optional() + + const getBalanceHistoryResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_balance_transaction)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/balance_transactions")), + }), + ], + ], + s_error, + ) + + // getBalanceHistory + router.get( + `/v1/balance/history`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBalanceHistoryQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBalanceHistoryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_balance_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBalanceHistory(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBalanceHistoryResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBalanceHistoryIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getBalanceHistoryIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getBalanceHistoryIdRequestBodySchema = z.object({}).optional() + + const getBalanceHistoryIdResponseBodyValidator = responseValidationFactory( + [["200", s_balance_transaction]], + s_error, + ) + + // getBalanceHistoryId + router.get( + `/v1/balance/history/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getBalanceHistoryIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getBalanceHistoryIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBalanceHistoryIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBalanceHistoryId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBalanceHistoryIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBalanceTransactionsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + currency: z.string().optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + payout: z.string().max(5000).optional(), + source: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + type: z.string().max(5000).optional(), + }) + + const getBalanceTransactionsRequestBodySchema = z.object({}).optional() + + const getBalanceTransactionsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_balance_transaction)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/balance_transactions")), + }), + ], + ], + s_error, + ) + + // getBalanceTransactions + router.get( + `/v1/balance_transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBalanceTransactionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBalanceTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_balance_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBalanceTransactions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBalanceTransactionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBalanceTransactionsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getBalanceTransactionsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getBalanceTransactionsIdRequestBodySchema = z.object({}).optional() + + const getBalanceTransactionsIdResponseBodyValidator = + responseValidationFactory([["200", s_balance_transaction]], s_error) + + // getBalanceTransactionsId + router.get( + `/v1/balance_transactions/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getBalanceTransactionsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getBalanceTransactionsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBalanceTransactionsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBalanceTransactionsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBalanceTransactionsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingAlertsQuerySchema = z.object({ + alert_type: z.enum(["usage_threshold"]).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + meter: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getBillingAlertsRequestBodySchema = z.object({}).optional() + + const getBillingAlertsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_billing_alert)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/billing/alerts")), + }), + ], + ], + s_error, + ) + + // getBillingAlerts + router.get( + `/v1/billing/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBillingAlertsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingAlertsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_billing_alert[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingAlerts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBillingAlertsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingAlertsRequestBodySchema = z.object({ + alert_type: z.enum(["usage_threshold"]), + expand: z.array(z.string().max(5000)).optional(), + title: z.string().max(256), + usage_threshold: z + .object({ + filters: z + .array( + z.object({ + customer: z.string().max(5000).optional(), + type: z.enum(["customer"]), + }), + ) + .optional(), + gte: z.coerce.number(), + meter: z.string().max(5000).optional(), + recurrence: z.enum(["one_time"]), + }) + .optional(), + }) + + const postBillingAlertsResponseBodyValidator = responseValidationFactory( + [["200", s_billing_alert]], + s_error, + ) + + // postBillingAlerts + router.post( + `/v1/billing/alerts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postBillingAlertsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingAlerts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postBillingAlertsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingAlertsIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getBillingAlertsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getBillingAlertsIdRequestBodySchema = z.object({}).optional() + + const getBillingAlertsIdResponseBodyValidator = responseValidationFactory( + [["200", s_billing_alert]], + s_error, + ) + + // getBillingAlertsId + router.get( + `/v1/billing/alerts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getBillingAlertsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getBillingAlertsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingAlertsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingAlertsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBillingAlertsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingAlertsIdActivateParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postBillingAlertsIdActivateRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postBillingAlertsIdActivateResponseBodyValidator = + responseValidationFactory([["200", s_billing_alert]], s_error) + + // postBillingAlertsIdActivate + router.post( + `/v1/billing/alerts/:id/activate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingAlertsIdActivateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingAlertsIdActivateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingAlertsIdActivate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingAlertsIdActivateResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingAlertsIdArchiveParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postBillingAlertsIdArchiveRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postBillingAlertsIdArchiveResponseBodyValidator = + responseValidationFactory([["200", s_billing_alert]], s_error) + + // postBillingAlertsIdArchive + router.post( + `/v1/billing/alerts/:id/archive`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingAlertsIdArchiveParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingAlertsIdArchiveRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingAlertsIdArchive(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingAlertsIdArchiveResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingAlertsIdDeactivateParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postBillingAlertsIdDeactivateRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postBillingAlertsIdDeactivateResponseBodyValidator = + responseValidationFactory([["200", s_billing_alert]], s_error) + + // postBillingAlertsIdDeactivate + router.post( + `/v1/billing/alerts/:id/deactivate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingAlertsIdDeactivateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingAlertsIdDeactivateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingAlertsIdDeactivate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingAlertsIdDeactivateResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingCreditBalanceSummaryQuerySchema = z.object({ + customer: z.string().max(5000), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + filter: z.object({ + applicability_scope: z + .object({ + price_type: z.enum(["metered"]).optional(), + prices: z.array(z.object({ id: z.string().max(5000) })).optional(), + }) + .optional(), + credit_grant: z.string().max(5000).optional(), + type: z.enum(["applicability_scope", "credit_grant"]), + }), + }) + + const getBillingCreditBalanceSummaryRequestBodySchema = z + .object({}) + .optional() + + const getBillingCreditBalanceSummaryResponseBodyValidator = + responseValidationFactory( + [["200", s_billing_credit_balance_summary]], + s_error, + ) + + // getBillingCreditBalanceSummary + router.get( + `/v1/billing/credit_balance_summary`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBillingCreditBalanceSummaryQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingCreditBalanceSummaryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingCreditBalanceSummary(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getBillingCreditBalanceSummaryResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingCreditBalanceTransactionsQuerySchema = z.object({ + credit_grant: z.string().max(5000).optional(), + customer: z.string().max(5000), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getBillingCreditBalanceTransactionsRequestBodySchema = z + .object({}) + .optional() + + const getBillingCreditBalanceTransactionsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_billing_credit_balance_transaction)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/billing/credit_grants")), + }), + ], + ], + s_error, + ) + + // getBillingCreditBalanceTransactions + router.get( + `/v1/billing/credit_balance_transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBillingCreditBalanceTransactionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingCreditBalanceTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_billing_credit_balance_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingCreditBalanceTransactions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getBillingCreditBalanceTransactionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingCreditBalanceTransactionsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getBillingCreditBalanceTransactionsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getBillingCreditBalanceTransactionsIdRequestBodySchema = z + .object({}) + .optional() + + const getBillingCreditBalanceTransactionsIdResponseBodyValidator = + responseValidationFactory( + [["200", s_billing_credit_balance_transaction]], + s_error, + ) + + // getBillingCreditBalanceTransactionsId + router.get( + `/v1/billing/credit_balance_transactions/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getBillingCreditBalanceTransactionsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getBillingCreditBalanceTransactionsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingCreditBalanceTransactionsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingCreditBalanceTransactionsId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getBillingCreditBalanceTransactionsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingCreditGrantsQuerySchema = z.object({ + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getBillingCreditGrantsRequestBodySchema = z.object({}).optional() + + const getBillingCreditGrantsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_billing_credit_grant)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/billing/credit_grants")), + }), + ], + ], + s_error, + ) + + // getBillingCreditGrants + router.get( + `/v1/billing/credit_grants`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBillingCreditGrantsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingCreditGrantsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_billing_credit_grant[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingCreditGrants(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBillingCreditGrantsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingCreditGrantsRequestBodySchema = z.object({ + amount: z.object({ + monetary: z + .object({ currency: z.string(), value: z.coerce.number() }) + .optional(), + type: z.enum(["monetary"]), + }), + applicability_config: z.object({ + scope: z.object({ + price_type: z.enum(["metered"]).optional(), + prices: z.array(z.object({ id: z.string().max(5000) })).optional(), + }), + }), + category: z.enum(["paid", "promotional"]), + customer: z.string().max(5000), + effective_at: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(100).optional(), + priority: z.coerce.number().optional(), + }) + + const postBillingCreditGrantsResponseBodyValidator = + responseValidationFactory([["200", s_billing_credit_grant]], s_error) + + // postBillingCreditGrants + router.post( + `/v1/billing/credit_grants`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postBillingCreditGrantsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingCreditGrants(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postBillingCreditGrantsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingCreditGrantsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getBillingCreditGrantsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getBillingCreditGrantsIdRequestBodySchema = z.object({}).optional() + + const getBillingCreditGrantsIdResponseBodyValidator = + responseValidationFactory([["200", s_billing_credit_grant]], s_error) + + // getBillingCreditGrantsId + router.get( + `/v1/billing/credit_grants/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getBillingCreditGrantsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getBillingCreditGrantsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingCreditGrantsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingCreditGrantsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBillingCreditGrantsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingCreditGrantsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postBillingCreditGrantsIdRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.union([z.coerce.number(), z.enum([""])]).optional(), + metadata: z.record(z.string()).optional(), + }) + .optional() + + const postBillingCreditGrantsIdResponseBodyValidator = + responseValidationFactory([["200", s_billing_credit_grant]], s_error) + + // postBillingCreditGrantsId + router.post( + `/v1/billing/credit_grants/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingCreditGrantsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingCreditGrantsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingCreditGrantsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postBillingCreditGrantsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingCreditGrantsIdExpireParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postBillingCreditGrantsIdExpireRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postBillingCreditGrantsIdExpireResponseBodyValidator = + responseValidationFactory([["200", s_billing_credit_grant]], s_error) + + // postBillingCreditGrantsIdExpire + router.post( + `/v1/billing/credit_grants/:id/expire`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingCreditGrantsIdExpireParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingCreditGrantsIdExpireRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingCreditGrantsIdExpire(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingCreditGrantsIdExpireResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingCreditGrantsIdVoidParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postBillingCreditGrantsIdVoidRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postBillingCreditGrantsIdVoidResponseBodyValidator = + responseValidationFactory([["200", s_billing_credit_grant]], s_error) + + // postBillingCreditGrantsIdVoid + router.post( + `/v1/billing/credit_grants/:id/void`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingCreditGrantsIdVoidParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingCreditGrantsIdVoidRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingCreditGrantsIdVoid(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingCreditGrantsIdVoidResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingMeterEventAdjustmentsRequestBodySchema = z.object({ + cancel: z.object({ identifier: z.string().max(100).optional() }).optional(), + event_name: z.string().max(100), + expand: z.array(z.string().max(5000)).optional(), + type: z.enum(["cancel"]), + }) + + const postBillingMeterEventAdjustmentsResponseBodyValidator = + responseValidationFactory( + [["200", s_billing_meter_event_adjustment]], + s_error, + ) + + // postBillingMeterEventAdjustments + router.post( + `/v1/billing/meter_event_adjustments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postBillingMeterEventAdjustmentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingMeterEventAdjustments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingMeterEventAdjustmentsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingMeterEventsRequestBodySchema = z.object({ + event_name: z.string().max(100), + expand: z.array(z.string().max(5000)).optional(), + identifier: z.string().max(100).optional(), + payload: z.record(z.string()), + timestamp: z.coerce.number().optional(), + }) + + const postBillingMeterEventsResponseBodyValidator = responseValidationFactory( + [["200", s_billing_meter_event]], + s_error, + ) + + // postBillingMeterEvents + router.post( + `/v1/billing/meter_events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postBillingMeterEventsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingMeterEvents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postBillingMeterEventsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingMetersQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["active", "inactive"]).optional(), + }) + + const getBillingMetersRequestBodySchema = z.object({}).optional() + + const getBillingMetersResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_billing_meter), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/billing/meters")), + }), + ], + ], + s_error, + ) + + // getBillingMeters + router.get( + `/v1/billing/meters`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBillingMetersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingMetersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_billing_meter[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingMeters(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBillingMetersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingMetersRequestBodySchema = z.object({ + customer_mapping: z + .object({ + event_payload_key: z.string().max(100), + type: z.enum(["by_id"]), + }) + .optional(), + default_aggregation: z.object({ + formula: z.enum(["count", "last", "sum"]), + }), + display_name: z.string().max(250), + event_name: z.string().max(100), + event_time_window: z.enum(["day", "hour"]).optional(), + expand: z.array(z.string().max(5000)).optional(), + value_settings: z + .object({ event_payload_key: z.string().max(100) }) + .optional(), + }) + + const postBillingMetersResponseBodyValidator = responseValidationFactory( + [["200", s_billing_meter]], + s_error, + ) + + // postBillingMeters + router.post( + `/v1/billing/meters`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postBillingMetersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingMeters(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postBillingMetersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingMetersIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getBillingMetersIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getBillingMetersIdRequestBodySchema = z.object({}).optional() + + const getBillingMetersIdResponseBodyValidator = responseValidationFactory( + [["200", s_billing_meter]], + s_error, + ) + + // getBillingMetersId + router.get( + `/v1/billing/meters/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getBillingMetersIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getBillingMetersIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingMetersIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingMetersId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getBillingMetersIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingMetersIdParamSchema = z.object({ id: z.string().max(5000) }) + + const postBillingMetersIdRequestBodySchema = z + .object({ + display_name: z.string().max(250).optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postBillingMetersIdResponseBodyValidator = responseValidationFactory( + [["200", s_billing_meter]], + s_error, + ) + + // postBillingMetersId + router.post( + `/v1/billing/meters/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingMetersIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingMetersIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingMetersId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postBillingMetersIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingMetersIdDeactivateParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postBillingMetersIdDeactivateRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postBillingMetersIdDeactivateResponseBodyValidator = + responseValidationFactory([["200", s_billing_meter]], s_error) + + // postBillingMetersIdDeactivate + router.post( + `/v1/billing/meters/:id/deactivate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingMetersIdDeactivateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingMetersIdDeactivateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingMetersIdDeactivate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingMetersIdDeactivateResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingMetersIdEventSummariesParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getBillingMetersIdEventSummariesQuerySchema = z.object({ + customer: z.string().max(5000), + end_time: z.coerce.number(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + start_time: z.coerce.number(), + starting_after: z.string().max(5000).optional(), + value_grouping_window: z.enum(["day", "hour"]).optional(), + }) + + const getBillingMetersIdEventSummariesRequestBodySchema = z + .object({}) + .optional() + + const getBillingMetersIdEventSummariesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_billing_meter_event_summary), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/billing/meters/[^/]+/event_summaries")), + }), + ], + ], + s_error, + ) + + // getBillingMetersIdEventSummaries + router.get( + `/v1/billing/meters/:id/event_summaries`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getBillingMetersIdEventSummariesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getBillingMetersIdEventSummariesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingMetersIdEventSummariesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_billing_meter_event_summary[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingMetersIdEventSummaries(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getBillingMetersIdEventSummariesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingMetersIdReactivateParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postBillingMetersIdReactivateRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postBillingMetersIdReactivateResponseBodyValidator = + responseValidationFactory([["200", s_billing_meter]], s_error) + + // postBillingMetersIdReactivate + router.post( + `/v1/billing/meters/:id/reactivate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingMetersIdReactivateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingMetersIdReactivateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingMetersIdReactivate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingMetersIdReactivateResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingPortalConfigurationsQuerySchema = z.object({ + active: PermissiveBoolean.optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + is_default: PermissiveBoolean.optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getBillingPortalConfigurationsRequestBodySchema = z + .object({}) + .optional() + + const getBillingPortalConfigurationsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_billing_portal_configuration), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/billing_portal/configurations")), + }), + ], + ], + s_error, + ) + + // getBillingPortalConfigurations + router.get( + `/v1/billing_portal/configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getBillingPortalConfigurationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingPortalConfigurationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_billing_portal_configuration[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingPortalConfigurations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getBillingPortalConfigurationsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingPortalConfigurationsRequestBodySchema = z.object({ + business_profile: z + .object({ + headline: z.union([z.string().max(60), z.enum([""])]).optional(), + privacy_policy_url: z.string().optional(), + terms_of_service_url: z.string().optional(), + }) + .optional(), + default_return_url: z.union([z.string(), z.enum([""])]).optional(), + expand: z.array(z.string().max(5000)).optional(), + features: z.object({ + customer_update: z + .object({ + allowed_updates: z + .union([ + z.array( + z.enum([ + "address", + "email", + "name", + "phone", + "shipping", + "tax_id", + ]), + ), + z.enum([""]), + ]) + .optional(), + enabled: PermissiveBoolean, + }) + .optional(), + invoice_history: z.object({ enabled: PermissiveBoolean }).optional(), + payment_method_update: z + .object({ enabled: PermissiveBoolean }) + .optional(), + subscription_cancel: z + .object({ + cancellation_reason: z + .object({ + enabled: PermissiveBoolean, + options: z.union([ + z.array( + z.enum([ + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ]), + ), + z.enum([""]), + ]), + }) + .optional(), + enabled: PermissiveBoolean, + mode: z.enum(["at_period_end", "immediately"]).optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + }) + .optional(), + subscription_update: z + .object({ + default_allowed_updates: z + .union([ + z.array(z.enum(["price", "promotion_code", "quantity"])), + z.enum([""]), + ]) + .optional(), + enabled: PermissiveBoolean, + products: z + .union([ + z.array( + z.object({ + prices: z.array(z.string().max(5000)), + product: z.string().max(5000), + }), + ), + z.enum([""]), + ]) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + schedule_at_period_end: z + .object({ + conditions: z + .array( + z.object({ + type: z.enum([ + "decreasing_item_amount", + "shortening_interval", + ]), + }), + ) + .optional(), + }) + .optional(), + }) + .optional(), + }), + login_page: z.object({ enabled: PermissiveBoolean }).optional(), + metadata: z.record(z.string()).optional(), + }) + + const postBillingPortalConfigurationsResponseBodyValidator = + responseValidationFactory( + [["200", s_billing_portal_configuration]], + s_error, + ) + + // postBillingPortalConfigurations + router.post( + `/v1/billing_portal/configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postBillingPortalConfigurationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingPortalConfigurations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingPortalConfigurationsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getBillingPortalConfigurationsConfigurationParamSchema = z.object({ + configuration: z.string().max(5000), + }) + + const getBillingPortalConfigurationsConfigurationQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getBillingPortalConfigurationsConfigurationRequestBodySchema = z + .object({}) + .optional() + + const getBillingPortalConfigurationsConfigurationResponseBodyValidator = + responseValidationFactory( + [["200", s_billing_portal_configuration]], + s_error, + ) + + // getBillingPortalConfigurationsConfiguration + router.get( + `/v1/billing_portal/configurations/:configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getBillingPortalConfigurationsConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getBillingPortalConfigurationsConfigurationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getBillingPortalConfigurationsConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getBillingPortalConfigurationsConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getBillingPortalConfigurationsConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingPortalConfigurationsConfigurationParamSchema = z.object({ + configuration: z.string().max(5000), + }) + + const postBillingPortalConfigurationsConfigurationRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + business_profile: z + .object({ + headline: z.union([z.string().max(60), z.enum([""])]).optional(), + privacy_policy_url: z.union([z.string(), z.enum([""])]).optional(), + terms_of_service_url: z.union([z.string(), z.enum([""])]).optional(), + }) + .optional(), + default_return_url: z.union([z.string(), z.enum([""])]).optional(), + expand: z.array(z.string().max(5000)).optional(), + features: z + .object({ + customer_update: z + .object({ + allowed_updates: z + .union([ + z.array( + z.enum([ + "address", + "email", + "name", + "phone", + "shipping", + "tax_id", + ]), + ), + z.enum([""]), + ]) + .optional(), + enabled: PermissiveBoolean.optional(), + }) + .optional(), + invoice_history: z.object({ enabled: PermissiveBoolean }).optional(), + payment_method_update: z + .object({ enabled: PermissiveBoolean }) + .optional(), + subscription_cancel: z + .object({ + cancellation_reason: z + .object({ + enabled: PermissiveBoolean, + options: z + .union([ + z.array( + z.enum([ + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ]), + ), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + enabled: PermissiveBoolean.optional(), + mode: z.enum(["at_period_end", "immediately"]).optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + }) + .optional(), + subscription_update: z + .object({ + default_allowed_updates: z + .union([ + z.array(z.enum(["price", "promotion_code", "quantity"])), + z.enum([""]), + ]) + .optional(), + enabled: PermissiveBoolean.optional(), + products: z + .union([ + z.array( + z.object({ + prices: z.array(z.string().max(5000)), + product: z.string().max(5000), + }), + ), + z.enum([""]), + ]) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + schedule_at_period_end: z + .object({ + conditions: z + .union([ + z.array( + z.object({ + type: z.enum([ + "decreasing_item_amount", + "shortening_interval", + ]), + }), + ), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + login_page: z.object({ enabled: PermissiveBoolean }).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postBillingPortalConfigurationsConfigurationResponseBodyValidator = + responseValidationFactory( + [["200", s_billing_portal_configuration]], + s_error, + ) + + // postBillingPortalConfigurationsConfiguration + router.post( + `/v1/billing_portal/configurations/:configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postBillingPortalConfigurationsConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postBillingPortalConfigurationsConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingPortalConfigurationsConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postBillingPortalConfigurationsConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postBillingPortalSessionsRequestBodySchema = z.object({ + configuration: z.string().max(5000).optional(), + customer: z.string().max(5000), + expand: z.array(z.string().max(5000)).optional(), + flow_data: z + .object({ + after_completion: z + .object({ + hosted_confirmation: z + .object({ custom_message: z.string().max(500).optional() }) + .optional(), + redirect: z.object({ return_url: z.string() }).optional(), + type: z.enum([ + "hosted_confirmation", + "portal_homepage", + "redirect", + ]), + }) + .optional(), + subscription_cancel: z + .object({ + retention: z + .object({ + coupon_offer: z.object({ coupon: z.string().max(5000) }), + type: z.enum(["coupon_offer"]), + }) + .optional(), + subscription: z.string().max(5000), + }) + .optional(), + subscription_update: z + .object({ subscription: z.string().max(5000) }) + .optional(), + subscription_update_confirm: z + .object({ + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + items: z.array( + z.object({ + id: z.string().max(5000), + price: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + }), + ), + subscription: z.string().max(5000), + }) + .optional(), + type: z.enum([ + "payment_method_update", + "subscription_cancel", + "subscription_update", + "subscription_update_confirm", + ]), + }) + .optional(), + locale: z + .enum([ + "auto", + "bg", + "cs", + "da", + "de", + "el", + "en", + "en-AU", + "en-CA", + "en-GB", + "en-IE", + "en-IN", + "en-NZ", + "en-SG", + "es", + "es-419", + "et", + "fi", + "fil", + "fr", + "fr-CA", + "hr", + "hu", + "id", + "it", + "ja", + "ko", + "lt", + "lv", + "ms", + "mt", + "nb", + "nl", + "pl", + "pt", + "pt-BR", + "ro", + "ru", + "sk", + "sl", + "sv", + "th", + "tr", + "vi", + "zh", + "zh-HK", + "zh-TW", + ]) + .optional(), + on_behalf_of: z.string().optional(), + return_url: z.string().optional(), + }) + + const postBillingPortalSessionsResponseBodyValidator = + responseValidationFactory([["200", s_billing_portal_session]], s_error) + + // postBillingPortalSessions + router.post( + `/v1/billing_portal/sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postBillingPortalSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postBillingPortalSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postBillingPortalSessionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getChargesQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + payment_intent: z.string().max(5000).optional(), + starting_after: z.string().optional(), + transfer_group: z.string().max(5000).optional(), + }) + + const getChargesRequestBodySchema = z.object({}).optional() + + const getChargesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_charge)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/charges")), + }), + ], + ], + s_error, + ) + + // getCharges + router.get( + `/v1/charges`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getChargesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getChargesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_charge[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCharges(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getChargesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postChargesRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + application_fee: z.coerce.number().optional(), + application_fee_amount: z.coerce.number().optional(), + capture: PermissiveBoolean.optional(), + card: z + .union([ + z.object({ + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + cvc: z.string().max(5000).optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000).optional(), + number: z.string().max(5000), + object: z.enum(["card"]).optional(), + }), + z.string().max(5000), + ]) + .optional(), + currency: z.string().optional(), + customer: z.string().max(500).optional(), + description: z.string().max(40000).optional(), + destination: z + .union([ + z.object({ + account: z.string().max(5000), + amount: z.coerce.number().optional(), + }), + z.string(), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + on_behalf_of: z.string().max(5000).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + receipt_email: z.string().optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + carrier: z.string().max(5000).optional(), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + tracking_number: z.string().max(5000).optional(), + }) + .optional(), + source: z.string().max(5000).optional(), + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_suffix: z.string().max(22).optional(), + transfer_data: z + .object({ + amount: z.coerce.number().optional(), + destination: z.string().max(5000), + }) + .optional(), + transfer_group: z.string().optional(), + }) + .optional() + + const postChargesResponseBodyValidator = responseValidationFactory( + [["200", s_charge]], + s_error, + ) + + // postCharges + router.post( + `/v1/charges`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postChargesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCharges(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postChargesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getChargesSearchQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + page: z.string().max(5000).optional(), + query: z.string().max(5000), + }) + + const getChargesSearchRequestBodySchema = z.object({}).optional() + + const getChargesSearchResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_charge)), + has_more: PermissiveBoolean, + next_page: z.string().max(5000).nullable().optional(), + object: z.enum(["search_result"]), + total_count: z.coerce.number().optional(), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getChargesSearch + router.get( + `/v1/charges/search`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getChargesSearchQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getChargesSearchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_charge[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getChargesSearch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getChargesSearchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getChargesChargeParamSchema = z.object({ charge: z.string().max(5000) }) + + const getChargesChargeQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getChargesChargeRequestBodySchema = z.object({}).optional() + + const getChargesChargeResponseBodyValidator = responseValidationFactory( + [["200", s_charge]], + s_error, + ) + + // getChargesCharge + router.get( + `/v1/charges/:charge`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getChargesChargeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getChargesChargeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getChargesChargeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getChargesCharge(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getChargesChargeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postChargesChargeParamSchema = z.object({ + charge: z.string().max(5000), + }) + + const postChargesChargeRequestBodySchema = z + .object({ + customer: z.string().max(5000).optional(), + description: z.string().max(40000).optional(), + expand: z.array(z.string().max(5000)).optional(), + fraud_details: z + .object({ user_report: z.enum(["", "fraudulent", "safe"]) }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + receipt_email: z.string().max(5000).optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + carrier: z.string().max(5000).optional(), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + tracking_number: z.string().max(5000).optional(), + }) + .optional(), + transfer_group: z.string().optional(), + }) + .optional() + + const postChargesChargeResponseBodyValidator = responseValidationFactory( + [["200", s_charge]], + s_error, + ) + + // postChargesCharge + router.post( + `/v1/charges/:charge`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postChargesChargeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postChargesChargeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postChargesCharge(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postChargesChargeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postChargesChargeCaptureParamSchema = z.object({ + charge: z.string().max(5000), + }) + + const postChargesChargeCaptureRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + application_fee: z.coerce.number().optional(), + application_fee_amount: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + receipt_email: z.string().optional(), + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_suffix: z.string().max(22).optional(), + transfer_data: z + .object({ amount: z.coerce.number().optional() }) + .optional(), + transfer_group: z.string().optional(), + }) + .optional() + + const postChargesChargeCaptureResponseBodyValidator = + responseValidationFactory([["200", s_charge]], s_error) + + // postChargesChargeCapture + router.post( + `/v1/charges/:charge/capture`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postChargesChargeCaptureParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postChargesChargeCaptureRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postChargesChargeCapture(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postChargesChargeCaptureResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getChargesChargeDisputeParamSchema = z.object({ + charge: z.string().max(5000), + }) + + const getChargesChargeDisputeQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getChargesChargeDisputeRequestBodySchema = z.object({}).optional() + + const getChargesChargeDisputeResponseBodyValidator = + responseValidationFactory([["200", s_dispute]], s_error) + + // getChargesChargeDispute + router.get( + `/v1/charges/:charge/dispute`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getChargesChargeDisputeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getChargesChargeDisputeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getChargesChargeDisputeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getChargesChargeDispute(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getChargesChargeDisputeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postChargesChargeDisputeParamSchema = z.object({ + charge: z.string().max(5000), + }) + + const postChargesChargeDisputeRequestBodySchema = z + .object({ + evidence: z + .object({ + access_activity_log: z.string().max(20000).optional(), + billing_address: z.string().max(5000).optional(), + cancellation_policy: z.string().optional(), + cancellation_policy_disclosure: z.string().max(20000).optional(), + cancellation_rebuttal: z.string().max(20000).optional(), + customer_communication: z.string().optional(), + customer_email_address: z.string().max(5000).optional(), + customer_name: z.string().max(5000).optional(), + customer_purchase_ip: z.string().max(5000).optional(), + customer_signature: z.string().optional(), + duplicate_charge_documentation: z.string().optional(), + duplicate_charge_explanation: z.string().max(20000).optional(), + duplicate_charge_id: z.string().max(5000).optional(), + enhanced_evidence: z + .union([ + z.object({ + visa_compelling_evidence_3: z + .object({ + disputed_transaction: z + .object({ + customer_account_id: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_device_fingerprint: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_device_id: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_email_address: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_purchase_ip: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + merchandise_or_services: z + .enum(["merchandise", "services"]) + .optional(), + product_description: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + shipping_address: z + .object({ + city: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + country: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + line1: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + line2: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + postal_code: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + state: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + prior_undisputed_transactions: z + .array( + z.object({ + charge: z.string().max(5000), + customer_account_id: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_device_fingerprint: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_device_id: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_email_address: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_purchase_ip: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + shipping_address: z + .object({ + city: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + country: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + line1: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + line2: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + postal_code: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + state: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }), + ) + .optional(), + }) + .optional(), + visa_compliance: z + .object({ fee_acknowledged: PermissiveBoolean.optional() }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + product_description: z.string().max(20000).optional(), + receipt: z.string().optional(), + refund_policy: z.string().optional(), + refund_policy_disclosure: z.string().max(20000).optional(), + refund_refusal_explanation: z.string().max(20000).optional(), + service_date: z.string().max(5000).optional(), + service_documentation: z.string().optional(), + shipping_address: z.string().max(5000).optional(), + shipping_carrier: z.string().max(5000).optional(), + shipping_date: z.string().max(5000).optional(), + shipping_documentation: z.string().optional(), + shipping_tracking_number: z.string().max(5000).optional(), + uncategorized_file: z.string().optional(), + uncategorized_text: z.string().max(20000).optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + submit: PermissiveBoolean.optional(), + }) + .optional() + + const postChargesChargeDisputeResponseBodyValidator = + responseValidationFactory([["200", s_dispute]], s_error) + + // postChargesChargeDispute + router.post( + `/v1/charges/:charge/dispute`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postChargesChargeDisputeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postChargesChargeDisputeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postChargesChargeDispute(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postChargesChargeDisputeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postChargesChargeDisputeCloseParamSchema = z.object({ + charge: z.string().max(5000), + }) + + const postChargesChargeDisputeCloseRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postChargesChargeDisputeCloseResponseBodyValidator = + responseValidationFactory([["200", s_dispute]], s_error) + + // postChargesChargeDisputeClose + router.post( + `/v1/charges/:charge/dispute/close`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postChargesChargeDisputeCloseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postChargesChargeDisputeCloseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postChargesChargeDisputeClose(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postChargesChargeDisputeCloseResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postChargesChargeRefundParamSchema = z.object({ + charge: z.string().max(5000), + }) + + const postChargesChargeRefundRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + instructions_email: z.string().optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + payment_intent: z.string().max(5000).optional(), + reason: z + .enum(["duplicate", "fraudulent", "requested_by_customer"]) + .optional(), + refund_application_fee: PermissiveBoolean.optional(), + reverse_transfer: PermissiveBoolean.optional(), + }) + .optional() + + const postChargesChargeRefundResponseBodyValidator = + responseValidationFactory([["200", s_charge]], s_error) + + // postChargesChargeRefund + router.post( + `/v1/charges/:charge/refund`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postChargesChargeRefundParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postChargesChargeRefundRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postChargesChargeRefund(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postChargesChargeRefundResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getChargesChargeRefundsParamSchema = z.object({ charge: z.string() }) + + const getChargesChargeRefundsQuerySchema = z.object({ + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().optional(), + }) + + const getChargesChargeRefundsRequestBodySchema = z.object({}).optional() + + const getChargesChargeRefundsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_refund)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getChargesChargeRefunds + router.get( + `/v1/charges/:charge/refunds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getChargesChargeRefundsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getChargesChargeRefundsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getChargesChargeRefundsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_refund[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getChargesChargeRefunds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getChargesChargeRefundsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postChargesChargeRefundsParamSchema = z.object({ + charge: z.string().max(5000), + }) + + const postChargesChargeRefundsRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + customer: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + instructions_email: z.string().optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + origin: z.enum(["customer_balance"]).optional(), + payment_intent: z.string().max(5000).optional(), + reason: z + .enum(["duplicate", "fraudulent", "requested_by_customer"]) + .optional(), + refund_application_fee: PermissiveBoolean.optional(), + reverse_transfer: PermissiveBoolean.optional(), + }) + .optional() + + const postChargesChargeRefundsResponseBodyValidator = + responseValidationFactory([["200", s_refund]], s_error) + + // postChargesChargeRefunds + router.post( + `/v1/charges/:charge/refunds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postChargesChargeRefundsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postChargesChargeRefundsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postChargesChargeRefunds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postChargesChargeRefundsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getChargesChargeRefundsRefundParamSchema = z.object({ + charge: z.string(), + refund: z.string(), + }) + + const getChargesChargeRefundsRefundQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getChargesChargeRefundsRefundRequestBodySchema = z.object({}).optional() + + const getChargesChargeRefundsRefundResponseBodyValidator = + responseValidationFactory([["200", s_refund]], s_error) + + // getChargesChargeRefundsRefund + router.get( + `/v1/charges/:charge/refunds/:refund`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getChargesChargeRefundsRefundParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getChargesChargeRefundsRefundQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getChargesChargeRefundsRefundRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getChargesChargeRefundsRefund(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getChargesChargeRefundsRefundResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postChargesChargeRefundsRefundParamSchema = z.object({ + charge: z.string(), + refund: z.string(), + }) + + const postChargesChargeRefundsRefundRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postChargesChargeRefundsRefundResponseBodyValidator = + responseValidationFactory([["200", s_refund]], s_error) + + // postChargesChargeRefundsRefund + router.post( + `/v1/charges/:charge/refunds/:refund`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postChargesChargeRefundsRefundParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postChargesChargeRefundsRefundRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postChargesChargeRefundsRefund(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postChargesChargeRefundsRefundResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCheckoutSessionsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + customer_details: z.object({ email: z.string() }).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + payment_intent: z.string().max(5000).optional(), + payment_link: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["complete", "expired", "open"]).optional(), + subscription: z.string().max(5000).optional(), + }) + + const getCheckoutSessionsRequestBodySchema = z.object({}).optional() + + const getCheckoutSessionsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_checkout_session)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCheckoutSessions + router.get( + `/v1/checkout/sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getCheckoutSessionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCheckoutSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_checkout_session[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCheckoutSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCheckoutSessionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCheckoutSessionsRequestBodySchema = z + .object({ + adaptive_pricing: z + .object({ enabled: PermissiveBoolean.optional() }) + .optional(), + after_expiration: z + .object({ + recovery: z + .object({ + allow_promotion_codes: PermissiveBoolean.optional(), + enabled: PermissiveBoolean, + }) + .optional(), + }) + .optional(), + allow_promotion_codes: PermissiveBoolean.optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_address_collection: z.enum(["auto", "required"]).optional(), + cancel_url: z.string().max(5000).optional(), + client_reference_id: z.string().max(200).optional(), + consent_collection: z + .object({ + payment_method_reuse_agreement: z + .object({ position: z.enum(["auto", "hidden"]) }) + .optional(), + promotions: z.enum(["auto", "none"]).optional(), + terms_of_service: z.enum(["none", "required"]).optional(), + }) + .optional(), + currency: z.string().optional(), + custom_fields: z + .array( + z.object({ + dropdown: z + .object({ + default_value: z.string().max(100).optional(), + options: z.array( + z.object({ + label: z.string().max(100), + value: z.string().max(100), + }), + ), + }) + .optional(), + key: z.string().max(200), + label: z.object({ + custom: z.string().max(50), + type: z.enum(["custom"]), + }), + numeric: z + .object({ + default_value: z.string().max(255).optional(), + maximum_length: z.coerce.number().optional(), + minimum_length: z.coerce.number().optional(), + }) + .optional(), + optional: PermissiveBoolean.optional(), + text: z + .object({ + default_value: z.string().max(255).optional(), + maximum_length: z.coerce.number().optional(), + minimum_length: z.coerce.number().optional(), + }) + .optional(), + type: z.enum(["dropdown", "numeric", "text"]), + }), + ) + .optional(), + custom_text: z + .object({ + after_submit: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + shipping_address: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + submit: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + terms_of_service_acceptance: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + }) + .optional(), + customer: z.string().max(5000).optional(), + customer_creation: z.enum(["always", "if_required"]).optional(), + customer_email: z.string().optional(), + customer_update: z + .object({ + address: z.enum(["auto", "never"]).optional(), + name: z.enum(["auto", "never"]).optional(), + shipping: z.enum(["auto", "never"]).optional(), + }) + .optional(), + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + invoice_creation: z + .object({ + enabled: PermissiveBoolean, + invoice_data: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + custom_fields: z + .union([ + z.array( + z.object({ + name: z.string().max(40), + value: z.string().max(140), + }), + ), + z.enum([""]), + ]) + .optional(), + description: z.string().max(1500).optional(), + footer: z.string().max(5000).optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + metadata: z.record(z.string()).optional(), + rendering_options: z + .union([ + z.object({ + amount_tax_display: z + .enum(["", "exclude_tax", "include_inclusive_tax"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + }) + .optional(), + line_items: z + .array( + z.object({ + adjustable_quantity: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + }) + .optional(), + dynamic_tax_rates: z.array(z.string().max(5000)).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000).optional(), + product_data: z + .object({ + description: z.string().max(40000).optional(), + images: z.array(z.string()).optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000), + tax_code: z.string().max(5000).optional(), + }) + .optional(), + recurring: z + .object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z.array(z.string().max(5000)).optional(), + }), + ) + .optional(), + locale: z + .enum([ + "auto", + "bg", + "cs", + "da", + "de", + "el", + "en", + "en-GB", + "es", + "es-419", + "et", + "fi", + "fil", + "fr", + "fr-CA", + "hr", + "hu", + "id", + "it", + "ja", + "ko", + "lt", + "lv", + "ms", + "mt", + "nb", + "nl", + "pl", + "pt", + "pt-BR", + "ro", + "ru", + "sk", + "sl", + "sv", + "th", + "tr", + "vi", + "zh", + "zh-HK", + "zh-TW", + ]) + .optional(), + metadata: z.record(z.string()).optional(), + mode: z.enum(["payment", "setup", "subscription"]).optional(), + optional_items: z + .array( + z.object({ + adjustable_quantity: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + }) + .optional(), + price: z.string().max(5000), + quantity: z.coerce.number(), + }), + ) + .optional(), + payment_intent_data: z + .object({ + application_fee_amount: z.coerce.number().optional(), + capture_method: z + .enum(["automatic", "automatic_async", "manual"]) + .optional(), + description: z.string().max(1000).optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.string().optional(), + receipt_email: z.string().optional(), + setup_future_usage: z.enum(["off_session", "on_session"]).optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + carrier: z.string().max(5000).optional(), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + tracking_number: z.string().max(5000).optional(), + }) + .optional(), + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_suffix: z.string().max(22).optional(), + transfer_data: z + .object({ + amount: z.coerce.number().optional(), + destination: z.string(), + }) + .optional(), + transfer_group: z.string().optional(), + }) + .optional(), + payment_method_collection: z.enum(["always", "if_required"]).optional(), + payment_method_configuration: z.string().max(100).optional(), + payment_method_data: z + .object({ + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + }) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .object({ + currency: z.enum(["cad", "usd"]).optional(), + mandate_options: z + .object({ + custom_mandate_url: z + .union([z.string(), z.enum([""])]) + .optional(), + default_for: z + .array(z.enum(["invoice", "subscription"])) + .optional(), + interval_description: z.string().max(500).optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .optional(), + transaction_type: z.enum(["business", "personal"]).optional(), + }) + .optional(), + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + .optional(), + affirm: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + afterpay_clearpay: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + alipay: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + amazon_pay: z + .object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), + }) + .optional(), + au_becs_debit: z + .object({ + setup_future_usage: z.enum(["none"]).optional(), + target_date: z.string().max(5000).optional(), + }) + .optional(), + bacs_debit: z + .object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + boleto: z + .object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + }) + .optional(), + card: z + .object({ + installments: z + .object({ enabled: PermissiveBoolean.optional() }) + .optional(), + request_extended_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_incremental_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_multicapture: z + .enum(["if_available", "never"]) + .optional(), + request_overcapture: z.enum(["if_available", "never"]).optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + restrictions: z + .object({ + brands_blocked: z + .array( + z.enum([ + "american_express", + "discover_global_network", + "mastercard", + "visa", + ]), + ) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["off_session", "on_session"]) + .optional(), + statement_descriptor_suffix_kana: z.string().max(22).optional(), + statement_descriptor_suffix_kanji: z.string().max(17).optional(), + }) + .optional(), + cashapp: z + .object({ + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + }) + .optional(), + customer_balance: z + .object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + requested_address_types: z + .array( + z.enum([ + "aba", + "iban", + "sepa", + "sort_code", + "spei", + "swift", + "zengin", + ]), + ) + .optional(), + type: z.enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]), + }) + .optional(), + funding_type: z.enum(["bank_transfer"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }) + .optional(), + eps: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + fpx: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + giropay: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + grabpay: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + ideal: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + kakao_pay: z + .object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), + }) + .optional(), + klarna: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + konbini: z + .object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z.enum(["none"]).optional(), + }) + .optional(), + kr_card: z + .object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), + }) + .optional(), + link: z + .object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), + }) + .optional(), + mobilepay: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + multibanco: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + naver_pay: z + .object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), + }) + .optional(), + oxxo: z + .object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z.enum(["none"]).optional(), + }) + .optional(), + p24: z + .object({ + setup_future_usage: z.enum(["none"]).optional(), + tos_shown_and_accepted: PermissiveBoolean.optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z + .object({ capture_method: z.enum(["manual"]).optional() }) + .optional(), + paynow: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + paypal: z + .object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z + .enum([ + "cs-CZ", + "da-DK", + "de-AT", + "de-DE", + "de-LU", + "el-GR", + "en-GB", + "en-US", + "es-ES", + "fi-FI", + "fr-BE", + "fr-FR", + "fr-LU", + "hu-HU", + "it-IT", + "nl-BE", + "nl-NL", + "pl-PL", + "pt-PT", + "sk-SK", + "sv-SE", + ]) + .optional(), + reference: z.string().max(127).optional(), + risk_correlation_id: z.string().max(32).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }) + .optional(), + pix: z + .object({ expires_after_seconds: z.coerce.number().optional() }) + .optional(), + revolut_pay: z + .object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), + }) + .optional(), + samsung_pay: z + .object({ capture_method: z.enum(["manual"]).optional() }) + .optional(), + sepa_debit: z + .object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }) + .optional(), + sofort: z + .object({ setup_future_usage: z.enum(["none"]).optional() }) + .optional(), + swish: z + .object({ reference: z.string().max(5000).optional() }) + .optional(), + us_bank_account: z + .object({ + financial_connections: z + .object({ + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z.enum(["automatic", "instant"]).optional(), + }) + .optional(), + wechat_pay: z + .object({ + app_id: z.string().max(5000).optional(), + client: z.enum(["android", "ios", "web"]), + setup_future_usage: z.enum(["none"]).optional(), + }) + .optional(), + }) + .optional(), + payment_method_types: z + .array( + z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + ) + .optional(), + permissions: z + .object({ + update_shipping_details: z + .enum(["client_only", "server_only"]) + .optional(), + }) + .optional(), + phone_number_collection: z + .object({ enabled: PermissiveBoolean }) + .optional(), + redirect_on_completion: z + .enum(["always", "if_required", "never"]) + .optional(), + return_url: z.string().max(5000).optional(), + saved_payment_method_options: z + .object({ + allow_redisplay_filters: z + .array(z.enum(["always", "limited", "unspecified"])) + .optional(), + payment_method_save: z.enum(["disabled", "enabled"]).optional(), + }) + .optional(), + setup_intent_data: z + .object({ + description: z.string().max(1000).optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.string().optional(), + }) + .optional(), + shipping_address_collection: z + .object({ + allowed_countries: z.array( + z.enum([ + "AC", + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MK", + "ML", + "MM", + "MN", + "MO", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TA", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + "ZZ", + ]), + ), + }) + .optional(), + shipping_options: z + .array( + z.object({ + shipping_rate: z.string().max(5000).optional(), + shipping_rate_data: z + .object({ + delivery_estimate: z + .object({ + maximum: z + .object({ + unit: z.enum([ + "business_day", + "day", + "hour", + "month", + "week", + ]), + value: z.coerce.number(), + }) + .optional(), + minimum: z + .object({ + unit: z.enum([ + "business_day", + "day", + "hour", + "month", + "week", + ]), + value: z.coerce.number(), + }) + .optional(), + }) + .optional(), + display_name: z.string().max(100), + fixed_amount: z + .object({ + amount: z.coerce.number(), + currency: z.string(), + currency_options: z + .record( + z.object({ + amount: z.coerce.number(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + }), + ) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tax_code: z.string().optional(), + type: z.enum(["fixed_amount"]).optional(), + }) + .optional(), + }), + ) + .optional(), + submit_type: z + .enum(["auto", "book", "donate", "pay", "subscribe"]) + .optional(), + subscription_data: z + .object({ + application_fee_percent: z.coerce.number().optional(), + billing_cycle_anchor: z.coerce.number().optional(), + default_tax_rates: z.array(z.string().max(5000)).optional(), + description: z.string().max(500).optional(), + invoice_settings: z + .object({ + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.string().optional(), + proration_behavior: z.enum(["create_prorations", "none"]).optional(), + transfer_data: z + .object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }) + .optional(), + trial_end: z.coerce.number().optional(), + trial_period_days: z.coerce.number().optional(), + trial_settings: z + .object({ + end_behavior: z.object({ + missing_payment_method: z.enum([ + "cancel", + "create_invoice", + "pause", + ]), + }), + }) + .optional(), + }) + .optional(), + success_url: z.string().max(5000).optional(), + tax_id_collection: z + .object({ + enabled: PermissiveBoolean, + required: z.enum(["if_supported", "never"]).optional(), + }) + .optional(), + ui_mode: z.enum(["custom", "embedded", "hosted"]).optional(), + }) + .optional() + + const postCheckoutSessionsResponseBodyValidator = responseValidationFactory( + [["200", s_checkout_session]], + s_error, + ) + + // postCheckoutSessions + router.post( + `/v1/checkout/sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postCheckoutSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCheckoutSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCheckoutSessionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCheckoutSessionsSessionParamSchema = z.object({ + session: z.string().max(66), + }) + + const getCheckoutSessionsSessionQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCheckoutSessionsSessionRequestBodySchema = z.object({}).optional() + + const getCheckoutSessionsSessionResponseBodyValidator = + responseValidationFactory([["200", s_checkout_session]], s_error) + + // getCheckoutSessionsSession + router.get( + `/v1/checkout/sessions/:session`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCheckoutSessionsSessionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCheckoutSessionsSessionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCheckoutSessionsSessionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCheckoutSessionsSession(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCheckoutSessionsSessionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCheckoutSessionsSessionParamSchema = z.object({ + session: z.string().max(5000), + }) + + const postCheckoutSessionsSessionRequestBodySchema = z + .object({ + collected_information: z + .object({ + shipping_details: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000), + line1: z.string().max(5000), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + name: z.string().max(255), + }) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + shipping_options: z + .union([ + z.array( + z.object({ + shipping_rate: z.string().max(5000).optional(), + shipping_rate_data: z + .object({ + delivery_estimate: z + .object({ + maximum: z + .object({ + unit: z.enum([ + "business_day", + "day", + "hour", + "month", + "week", + ]), + value: z.coerce.number(), + }) + .optional(), + minimum: z + .object({ + unit: z.enum([ + "business_day", + "day", + "hour", + "month", + "week", + ]), + value: z.coerce.number(), + }) + .optional(), + }) + .optional(), + display_name: z.string().max(100), + fixed_amount: z + .object({ + amount: z.coerce.number(), + currency: z.string(), + currency_options: z + .record( + z.object({ + amount: z.coerce.number(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + }), + ) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tax_code: z.string().optional(), + type: z.enum(["fixed_amount"]).optional(), + }) + .optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + }) + .optional() + + const postCheckoutSessionsSessionResponseBodyValidator = + responseValidationFactory([["200", s_checkout_session]], s_error) + + // postCheckoutSessionsSession + router.post( + `/v1/checkout/sessions/:session`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCheckoutSessionsSessionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCheckoutSessionsSessionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCheckoutSessionsSession(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCheckoutSessionsSessionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCheckoutSessionsSessionExpireParamSchema = z.object({ + session: z.string().max(5000), + }) + + const postCheckoutSessionsSessionExpireRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postCheckoutSessionsSessionExpireResponseBodyValidator = + responseValidationFactory([["200", s_checkout_session]], s_error) + + // postCheckoutSessionsSessionExpire + router.post( + `/v1/checkout/sessions/:session/expire`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCheckoutSessionsSessionExpireParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCheckoutSessionsSessionExpireRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCheckoutSessionsSessionExpire(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCheckoutSessionsSessionExpireResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCheckoutSessionsSessionLineItemsParamSchema = z.object({ + session: z.string().max(5000), + }) + + const getCheckoutSessionsSessionLineItemsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCheckoutSessionsSessionLineItemsRequestBodySchema = z + .object({}) + .optional() + + const getCheckoutSessionsSessionLineItemsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCheckoutSessionsSessionLineItems + router.get( + `/v1/checkout/sessions/:session/line_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCheckoutSessionsSessionLineItemsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCheckoutSessionsSessionLineItemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCheckoutSessionsSessionLineItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCheckoutSessionsSessionLineItems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCheckoutSessionsSessionLineItemsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getClimateOrdersQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getClimateOrdersRequestBodySchema = z.object({}).optional() + + const getClimateOrdersResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_climate_order), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/climate/orders")), + }), + ], + ], + s_error, + ) + + // getClimateOrders + router.get( + `/v1/climate/orders`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getClimateOrdersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getClimateOrdersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_climate_order[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getClimateOrders(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getClimateOrdersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postClimateOrdersRequestBodySchema = z.object({ + amount: z.coerce.number().optional(), + beneficiary: z.object({ public_name: z.string().max(5000) }).optional(), + currency: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + metric_tons: z.string().optional(), + product: z.string().max(5000), + }) + + const postClimateOrdersResponseBodyValidator = responseValidationFactory( + [["200", s_climate_order]], + s_error, + ) + + // postClimateOrders + router.post( + `/v1/climate/orders`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postClimateOrdersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postClimateOrders(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postClimateOrdersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getClimateOrdersOrderParamSchema = z.object({ + order: z.string().max(5000), + }) + + const getClimateOrdersOrderQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getClimateOrdersOrderRequestBodySchema = z.object({}).optional() + + const getClimateOrdersOrderResponseBodyValidator = responseValidationFactory( + [["200", s_climate_order]], + s_error, + ) + + // getClimateOrdersOrder + router.get( + `/v1/climate/orders/:order`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getClimateOrdersOrderParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getClimateOrdersOrderQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getClimateOrdersOrderRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getClimateOrdersOrder(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getClimateOrdersOrderResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postClimateOrdersOrderParamSchema = z.object({ + order: z.string().max(5000), + }) + + const postClimateOrdersOrderRequestBodySchema = z + .object({ + beneficiary: z + .union([ + z.object({ + public_name: z.union([z.string().max(5000), z.enum([""])]), + }), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + }) + .optional() + + const postClimateOrdersOrderResponseBodyValidator = responseValidationFactory( + [["200", s_climate_order]], + s_error, + ) + + // postClimateOrdersOrder + router.post( + `/v1/climate/orders/:order`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postClimateOrdersOrderParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postClimateOrdersOrderRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postClimateOrdersOrder(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postClimateOrdersOrderResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postClimateOrdersOrderCancelParamSchema = z.object({ + order: z.string().max(5000), + }) + + const postClimateOrdersOrderCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postClimateOrdersOrderCancelResponseBodyValidator = + responseValidationFactory([["200", s_climate_order]], s_error) + + // postClimateOrdersOrderCancel + router.post( + `/v1/climate/orders/:order/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postClimateOrdersOrderCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postClimateOrdersOrderCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postClimateOrdersOrderCancel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postClimateOrdersOrderCancelResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getClimateProductsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getClimateProductsRequestBodySchema = z.object({}).optional() + + const getClimateProductsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_climate_product), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/climate/products")), + }), + ], + ], + s_error, + ) + + // getClimateProducts + router.get( + `/v1/climate/products`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getClimateProductsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getClimateProductsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_climate_product[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getClimateProducts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getClimateProductsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getClimateProductsProductParamSchema = z.object({ + product: z.string().max(5000), + }) + + const getClimateProductsProductQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getClimateProductsProductRequestBodySchema = z.object({}).optional() + + const getClimateProductsProductResponseBodyValidator = + responseValidationFactory([["200", s_climate_product]], s_error) + + // getClimateProductsProduct + router.get( + `/v1/climate/products/:product`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getClimateProductsProductParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getClimateProductsProductQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getClimateProductsProductRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getClimateProductsProduct(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getClimateProductsProductResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getClimateSuppliersQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getClimateSuppliersRequestBodySchema = z.object({}).optional() + + const getClimateSuppliersResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_climate_supplier), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/climate/suppliers")), + }), + ], + ], + s_error, + ) + + // getClimateSuppliers + router.get( + `/v1/climate/suppliers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getClimateSuppliersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getClimateSuppliersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_climate_supplier[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getClimateSuppliers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getClimateSuppliersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getClimateSuppliersSupplierParamSchema = z.object({ + supplier: z.string().max(5000), + }) + + const getClimateSuppliersSupplierQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getClimateSuppliersSupplierRequestBodySchema = z.object({}).optional() + + const getClimateSuppliersSupplierResponseBodyValidator = + responseValidationFactory([["200", s_climate_supplier]], s_error) + + // getClimateSuppliersSupplier + router.get( + `/v1/climate/suppliers/:supplier`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getClimateSuppliersSupplierParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getClimateSuppliersSupplierQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getClimateSuppliersSupplierRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getClimateSuppliersSupplier(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getClimateSuppliersSupplierResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getConfirmationTokensConfirmationTokenParamSchema = z.object({ + confirmation_token: z.string().max(5000), + }) + + const getConfirmationTokensConfirmationTokenQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getConfirmationTokensConfirmationTokenRequestBodySchema = z + .object({}) + .optional() + + const getConfirmationTokensConfirmationTokenResponseBodyValidator = + responseValidationFactory([["200", s_confirmation_token]], s_error) + + // getConfirmationTokensConfirmationToken + router.get( + `/v1/confirmation_tokens/:confirmation_token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getConfirmationTokensConfirmationTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getConfirmationTokensConfirmationTokenQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getConfirmationTokensConfirmationTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getConfirmationTokensConfirmationToken( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getConfirmationTokensConfirmationTokenResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCountrySpecsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCountrySpecsRequestBodySchema = z.object({}).optional() + + const getCountrySpecsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_country_spec), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/country_specs")), + }), + ], + ], + s_error, + ) + + // getCountrySpecs + router.get( + `/v1/country_specs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getCountrySpecsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCountrySpecsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_country_spec[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCountrySpecs(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCountrySpecsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCountrySpecsCountryParamSchema = z.object({ + country: z.string().max(5000), + }) + + const getCountrySpecsCountryQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCountrySpecsCountryRequestBodySchema = z.object({}).optional() + + const getCountrySpecsCountryResponseBodyValidator = responseValidationFactory( + [["200", s_country_spec]], + s_error, + ) + + // getCountrySpecsCountry + router.get( + `/v1/country_specs/:country`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCountrySpecsCountryParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCountrySpecsCountryQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCountrySpecsCountryRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCountrySpecsCountry(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCountrySpecsCountryResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCouponsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCouponsRequestBodySchema = z.object({}).optional() + + const getCouponsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_coupon), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/coupons")), + }), + ], + ], + s_error, + ) + + // getCoupons + router.get( + `/v1/coupons`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getCouponsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCouponsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_coupon[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCoupons(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCouponsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCouponsRequestBodySchema = z + .object({ + amount_off: z.coerce.number().optional(), + applies_to: z + .object({ products: z.array(z.string().max(5000)).optional() }) + .optional(), + currency: z.string().optional(), + currency_options: z + .record(z.object({ amount_off: z.coerce.number() })) + .optional(), + duration: z.enum(["forever", "once", "repeating"]).optional(), + duration_in_months: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + id: z.string().max(5000).optional(), + max_redemptions: z.coerce.number().optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(40).optional(), + percent_off: z.coerce.number().optional(), + redeem_by: z.coerce.number().optional(), + }) + .optional() + + const postCouponsResponseBodyValidator = responseValidationFactory( + [["200", s_coupon]], + s_error, + ) + + // postCoupons + router.post( + `/v1/coupons`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postCouponsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCoupons(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCouponsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCouponsCouponParamSchema = z.object({ + coupon: z.string().max(5000), + }) + + const deleteCouponsCouponRequestBodySchema = z.object({}).optional() + + const deleteCouponsCouponResponseBodyValidator = responseValidationFactory( + [["200", s_deleted_coupon]], + s_error, + ) + + // deleteCouponsCoupon + router.delete( + `/v1/coupons/:coupon`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCouponsCouponParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCouponsCouponRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCouponsCoupon(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteCouponsCouponResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCouponsCouponParamSchema = z.object({ coupon: z.string().max(5000) }) + + const getCouponsCouponQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCouponsCouponRequestBodySchema = z.object({}).optional() + + const getCouponsCouponResponseBodyValidator = responseValidationFactory( + [["200", s_coupon]], + s_error, + ) + + // getCouponsCoupon + router.get( + `/v1/coupons/:coupon`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCouponsCouponParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCouponsCouponQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCouponsCouponRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCouponsCoupon(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCouponsCouponResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCouponsCouponParamSchema = z.object({ + coupon: z.string().max(5000), + }) + + const postCouponsCouponRequestBodySchema = z + .object({ + currency_options: z + .record(z.object({ amount_off: z.coerce.number() })) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(40).optional(), + }) + .optional() + + const postCouponsCouponResponseBodyValidator = responseValidationFactory( + [["200", s_coupon]], + s_error, + ) + + // postCouponsCoupon + router.post( + `/v1/coupons/:coupon`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCouponsCouponParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCouponsCouponRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCouponsCoupon(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCouponsCouponResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCreditNotesQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + invoice: z.string().max(5000).optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCreditNotesRequestBodySchema = z.object({}).optional() + + const getCreditNotesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_credit_note)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCreditNotes + router.get( + `/v1/credit_notes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getCreditNotesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCreditNotesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_credit_note[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCreditNotes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCreditNotesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCreditNotesRequestBodySchema = z.object({ + amount: z.coerce.number().optional(), + credit_amount: z.coerce.number().optional(), + effective_at: z.coerce.number().optional(), + email_type: z.enum(["credit_note", "none"]).optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice: z.string().max(5000), + lines: z + .array( + z.object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + invoice_line_item: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + tax_amounts: z + .union([ + z.array( + z.object({ + amount: z.coerce.number(), + tax_rate: z.string().max(5000), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + type: z.enum(["custom_line_item", "invoice_line_item"]), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ) + .optional(), + memo: z.string().max(5000).optional(), + metadata: z.record(z.string()).optional(), + out_of_band_amount: z.coerce.number().optional(), + reason: z + .enum([ + "duplicate", + "fraudulent", + "order_change", + "product_unsatisfactory", + ]) + .optional(), + refund_amount: z.coerce.number().optional(), + refunds: z + .array( + z.object({ + amount_refunded: z.coerce.number().optional(), + refund: z.string().optional(), + }), + ) + .optional(), + shipping_cost: z + .object({ shipping_rate: z.string().max(5000).optional() }) + .optional(), + }) + + const postCreditNotesResponseBodyValidator = responseValidationFactory( + [["200", s_credit_note]], + s_error, + ) + + // postCreditNotes + router.post( + `/v1/credit_notes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postCreditNotesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCreditNotes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCreditNotesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCreditNotesPreviewQuerySchema = z.object({ + amount: z.coerce.number().optional(), + credit_amount: z.coerce.number().optional(), + effective_at: z.coerce.number().optional(), + email_type: z.enum(["credit_note", "none"]).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + invoice: z.string().max(5000), + lines: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + invoice_line_item: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + tax_amounts: z + .union([ + z.array( + z.object({ + amount: z.coerce.number(), + tax_rate: z.string().max(5000), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + type: z.enum(["custom_line_item", "invoice_line_item"]), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ), + ) + .optional(), + memo: z.string().max(5000).optional(), + metadata: z.record(z.string()).optional(), + out_of_band_amount: z.coerce.number().optional(), + reason: z + .enum([ + "duplicate", + "fraudulent", + "order_change", + "product_unsatisfactory", + ]) + .optional(), + refund_amount: z.coerce.number().optional(), + refunds: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + amount_refunded: z.coerce.number().optional(), + refund: z.string().optional(), + }), + ), + ) + .optional(), + shipping_cost: z + .object({ shipping_rate: z.string().max(5000).optional() }) + .optional(), + }) + + const getCreditNotesPreviewRequestBodySchema = z.object({}).optional() + + const getCreditNotesPreviewResponseBodyValidator = responseValidationFactory( + [["200", s_credit_note]], + s_error, + ) + + // getCreditNotesPreview + router.get( + `/v1/credit_notes/preview`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getCreditNotesPreviewQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCreditNotesPreviewRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCreditNotesPreview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCreditNotesPreviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCreditNotesPreviewLinesQuerySchema = z.object({ + amount: z.coerce.number().optional(), + credit_amount: z.coerce.number().optional(), + effective_at: z.coerce.number().optional(), + email_type: z.enum(["credit_note", "none"]).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + invoice: z.string().max(5000), + limit: z.coerce.number().optional(), + lines: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + invoice_line_item: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + tax_amounts: z + .union([ + z.array( + z.object({ + amount: z.coerce.number(), + tax_rate: z.string().max(5000), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + type: z.enum(["custom_line_item", "invoice_line_item"]), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ), + ) + .optional(), + memo: z.string().max(5000).optional(), + metadata: z.record(z.string()).optional(), + out_of_band_amount: z.coerce.number().optional(), + reason: z + .enum([ + "duplicate", + "fraudulent", + "order_change", + "product_unsatisfactory", + ]) + .optional(), + refund_amount: z.coerce.number().optional(), + refunds: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array( + z.object({ + amount_refunded: z.coerce.number().optional(), + refund: z.string().optional(), + }), + ), + ) + .optional(), + shipping_cost: z + .object({ shipping_rate: z.string().max(5000).optional() }) + .optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCreditNotesPreviewLinesRequestBodySchema = z.object({}).optional() + + const getCreditNotesPreviewLinesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_credit_note_line_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCreditNotesPreviewLines + router.get( + `/v1/credit_notes/preview/lines`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getCreditNotesPreviewLinesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCreditNotesPreviewLinesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_credit_note_line_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCreditNotesPreviewLines(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCreditNotesPreviewLinesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCreditNotesCreditNoteLinesParamSchema = z.object({ + credit_note: z.string().max(5000), + }) + + const getCreditNotesCreditNoteLinesQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCreditNotesCreditNoteLinesRequestBodySchema = z.object({}).optional() + + const getCreditNotesCreditNoteLinesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_credit_note_line_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCreditNotesCreditNoteLines + router.get( + `/v1/credit_notes/:credit_note/lines`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCreditNotesCreditNoteLinesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCreditNotesCreditNoteLinesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCreditNotesCreditNoteLinesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_credit_note_line_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCreditNotesCreditNoteLines(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCreditNotesCreditNoteLinesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCreditNotesIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getCreditNotesIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCreditNotesIdRequestBodySchema = z.object({}).optional() + + const getCreditNotesIdResponseBodyValidator = responseValidationFactory( + [["200", s_credit_note]], + s_error, + ) + + // getCreditNotesId + router.get( + `/v1/credit_notes/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCreditNotesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCreditNotesIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCreditNotesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCreditNotesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCreditNotesIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCreditNotesIdParamSchema = z.object({ id: z.string().max(5000) }) + + const postCreditNotesIdRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + memo: z.string().max(5000).optional(), + metadata: z.record(z.string()).optional(), + }) + .optional() + + const postCreditNotesIdResponseBodyValidator = responseValidationFactory( + [["200", s_credit_note]], + s_error, + ) + + // postCreditNotesId + router.post( + `/v1/credit_notes/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCreditNotesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCreditNotesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCreditNotesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCreditNotesIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCreditNotesIdVoidParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postCreditNotesIdVoidRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postCreditNotesIdVoidResponseBodyValidator = responseValidationFactory( + [["200", s_credit_note]], + s_error, + ) + + // postCreditNotesIdVoid + router.post( + `/v1/credit_notes/:id/void`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCreditNotesIdVoidParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCreditNotesIdVoidRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCreditNotesIdVoid(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCreditNotesIdVoidResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomerSessionsRequestBodySchema = z.object({ + components: z.object({ + buy_button: z.object({ enabled: PermissiveBoolean }).optional(), + payment_element: z + .object({ + enabled: PermissiveBoolean, + features: z + .object({ + payment_method_allow_redisplay_filters: z + .array(z.enum(["always", "limited", "unspecified"])) + .optional(), + payment_method_redisplay: z + .enum(["disabled", "enabled"]) + .optional(), + payment_method_redisplay_limit: z.coerce.number().optional(), + payment_method_remove: z.enum(["disabled", "enabled"]).optional(), + payment_method_save: z.enum(["disabled", "enabled"]).optional(), + payment_method_save_usage: z + .enum(["off_session", "on_session"]) + .optional(), + }) + .optional(), + }) + .optional(), + pricing_table: z.object({ enabled: PermissiveBoolean }).optional(), + }), + customer: z.string().max(5000), + expand: z.array(z.string().max(5000)).optional(), + }) + + const postCustomerSessionsResponseBodyValidator = responseValidationFactory( + [["200", s_customer_session]], + s_error, + ) + + // postCustomerSessions + router.post( + `/v1/customer_sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postCustomerSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomerSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCustomerSessionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + email: z.string().max(512).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + test_clock: z.string().max(5000).optional(), + }) + + const getCustomersRequestBodySchema = z.object({}).optional() + + const getCustomersResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_customer)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/customers")), + }), + ], + ], + s_error, + ) + + // getCustomers + router.get( + `/v1/customers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getCustomersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_customer[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCustomersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersRequestBodySchema = z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + balance: z.coerce.number().optional(), + cash_balance: z + .object({ + settings: z + .object({ + reconciliation_mode: z + .enum(["automatic", "manual", "merchant_default"]) + .optional(), + }) + .optional(), + }) + .optional(), + description: z.string().max(5000).optional(), + email: z.string().max(512).optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice_prefix: z.string().max(5000).optional(), + invoice_settings: z + .object({ + custom_fields: z + .union([ + z.array( + z.object({ + name: z.string().max(40), + value: z.string().max(140), + }), + ), + z.enum([""]), + ]) + .optional(), + default_payment_method: z.string().max(5000).optional(), + footer: z.string().max(5000).optional(), + rendering_options: z + .union([ + z.object({ + amount_tax_display: z + .enum(["", "exclude_tax", "include_inclusive_tax"]) + .optional(), + template: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(256).optional(), + next_invoice_sequence: z.coerce.number().optional(), + payment_method: z.string().max(5000).optional(), + phone: z.string().max(20).optional(), + preferred_locales: z.array(z.string().max(5000)).optional(), + shipping: z + .union([ + z.object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + source: z.string().max(5000).optional(), + tax: z + .object({ + ip_address: z.union([z.string(), z.enum([""])]).optional(), + validate_location: z.enum(["deferred", "immediately"]).optional(), + }) + .optional(), + tax_exempt: z.enum(["", "exempt", "none", "reverse"]).optional(), + tax_id_data: z + .array( + z.object({ + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string(), + }), + ) + .optional(), + test_clock: z.string().max(5000).optional(), + }) + .optional() + + const postCustomersResponseBodyValidator = responseValidationFactory( + [["200", s_customer]], + s_error, + ) + + // postCustomers + router.post( + `/v1/customers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postCustomersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCustomersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersSearchQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + page: z.string().max(5000).optional(), + query: z.string().max(5000), + }) + + const getCustomersSearchRequestBodySchema = z.object({}).optional() + + const getCustomersSearchResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_customer)), + has_more: PermissiveBoolean, + next_page: z.string().max(5000).nullable().optional(), + object: z.enum(["search_result"]), + total_count: z.coerce.number().optional(), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersSearch + router.get( + `/v1/customers/search`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getCustomersSearchQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersSearchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_customer[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersSearch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCustomersSearchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCustomersCustomerParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const deleteCustomersCustomerRequestBodySchema = z.object({}).optional() + + const deleteCustomersCustomerResponseBodyValidator = + responseValidationFactory([["200", s_deleted_customer]], s_error) + + // deleteCustomersCustomer + router.delete( + `/v1/customers/:customer`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCustomersCustomerParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCustomersCustomerRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCustomersCustomer(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteCustomersCustomerResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerRequestBodySchema = z.object({}).optional() + + const getCustomersCustomerResponseBodyValidator = responseValidationFactory( + [["200", z.union([z.lazy(() => s_customer), s_deleted_customer])]], + s_error, + ) + + // getCustomersCustomer + router.get( + `/v1/customers/:customer`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomer(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCustomersCustomerResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerRequestBodySchema = z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + balance: z.coerce.number().optional(), + bank_account: z + .union([ + z.object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000), + country: z.string().max(5000), + currency: z.string().optional(), + object: z.enum(["bank_account"]).optional(), + routing_number: z.string().max(5000).optional(), + }), + z.string().max(5000), + ]) + .optional(), + card: z + .union([ + z.object({ + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + cvc: z.string().max(5000).optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000).optional(), + number: z.string().max(5000), + object: z.enum(["card"]).optional(), + }), + z.string().max(5000), + ]) + .optional(), + cash_balance: z + .object({ + settings: z + .object({ + reconciliation_mode: z + .enum(["automatic", "manual", "merchant_default"]) + .optional(), + }) + .optional(), + }) + .optional(), + default_alipay_account: z.string().max(500).optional(), + default_bank_account: z.string().max(500).optional(), + default_card: z.string().max(500).optional(), + default_source: z.string().max(500).optional(), + description: z.string().max(5000).optional(), + email: z.string().max(512).optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice_prefix: z.string().max(5000).optional(), + invoice_settings: z + .object({ + custom_fields: z + .union([ + z.array( + z.object({ + name: z.string().max(40), + value: z.string().max(140), + }), + ), + z.enum([""]), + ]) + .optional(), + default_payment_method: z.string().max(5000).optional(), + footer: z.string().max(5000).optional(), + rendering_options: z + .union([ + z.object({ + amount_tax_display: z + .enum(["", "exclude_tax", "include_inclusive_tax"]) + .optional(), + template: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(256).optional(), + next_invoice_sequence: z.coerce.number().optional(), + phone: z.string().max(20).optional(), + preferred_locales: z.array(z.string().max(5000)).optional(), + shipping: z + .union([ + z.object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + source: z.string().max(5000).optional(), + tax: z + .object({ + ip_address: z.union([z.string(), z.enum([""])]).optional(), + validate_location: z + .enum(["auto", "deferred", "immediately"]) + .optional(), + }) + .optional(), + tax_exempt: z.enum(["", "exempt", "none", "reverse"]).optional(), + }) + .optional() + + const postCustomersCustomerResponseBodyValidator = responseValidationFactory( + [["200", s_customer]], + s_error, + ) + + // postCustomersCustomer + router.post( + `/v1/customers/:customer`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomer(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postCustomersCustomerResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerBalanceTransactionsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerBalanceTransactionsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCustomersCustomerBalanceTransactionsRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerBalanceTransactionsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_customer_balance_transaction)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersCustomerBalanceTransactions + router.get( + `/v1/customers/:customer/balance_transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerBalanceTransactionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerBalanceTransactionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerBalanceTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_customer_balance_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerBalanceTransactions( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerBalanceTransactionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerBalanceTransactionsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerBalanceTransactionsRequestBodySchema = z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(350).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + + const postCustomersCustomerBalanceTransactionsResponseBodyValidator = + responseValidationFactory( + [["200", s_customer_balance_transaction]], + s_error, + ) + + // postCustomersCustomerBalanceTransactions + router.post( + `/v1/customers/:customer/balance_transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerBalanceTransactionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerBalanceTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerBalanceTransactions( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerBalanceTransactionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerBalanceTransactionsTransactionParamSchema = + z.object({ customer: z.string().max(5000), transaction: z.string() }) + + const getCustomersCustomerBalanceTransactionsTransactionQuerySchema = + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerBalanceTransactionsTransactionRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerBalanceTransactionsTransactionResponseBodyValidator = + responseValidationFactory( + [["200", s_customer_balance_transaction]], + s_error, + ) + + // getCustomersCustomerBalanceTransactionsTransaction + router.get( + `/v1/customers/:customer/balance_transactions/:transaction`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerBalanceTransactionsTransactionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerBalanceTransactionsTransactionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerBalanceTransactionsTransactionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerBalanceTransactionsTransaction( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerBalanceTransactionsTransactionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerBalanceTransactionsTransactionParamSchema = + z.object({ + customer: z.string().max(5000), + transaction: z.string().max(5000), + }) + + const postCustomersCustomerBalanceTransactionsTransactionRequestBodySchema = z + .object({ + description: z.string().max(350).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postCustomersCustomerBalanceTransactionsTransactionResponseBodyValidator = + responseValidationFactory( + [["200", s_customer_balance_transaction]], + s_error, + ) + + // postCustomersCustomerBalanceTransactionsTransaction + router.post( + `/v1/customers/:customer/balance_transactions/:transaction`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerBalanceTransactionsTransactionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerBalanceTransactionsTransactionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerBalanceTransactionsTransaction( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerBalanceTransactionsTransactionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerBankAccountsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerBankAccountsQuerySchema = z.object({ + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().optional(), + }) + + const getCustomersCustomerBankAccountsRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerBankAccountsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_bank_account)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersCustomerBankAccounts + router.get( + `/v1/customers/:customer/bank_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerBankAccountsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerBankAccountsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerBankAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_bank_account[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerBankAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerBankAccountsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerBankAccountsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerBankAccountsRequestBodySchema = z + .object({ + alipay_account: z.string().max(5000).optional(), + bank_account: z + .union([ + z.object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000), + country: z.string().max(5000), + currency: z.string().optional(), + object: z.enum(["bank_account"]).optional(), + routing_number: z.string().max(5000).optional(), + }), + z.string().max(5000), + ]) + .optional(), + card: z + .union([ + z.object({ + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + cvc: z.string().max(5000).optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000).optional(), + number: z.string().max(5000), + object: z.enum(["card"]).optional(), + }), + z.string().max(5000), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + source: z.string().max(5000).optional(), + }) + .optional() + + const postCustomersCustomerBankAccountsResponseBodyValidator = + responseValidationFactory([["200", s_payment_source]], s_error) + + // postCustomersCustomerBankAccounts + router.post( + `/v1/customers/:customer/bank_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerBankAccountsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerBankAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerBankAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerBankAccountsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCustomersCustomerBankAccountsIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string(), + }) + + const deleteCustomersCustomerBankAccountsIdRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const deleteCustomersCustomerBankAccountsIdResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([z.lazy(() => s_payment_source), s_deleted_payment_source]), + ], + ], + s_error, + ) + + // deleteCustomersCustomerBankAccountsId + router.delete( + `/v1/customers/:customer/bank_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCustomersCustomerBankAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCustomersCustomerBankAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_payment_source | t_deleted_payment_source + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCustomersCustomerBankAccountsId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteCustomersCustomerBankAccountsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerBankAccountsIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string().max(5000), + }) + + const getCustomersCustomerBankAccountsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerBankAccountsIdRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerBankAccountsIdResponseBodyValidator = + responseValidationFactory([["200", s_bank_account]], s_error) + + // getCustomersCustomerBankAccountsId + router.get( + `/v1/customers/:customer/bank_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerBankAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerBankAccountsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerBankAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerBankAccountsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerBankAccountsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerBankAccountsIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string().max(5000), + }) + + const postCustomersCustomerBankAccountsIdRequestBodySchema = z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + exp_month: z.string().max(5000).optional(), + exp_year: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(5000).optional(), + owner: z + .object({ + address: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + email: z.string().optional(), + name: z.string().max(5000).optional(), + phone: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional() + + const postCustomersCustomerBankAccountsIdResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([ + z.lazy(() => s_card), + z.lazy(() => s_bank_account), + s_source, + ]), + ], + ], + s_error, + ) + + // postCustomersCustomerBankAccountsId + router.post( + `/v1/customers/:customer/bank_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerBankAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerBankAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_card | t_bank_account | t_source + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerBankAccountsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerBankAccountsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerBankAccountsIdVerifyParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string().max(5000), + }) + + const postCustomersCustomerBankAccountsIdVerifyRequestBodySchema = z + .object({ + amounts: z.array(z.coerce.number()).optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postCustomersCustomerBankAccountsIdVerifyResponseBodyValidator = + responseValidationFactory([["200", s_bank_account]], s_error) + + // postCustomersCustomerBankAccountsIdVerify + router.post( + `/v1/customers/:customer/bank_accounts/:id/verify`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerBankAccountsIdVerifyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerBankAccountsIdVerifyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerBankAccountsIdVerify( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerBankAccountsIdVerifyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerCardsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerCardsQuerySchema = z.object({ + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().optional(), + }) + + const getCustomersCustomerCardsRequestBodySchema = z.object({}).optional() + + const getCustomersCustomerCardsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_card)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersCustomerCards + router.get( + `/v1/customers/:customer/cards`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerCardsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerCardsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerCardsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_card[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerCards(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getCustomersCustomerCardsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerCardsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerCardsRequestBodySchema = z + .object({ + alipay_account: z.string().max(5000).optional(), + bank_account: z + .union([ + z.object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000), + country: z.string().max(5000), + currency: z.string().optional(), + object: z.enum(["bank_account"]).optional(), + routing_number: z.string().max(5000).optional(), + }), + z.string().max(5000), + ]) + .optional(), + card: z + .union([ + z.object({ + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + cvc: z.string().max(5000).optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000).optional(), + number: z.string().max(5000), + object: z.enum(["card"]).optional(), + }), + z.string().max(5000), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + source: z.string().max(5000).optional(), + }) + .optional() + + const postCustomersCustomerCardsResponseBodyValidator = + responseValidationFactory([["200", s_payment_source]], s_error) + + // postCustomersCustomerCards + router.post( + `/v1/customers/:customer/cards`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerCardsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerCardsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerCards(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerCardsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCustomersCustomerCardsIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string(), + }) + + const deleteCustomersCustomerCardsIdRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const deleteCustomersCustomerCardsIdResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([z.lazy(() => s_payment_source), s_deleted_payment_source]), + ], + ], + s_error, + ) + + // deleteCustomersCustomerCardsId + router.delete( + `/v1/customers/:customer/cards/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCustomersCustomerCardsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCustomersCustomerCardsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_payment_source | t_deleted_payment_source + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCustomersCustomerCardsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteCustomersCustomerCardsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerCardsIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string().max(5000), + }) + + const getCustomersCustomerCardsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerCardsIdRequestBodySchema = z.object({}).optional() + + const getCustomersCustomerCardsIdResponseBodyValidator = + responseValidationFactory([["200", s_card]], s_error) + + // getCustomersCustomerCardsId + router.get( + `/v1/customers/:customer/cards/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerCardsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerCardsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerCardsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerCardsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerCardsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerCardsIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string().max(5000), + }) + + const postCustomersCustomerCardsIdRequestBodySchema = z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + exp_month: z.string().max(5000).optional(), + exp_year: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(5000).optional(), + owner: z + .object({ + address: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + email: z.string().optional(), + name: z.string().max(5000).optional(), + phone: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional() + + const postCustomersCustomerCardsIdResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([ + z.lazy(() => s_card), + z.lazy(() => s_bank_account), + s_source, + ]), + ], + ], + s_error, + ) + + // postCustomersCustomerCardsId + router.post( + `/v1/customers/:customer/cards/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerCardsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerCardsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_card | t_bank_account | t_source + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerCardsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerCardsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerCashBalanceParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerCashBalanceQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerCashBalanceRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerCashBalanceResponseBodyValidator = + responseValidationFactory([["200", s_cash_balance]], s_error) + + // getCustomersCustomerCashBalance + router.get( + `/v1/customers/:customer/cash_balance`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerCashBalanceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerCashBalanceQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerCashBalanceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerCashBalance(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerCashBalanceResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerCashBalanceParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerCashBalanceRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + settings: z + .object({ + reconciliation_mode: z + .enum(["automatic", "manual", "merchant_default"]) + .optional(), + }) + .optional(), + }) + .optional() + + const postCustomersCustomerCashBalanceResponseBodyValidator = + responseValidationFactory([["200", s_cash_balance]], s_error) + + // postCustomersCustomerCashBalance + router.post( + `/v1/customers/:customer/cash_balance`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerCashBalanceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerCashBalanceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerCashBalance(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerCashBalanceResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerCashBalanceTransactionsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerCashBalanceTransactionsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCustomersCustomerCashBalanceTransactionsRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerCashBalanceTransactionsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_customer_cash_balance_transaction)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersCustomerCashBalanceTransactions + router.get( + `/v1/customers/:customer/cash_balance_transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerCashBalanceTransactionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerCashBalanceTransactionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerCashBalanceTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_customer_cash_balance_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerCashBalanceTransactions( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerCashBalanceTransactionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerCashBalanceTransactionsTransactionParamSchema = + z.object({ customer: z.string().max(5000), transaction: z.string() }) + + const getCustomersCustomerCashBalanceTransactionsTransactionQuerySchema = + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerCashBalanceTransactionsTransactionRequestBodySchema = + z.object({}).optional() + + const getCustomersCustomerCashBalanceTransactionsTransactionResponseBodyValidator = + responseValidationFactory( + [["200", s_customer_cash_balance_transaction]], + s_error, + ) + + // getCustomersCustomerCashBalanceTransactionsTransaction + router.get( + `/v1/customers/:customer/cash_balance_transactions/:transaction`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerCashBalanceTransactionsTransactionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerCashBalanceTransactionsTransactionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerCashBalanceTransactionsTransactionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerCashBalanceTransactionsTransaction( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerCashBalanceTransactionsTransactionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCustomersCustomerDiscountParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const deleteCustomersCustomerDiscountRequestBodySchema = z + .object({}) + .optional() + + const deleteCustomersCustomerDiscountResponseBodyValidator = + responseValidationFactory([["200", s_deleted_discount]], s_error) + + // deleteCustomersCustomerDiscount + router.delete( + `/v1/customers/:customer/discount`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCustomersCustomerDiscountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCustomersCustomerDiscountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCustomersCustomerDiscount(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteCustomersCustomerDiscountResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerDiscountParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerDiscountQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerDiscountRequestBodySchema = z.object({}).optional() + + const getCustomersCustomerDiscountResponseBodyValidator = + responseValidationFactory([["200", s_discount]], s_error) + + // getCustomersCustomerDiscount + router.get( + `/v1/customers/:customer/discount`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerDiscountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerDiscountQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerDiscountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerDiscount(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerDiscountResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerFundingInstructionsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerFundingInstructionsRequestBodySchema = z.object({ + bank_transfer: z.object({ + eu_bank_transfer: z.object({ country: z.string().max(5000) }).optional(), + requested_address_types: z + .array(z.enum(["iban", "sort_code", "spei", "zengin"])) + .optional(), + type: z.enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]), + }), + currency: z.string(), + expand: z.array(z.string().max(5000)).optional(), + funding_type: z.enum(["bank_transfer"]), + }) + + const postCustomersCustomerFundingInstructionsResponseBodyValidator = + responseValidationFactory([["200", s_funding_instructions]], s_error) + + // postCustomersCustomerFundingInstructions + router.post( + `/v1/customers/:customer/funding_instructions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerFundingInstructionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerFundingInstructionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerFundingInstructions( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerFundingInstructionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerPaymentMethodsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerPaymentMethodsQuerySchema = z.object({ + allow_redisplay: z.enum(["always", "limited", "unspecified"]).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + type: z + .enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]) + .optional(), + }) + + const getCustomersCustomerPaymentMethodsRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerPaymentMethodsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_payment_method)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersCustomerPaymentMethods + router.get( + `/v1/customers/:customer/payment_methods`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerPaymentMethodsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerPaymentMethodsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerPaymentMethodsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_payment_method[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerPaymentMethods(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerPaymentMethodsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerPaymentMethodsPaymentMethodParamSchema = z.object({ + customer: z.string().max(5000), + payment_method: z.string().max(5000), + }) + + const getCustomersCustomerPaymentMethodsPaymentMethodQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerPaymentMethodsPaymentMethodRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerPaymentMethodsPaymentMethodResponseBodyValidator = + responseValidationFactory([["200", s_payment_method]], s_error) + + // getCustomersCustomerPaymentMethodsPaymentMethod + router.get( + `/v1/customers/:customer/payment_methods/:payment_method`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerPaymentMethodsPaymentMethodParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerPaymentMethodsPaymentMethodQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerPaymentMethodsPaymentMethodRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerPaymentMethodsPaymentMethod( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerPaymentMethodsPaymentMethodResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerSourcesParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerSourcesQuerySchema = z.object({ + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + object: z.string().max(5000).optional(), + starting_after: z.string().optional(), + }) + + const getCustomersCustomerSourcesRequestBodySchema = z.object({}).optional() + + const getCustomersCustomerSourcesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array( + z.union([ + z.lazy(() => s_bank_account), + z.lazy(() => s_card), + s_source, + ]), + ), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersCustomerSources + router.get( + `/v1/customers/:customer/sources`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerSourcesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerSourcesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerSourcesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: (t_bank_account | t_card | t_source)[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerSources(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerSourcesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerSourcesParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerSourcesRequestBodySchema = z + .object({ + alipay_account: z.string().max(5000).optional(), + bank_account: z + .union([ + z.object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000), + country: z.string().max(5000), + currency: z.string().optional(), + object: z.enum(["bank_account"]).optional(), + routing_number: z.string().max(5000).optional(), + }), + z.string().max(5000), + ]) + .optional(), + card: z + .union([ + z.object({ + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + cvc: z.string().max(5000).optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000).optional(), + number: z.string().max(5000), + object: z.enum(["card"]).optional(), + }), + z.string().max(5000), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + source: z.string().max(5000).optional(), + }) + .optional() + + const postCustomersCustomerSourcesResponseBodyValidator = + responseValidationFactory([["200", s_payment_source]], s_error) + + // postCustomersCustomerSources + router.post( + `/v1/customers/:customer/sources`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerSourcesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerSourcesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerSources(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerSourcesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCustomersCustomerSourcesIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string(), + }) + + const deleteCustomersCustomerSourcesIdRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const deleteCustomersCustomerSourcesIdResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([z.lazy(() => s_payment_source), s_deleted_payment_source]), + ], + ], + s_error, + ) + + // deleteCustomersCustomerSourcesId + router.delete( + `/v1/customers/:customer/sources/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCustomersCustomerSourcesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCustomersCustomerSourcesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_payment_source | t_deleted_payment_source + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCustomersCustomerSourcesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteCustomersCustomerSourcesIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerSourcesIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string().max(500), + }) + + const getCustomersCustomerSourcesIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerSourcesIdRequestBodySchema = z.object({}).optional() + + const getCustomersCustomerSourcesIdResponseBodyValidator = + responseValidationFactory([["200", s_payment_source]], s_error) + + // getCustomersCustomerSourcesId + router.get( + `/v1/customers/:customer/sources/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerSourcesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerSourcesIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerSourcesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerSourcesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerSourcesIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerSourcesIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string().max(5000), + }) + + const postCustomersCustomerSourcesIdRequestBodySchema = z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + exp_month: z.string().max(5000).optional(), + exp_year: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(5000).optional(), + owner: z + .object({ + address: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + email: z.string().optional(), + name: z.string().max(5000).optional(), + phone: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional() + + const postCustomersCustomerSourcesIdResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([ + z.lazy(() => s_card), + z.lazy(() => s_bank_account), + s_source, + ]), + ], + ], + s_error, + ) + + // postCustomersCustomerSourcesId + router.post( + `/v1/customers/:customer/sources/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerSourcesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerSourcesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_card | t_bank_account | t_source + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerSourcesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerSourcesIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerSourcesIdVerifyParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string().max(5000), + }) + + const postCustomersCustomerSourcesIdVerifyRequestBodySchema = z + .object({ + amounts: z.array(z.coerce.number()).optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postCustomersCustomerSourcesIdVerifyResponseBodyValidator = + responseValidationFactory([["200", s_bank_account]], s_error) + + // postCustomersCustomerSourcesIdVerify + router.post( + `/v1/customers/:customer/sources/:id/verify`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerSourcesIdVerifyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerSourcesIdVerifyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerSourcesIdVerify( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerSourcesIdVerifyResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerSubscriptionsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerSubscriptionsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCustomersCustomerSubscriptionsRequestBodySchema = z + .object({}) + .optional() + + const getCustomersCustomerSubscriptionsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_subscription)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersCustomerSubscriptions + router.get( + `/v1/customers/:customer/subscriptions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerSubscriptionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerSubscriptionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerSubscriptionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_subscription[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerSubscriptions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerSubscriptionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerSubscriptionsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerSubscriptionsRequestBodySchema = z + .object({ + add_invoice_items: z + .array( + z.object({ + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + application_fee_percent: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + backdate_start_date: z.coerce.number().optional(), + billing_cycle_anchor: z.coerce.number().optional(), + cancel_at: z.coerce.number().optional(), + cancel_at_period_end: PermissiveBoolean.optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + currency: z.string().optional(), + days_until_due: z.coerce.number().optional(), + default_payment_method: z.string().max(5000).optional(), + default_source: z.string().max(5000).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + items: z + .array( + z.object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + off_session: PermissiveBoolean.optional(), + payment_behavior: z + .enum([ + "allow_incomplete", + "default_incomplete", + "error_if_incomplete", + "pending_if_incomplete", + ]) + .optional(), + payment_settings: z + .object({ + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + transaction_type: z + .enum(["business", "personal"]) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z + .enum(["de", "en", "fr", "nl"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + mandate_options: z + .object({ + amount: z.coerce.number().optional(), + amount_type: z.enum(["fixed", "maximum"]).optional(), + description: z.string().max(200).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + type: z.string().optional(), + }) + .optional(), + funding_type: z.string().optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z.union([z.object({}), z.enum([""])]).optional(), + sepa_debit: z.union([z.object({}), z.enum([""])]).optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array( + z.enum(["balances", "ownership", "transactions"]), + ) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z + .union([ + z.array( + z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "jp_credit_transfer", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "multibanco", + "naver_pay", + "nz_bank_account", + "p24", + "payco", + "paynow", + "paypal", + "promptpay", + "revolut_pay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "swish", + "us_bank_account", + "wechat_pay", + ]), + ), + z.enum([""]), + ]) + .optional(), + save_default_payment_method: z + .enum(["off", "on_subscription"]) + .optional(), + }) + .optional(), + pending_invoice_item_interval: z + .union([ + z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + z.enum([""]), + ]) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + transfer_data: z + .object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }) + .optional(), + trial_end: z.union([z.enum(["now"]), z.coerce.number()]).optional(), + trial_from_plan: PermissiveBoolean.optional(), + trial_period_days: z.coerce.number().optional(), + trial_settings: z + .object({ + end_behavior: z.object({ + missing_payment_method: z.enum([ + "cancel", + "create_invoice", + "pause", + ]), + }), + }) + .optional(), + }) + .optional() + + const postCustomersCustomerSubscriptionsResponseBodyValidator = + responseValidationFactory([["200", s_subscription]], s_error) + + // postCustomersCustomerSubscriptions + router.post( + `/v1/customers/:customer/subscriptions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerSubscriptionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerSubscriptionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerSubscriptions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerSubscriptionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema = + z.object({ + customer: z.string().max(5000), + subscription_exposed_id: z.string().max(5000), + }) + + const deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema = + z + .object({ + expand: z.array(z.string().max(5000)).optional(), + invoice_now: PermissiveBoolean.optional(), + prorate: PermissiveBoolean.optional(), + }) + .optional() + + const deleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponseBodyValidator = + responseValidationFactory([["200", s_subscription]], s_error) + + // deleteCustomersCustomerSubscriptionsSubscriptionExposedId + router.delete( + `/v1/customers/:customer/subscriptions/:subscription_exposed_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCustomersCustomerSubscriptionsSubscriptionExposedId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteCustomersCustomerSubscriptionsSubscriptionExposedIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema = + z.object({ + customer: z.string().max(5000), + subscription_exposed_id: z.string().max(5000), + }) + + const getCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema = + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema = + z.object({}).optional() + + const getCustomersCustomerSubscriptionsSubscriptionExposedIdResponseBodyValidator = + responseValidationFactory([["200", s_subscription]], s_error) + + // getCustomersCustomerSubscriptionsSubscriptionExposedId + router.get( + `/v1/customers/:customer/subscriptions/:subscription_exposed_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerSubscriptionsSubscriptionExposedId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerSubscriptionsSubscriptionExposedIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema = + z.object({ + customer: z.string().max(5000), + subscription_exposed_id: z.string().max(5000), + }) + + const postCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema = + z + .object({ + add_invoice_items: z + .array( + z.object({ + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + application_fee_percent: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_cycle_anchor: z.enum(["now", "unchanged"]).optional(), + cancel_at: z.union([z.coerce.number(), z.enum([""])]).optional(), + cancel_at_period_end: PermissiveBoolean.optional(), + cancellation_details: z + .object({ + comment: z.union([z.string().max(5000), z.enum([""])]).optional(), + feedback: z + .enum([ + "", + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ]) + .optional(), + }) + .optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + days_until_due: z.coerce.number().optional(), + default_payment_method: z.string().max(5000).optional(), + default_source: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + items: z + .array( + z.object({ + clear_usage: PermissiveBoolean.optional(), + deleted: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + id: z.string().max(5000).optional(), + metadata: z + .union([z.record(z.string()), z.enum([""])]) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + off_session: PermissiveBoolean.optional(), + pause_collection: z + .union([ + z.object({ + behavior: z.enum(["keep_as_draft", "mark_uncollectible", "void"]), + resumes_at: z.coerce.number().optional(), + }), + z.enum([""]), + ]) + .optional(), + payment_behavior: z + .enum([ + "allow_incomplete", + "default_incomplete", + "error_if_incomplete", + "pending_if_incomplete", + ]) + .optional(), + payment_settings: z + .object({ + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + transaction_type: z + .enum(["business", "personal"]) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z + .enum(["de", "en", "fr", "nl"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + mandate_options: z + .object({ + amount: z.coerce.number().optional(), + amount_type: z.enum(["fixed", "maximum"]).optional(), + description: z.string().max(200).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + type: z.string().optional(), + }) + .optional(), + funding_type: z.string().optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z.union([z.object({}), z.enum([""])]).optional(), + sepa_debit: z.union([z.object({}), z.enum([""])]).optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array( + z.enum(["balances", "ownership", "transactions"]), + ) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z + .union([ + z.array( + z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "jp_credit_transfer", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "multibanco", + "naver_pay", + "nz_bank_account", + "p24", + "payco", + "paynow", + "paypal", + "promptpay", + "revolut_pay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "swish", + "us_bank_account", + "wechat_pay", + ]), + ), + z.enum([""]), + ]) + .optional(), + save_default_payment_method: z + .enum(["off", "on_subscription"]) + .optional(), + }) + .optional(), + pending_invoice_item_interval: z + .union([ + z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + z.enum([""]), + ]) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + proration_date: z.coerce.number().optional(), + transfer_data: z + .union([ + z.object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }), + z.enum([""]), + ]) + .optional(), + trial_end: z.union([z.enum(["now"]), z.coerce.number()]).optional(), + trial_from_plan: PermissiveBoolean.optional(), + trial_settings: z + .object({ + end_behavior: z.object({ + missing_payment_method: z.enum([ + "cancel", + "create_invoice", + "pause", + ]), + }), + }) + .optional(), + }) + .optional() + + const postCustomersCustomerSubscriptionsSubscriptionExposedIdResponseBodyValidator = + responseValidationFactory([["200", s_subscription]], s_error) + + // postCustomersCustomerSubscriptionsSubscriptionExposedId + router.post( + `/v1/customers/:customer/subscriptions/:subscription_exposed_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerSubscriptionsSubscriptionExposedId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerSubscriptionsSubscriptionExposedIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema = + z.object({ + customer: z.string().max(5000), + subscription_exposed_id: z.string().max(5000), + }) + + const deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema = + z.object({}).optional() + + const deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountResponseBodyValidator = + responseValidationFactory([["200", s_deleted_discount]], s_error) + + // deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount + router.delete( + `/v1/customers/:customer/subscriptions/:subscription_exposed_id/discount`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema = + z.object({ + customer: z.string().max(5000), + subscription_exposed_id: z.string().max(5000), + }) + + const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema = + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema = + z.object({}).optional() + + const getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountResponseBodyValidator = + responseValidationFactory([["200", s_discount]], s_error) + + // getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount + router.get( + `/v1/customers/:customer/subscriptions/:subscription_exposed_id/discount`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerTaxIdsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const getCustomersCustomerTaxIdsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getCustomersCustomerTaxIdsRequestBodySchema = z.object({}).optional() + + const getCustomersCustomerTaxIdsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_tax_id)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getCustomersCustomerTaxIds + router.get( + `/v1/customers/:customer/tax_ids`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerTaxIdsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerTaxIdsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerTaxIdsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_tax_id[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerTaxIds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerTaxIdsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postCustomersCustomerTaxIdsParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postCustomersCustomerTaxIdsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string(), + }) + + const postCustomersCustomerTaxIdsResponseBodyValidator = + responseValidationFactory([["200", s_tax_id]], s_error) + + // postCustomersCustomerTaxIds + router.post( + `/v1/customers/:customer/tax_ids`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postCustomersCustomerTaxIdsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postCustomersCustomerTaxIdsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postCustomersCustomerTaxIds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postCustomersCustomerTaxIdsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteCustomersCustomerTaxIdsIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string(), + }) + + const deleteCustomersCustomerTaxIdsIdRequestBodySchema = z + .object({}) + .optional() + + const deleteCustomersCustomerTaxIdsIdResponseBodyValidator = + responseValidationFactory([["200", s_deleted_tax_id]], s_error) + + // deleteCustomersCustomerTaxIdsId + router.delete( + `/v1/customers/:customer/tax_ids/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteCustomersCustomerTaxIdsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteCustomersCustomerTaxIdsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteCustomersCustomerTaxIdsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteCustomersCustomerTaxIdsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getCustomersCustomerTaxIdsIdParamSchema = z.object({ + customer: z.string().max(5000), + id: z.string(), + }) + + const getCustomersCustomerTaxIdsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getCustomersCustomerTaxIdsIdRequestBodySchema = z.object({}).optional() + + const getCustomersCustomerTaxIdsIdResponseBodyValidator = + responseValidationFactory([["200", s_tax_id]], s_error) + + // getCustomersCustomerTaxIdsId + router.get( + `/v1/customers/:customer/tax_ids/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getCustomersCustomerTaxIdsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getCustomersCustomerTaxIdsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getCustomersCustomerTaxIdsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getCustomersCustomerTaxIdsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getCustomersCustomerTaxIdsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getDisputesQuerySchema = z.object({ + charge: z.string().max(5000).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + payment_intent: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getDisputesRequestBodySchema = z.object({}).optional() + + const getDisputesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_dispute)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/disputes")), + }), + ], + ], + s_error, + ) + + // getDisputes + router.get( + `/v1/disputes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getDisputesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getDisputesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_dispute[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getDisputes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getDisputesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getDisputesDisputeParamSchema = z.object({ + dispute: z.string().max(5000), + }) + + const getDisputesDisputeQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getDisputesDisputeRequestBodySchema = z.object({}).optional() + + const getDisputesDisputeResponseBodyValidator = responseValidationFactory( + [["200", s_dispute]], + s_error, + ) + + // getDisputesDispute + router.get( + `/v1/disputes/:dispute`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getDisputesDisputeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getDisputesDisputeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getDisputesDisputeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getDisputesDispute(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getDisputesDisputeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postDisputesDisputeParamSchema = z.object({ + dispute: z.string().max(5000), + }) + + const postDisputesDisputeRequestBodySchema = z + .object({ + evidence: z + .object({ + access_activity_log: z.string().max(20000).optional(), + billing_address: z.string().max(5000).optional(), + cancellation_policy: z.string().optional(), + cancellation_policy_disclosure: z.string().max(20000).optional(), + cancellation_rebuttal: z.string().max(20000).optional(), + customer_communication: z.string().optional(), + customer_email_address: z.string().max(5000).optional(), + customer_name: z.string().max(5000).optional(), + customer_purchase_ip: z.string().max(5000).optional(), + customer_signature: z.string().optional(), + duplicate_charge_documentation: z.string().optional(), + duplicate_charge_explanation: z.string().max(20000).optional(), + duplicate_charge_id: z.string().max(5000).optional(), + enhanced_evidence: z + .union([ + z.object({ + visa_compelling_evidence_3: z + .object({ + disputed_transaction: z + .object({ + customer_account_id: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_device_fingerprint: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_device_id: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_email_address: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_purchase_ip: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + merchandise_or_services: z + .enum(["merchandise", "services"]) + .optional(), + product_description: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + shipping_address: z + .object({ + city: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + country: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + line1: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + line2: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + postal_code: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + state: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + prior_undisputed_transactions: z + .array( + z.object({ + charge: z.string().max(5000), + customer_account_id: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_device_fingerprint: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_device_id: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_email_address: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + customer_purchase_ip: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + shipping_address: z + .object({ + city: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + country: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + line1: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + line2: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + postal_code: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + state: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }), + ) + .optional(), + }) + .optional(), + visa_compliance: z + .object({ fee_acknowledged: PermissiveBoolean.optional() }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + product_description: z.string().max(20000).optional(), + receipt: z.string().optional(), + refund_policy: z.string().optional(), + refund_policy_disclosure: z.string().max(20000).optional(), + refund_refusal_explanation: z.string().max(20000).optional(), + service_date: z.string().max(5000).optional(), + service_documentation: z.string().optional(), + shipping_address: z.string().max(5000).optional(), + shipping_carrier: z.string().max(5000).optional(), + shipping_date: z.string().max(5000).optional(), + shipping_documentation: z.string().optional(), + shipping_tracking_number: z.string().max(5000).optional(), + uncategorized_file: z.string().optional(), + uncategorized_text: z.string().max(20000).optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + submit: PermissiveBoolean.optional(), + }) + .optional() + + const postDisputesDisputeResponseBodyValidator = responseValidationFactory( + [["200", s_dispute]], + s_error, + ) + + // postDisputesDispute + router.post( + `/v1/disputes/:dispute`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postDisputesDisputeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postDisputesDisputeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postDisputesDispute(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postDisputesDisputeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postDisputesDisputeCloseParamSchema = z.object({ + dispute: z.string().max(5000), + }) + + const postDisputesDisputeCloseRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postDisputesDisputeCloseResponseBodyValidator = + responseValidationFactory([["200", s_dispute]], s_error) + + // postDisputesDisputeClose + router.post( + `/v1/disputes/:dispute/close`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postDisputesDisputeCloseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postDisputesDisputeCloseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postDisputesDisputeClose(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postDisputesDisputeCloseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getEntitlementsActiveEntitlementsQuerySchema = z.object({ + customer: z.string().max(5000), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getEntitlementsActiveEntitlementsRequestBodySchema = z + .object({}) + .optional() + + const getEntitlementsActiveEntitlementsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_entitlements_active_entitlement), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getEntitlementsActiveEntitlements + router.get( + `/v1/entitlements/active_entitlements`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getEntitlementsActiveEntitlementsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getEntitlementsActiveEntitlementsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_entitlements_active_entitlement[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEntitlementsActiveEntitlements(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getEntitlementsActiveEntitlementsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getEntitlementsActiveEntitlementsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getEntitlementsActiveEntitlementsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getEntitlementsActiveEntitlementsIdRequestBodySchema = z + .object({}) + .optional() + + const getEntitlementsActiveEntitlementsIdResponseBodyValidator = + responseValidationFactory( + [["200", s_entitlements_active_entitlement]], + s_error, + ) + + // getEntitlementsActiveEntitlementsId + router.get( + `/v1/entitlements/active_entitlements/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getEntitlementsActiveEntitlementsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getEntitlementsActiveEntitlementsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getEntitlementsActiveEntitlementsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEntitlementsActiveEntitlementsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getEntitlementsActiveEntitlementsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getEntitlementsFeaturesQuerySchema = z.object({ + archived: PermissiveBoolean.optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + lookup_key: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getEntitlementsFeaturesRequestBodySchema = z.object({}).optional() + + const getEntitlementsFeaturesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_entitlements_feature), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/entitlements/features")), + }), + ], + ], + s_error, + ) + + // getEntitlementsFeatures + router.get( + `/v1/entitlements/features`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getEntitlementsFeaturesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getEntitlementsFeaturesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_entitlements_feature[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEntitlementsFeatures(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getEntitlementsFeaturesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postEntitlementsFeaturesRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + lookup_key: z.string().max(80), + metadata: z.record(z.string()).optional(), + name: z.string().max(80), + }) + + const postEntitlementsFeaturesResponseBodyValidator = + responseValidationFactory([["200", s_entitlements_feature]], s_error) + + // postEntitlementsFeatures + router.post( + `/v1/entitlements/features`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postEntitlementsFeaturesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postEntitlementsFeatures(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postEntitlementsFeaturesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getEntitlementsFeaturesIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getEntitlementsFeaturesIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getEntitlementsFeaturesIdRequestBodySchema = z.object({}).optional() + + const getEntitlementsFeaturesIdResponseBodyValidator = + responseValidationFactory([["200", s_entitlements_feature]], s_error) + + // getEntitlementsFeaturesId + router.get( + `/v1/entitlements/features/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getEntitlementsFeaturesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getEntitlementsFeaturesIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getEntitlementsFeaturesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEntitlementsFeaturesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getEntitlementsFeaturesIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postEntitlementsFeaturesIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postEntitlementsFeaturesIdRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(80).optional(), + }) + .optional() + + const postEntitlementsFeaturesIdResponseBodyValidator = + responseValidationFactory([["200", s_entitlements_feature]], s_error) + + // postEntitlementsFeaturesId + router.post( + `/v1/entitlements/features/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postEntitlementsFeaturesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postEntitlementsFeaturesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postEntitlementsFeaturesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postEntitlementsFeaturesIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postEphemeralKeysRequestBodySchema = z + .object({ + customer: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + issuing_card: z.string().max(5000).optional(), + nonce: z.string().max(5000).optional(), + verification_session: z.string().max(5000).optional(), + }) + .optional() + + const postEphemeralKeysResponseBodyValidator = responseValidationFactory( + [["200", s_ephemeral_key]], + s_error, + ) + + // postEphemeralKeys + router.post( + `/v1/ephemeral_keys`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postEphemeralKeysRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postEphemeralKeys(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postEphemeralKeysResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteEphemeralKeysKeyParamSchema = z.object({ + key: z.string().max(5000), + }) + + const deleteEphemeralKeysKeyRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const deleteEphemeralKeysKeyResponseBodyValidator = responseValidationFactory( + [["200", s_ephemeral_key]], + s_error, + ) + + // deleteEphemeralKeysKey + router.delete( + `/v1/ephemeral_keys/:key`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteEphemeralKeysKeyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteEphemeralKeysKeyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteEphemeralKeysKey(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteEphemeralKeysKeyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getEventsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + delivery_success: PermissiveBoolean.optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + type: z.string().max(5000).optional(), + types: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getEventsRequestBodySchema = z.object({}).optional() + + const getEventsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_event), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/events")), + }), + ], + ], + s_error, + ) + + // getEvents + router.get( + `/v1/events`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getEventsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getEventsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_event[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEvents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getEventsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getEventsIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getEventsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getEventsIdRequestBodySchema = z.object({}).optional() + + const getEventsIdResponseBodyValidator = responseValidationFactory( + [["200", s_event]], + s_error, + ) + + // getEventsId + router.get( + `/v1/events/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getEventsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getEventsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getEventsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getEventsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getEventsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getExchangeRatesQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getExchangeRatesRequestBodySchema = z.object({}).optional() + + const getExchangeRatesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_exchange_rate), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/exchange_rates")), + }), + ], + ], + s_error, + ) + + // getExchangeRates + router.get( + `/v1/exchange_rates`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getExchangeRatesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getExchangeRatesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_exchange_rate[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getExchangeRates(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getExchangeRatesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getExchangeRatesRateIdParamSchema = z.object({ + rate_id: z.string().max(5000), + }) + + const getExchangeRatesRateIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getExchangeRatesRateIdRequestBodySchema = z.object({}).optional() + + const getExchangeRatesRateIdResponseBodyValidator = responseValidationFactory( + [["200", s_exchange_rate]], + s_error, + ) + + // getExchangeRatesRateId + router.get( + `/v1/exchange_rates/:rate_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getExchangeRatesRateIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getExchangeRatesRateIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getExchangeRatesRateIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getExchangeRatesRateId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getExchangeRatesRateIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postExternalAccountsIdParamSchema = z.object({ id: z.string() }) + + const postExternalAccountsIdRequestBodySchema = z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["", "company", "individual"]).optional(), + account_type: z.enum(["checking", "futsu", "savings", "toza"]).optional(), + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + default_for_currency: PermissiveBoolean.optional(), + documents: z + .object({ + bank_account_ownership_verification: z + .object({ files: z.array(z.string().max(500)).optional() }) + .optional(), + }) + .optional(), + exp_month: z.string().max(5000).optional(), + exp_year: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(5000).optional(), + }) + .optional() + + const postExternalAccountsIdResponseBodyValidator = responseValidationFactory( + [["200", s_external_account]], + s_error, + ) + + // postExternalAccountsId + router.post( + `/v1/external_accounts/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postExternalAccountsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postExternalAccountsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postExternalAccountsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postExternalAccountsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFileLinksQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + expired: PermissiveBoolean.optional(), + file: z.string().max(5000).optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().optional(), + }) + + const getFileLinksRequestBodySchema = z.object({}).optional() + + const getFileLinksResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_file_link)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/file_links")), + }), + ], + ], + s_error, + ) + + // getFileLinks + router.get( + `/v1/file_links`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getFileLinksQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFileLinksRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_file_link[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFileLinks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getFileLinksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postFileLinksRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + file: z.string().max(5000), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + + const postFileLinksResponseBodyValidator = responseValidationFactory( + [["200", s_file_link]], + s_error, + ) + + // postFileLinks + router.post( + `/v1/file_links`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postFileLinksRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postFileLinks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postFileLinksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFileLinksLinkParamSchema = z.object({ link: z.string() }) + + const getFileLinksLinkQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getFileLinksLinkRequestBodySchema = z.object({}).optional() + + const getFileLinksLinkResponseBodyValidator = responseValidationFactory( + [["200", s_file_link]], + s_error, + ) + + // getFileLinksLink + router.get( + `/v1/file_links/:link`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getFileLinksLinkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getFileLinksLinkQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFileLinksLinkRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFileLinksLink(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getFileLinksLinkResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postFileLinksLinkParamSchema = z.object({ link: z.string() }) + + const postFileLinksLinkRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + expires_at: z + .union([z.enum(["now"]), z.coerce.number(), z.enum([""])]) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postFileLinksLinkResponseBodyValidator = responseValidationFactory( + [["200", s_file_link]], + s_error, + ) + + // postFileLinksLink + router.post( + `/v1/file_links/:link`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postFileLinksLinkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postFileLinksLinkRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postFileLinksLink(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postFileLinksLinkResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFilesQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + purpose: z + .enum([ + "account_requirement", + "additional_verification", + "business_icon", + "business_logo", + "customer_signature", + "dispute_evidence", + "document_provider_identity_document", + "finance_report_run", + "financial_account_statement", + "identity_document", + "identity_document_downloadable", + "issuing_regulatory_reporting", + "pci_document", + "selfie", + "sigma_scheduled_query", + "tax_document_user_upload", + "terminal_reader_splashscreen", + ]) + .optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getFilesRequestBodySchema = z.object({}).optional() + + const getFilesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_file)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/files")), + }), + ], + ], + s_error, + ) + + // getFiles + router.get( + `/v1/files`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getFilesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFilesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_file[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFiles(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getFilesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postFilesRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + file: z.string(), + file_link_data: z + .object({ + create: PermissiveBoolean, + expires_at: z.coerce.number().optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional(), + purpose: z.enum([ + "account_requirement", + "additional_verification", + "business_icon", + "business_logo", + "customer_signature", + "dispute_evidence", + "identity_document", + "issuing_regulatory_reporting", + "pci_document", + "tax_document_user_upload", + "terminal_reader_splashscreen", + ]), + }) + + const postFilesResponseBodyValidator = responseValidationFactory( + [["200", s_file]], + s_error, + ) + + // postFiles + router.post( + `/v1/files`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postFilesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postFiles(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postFilesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFilesFileParamSchema = z.object({ file: z.string().max(5000) }) + + const getFilesFileQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getFilesFileRequestBodySchema = z.object({}).optional() + + const getFilesFileResponseBodyValidator = responseValidationFactory( + [["200", s_file]], + s_error, + ) + + // getFilesFile + router.get( + `/v1/files/:file`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getFilesFileParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getFilesFileQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFilesFileRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFilesFile(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getFilesFileResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFinancialConnectionsAccountsQuerySchema = z.object({ + account_holder: z + .object({ + account: z.string().max(5000).optional(), + customer: z.string().max(5000).optional(), + }) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + session: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getFinancialConnectionsAccountsRequestBodySchema = z + .object({}) + .optional() + + const getFinancialConnectionsAccountsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_financial_connections_account)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/financial_connections/accounts")), + }), + ], + ], + s_error, + ) + + // getFinancialConnectionsAccounts + router.get( + `/v1/financial_connections/accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getFinancialConnectionsAccountsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFinancialConnectionsAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_financial_connections_account[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFinancialConnectionsAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getFinancialConnectionsAccountsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFinancialConnectionsAccountsAccountParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getFinancialConnectionsAccountsAccountQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getFinancialConnectionsAccountsAccountRequestBodySchema = z + .object({}) + .optional() + + const getFinancialConnectionsAccountsAccountResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_account]], + s_error, + ) + + // getFinancialConnectionsAccountsAccount + router.get( + `/v1/financial_connections/accounts/:account`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getFinancialConnectionsAccountsAccountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getFinancialConnectionsAccountsAccountQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFinancialConnectionsAccountsAccountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFinancialConnectionsAccountsAccount( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getFinancialConnectionsAccountsAccountResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postFinancialConnectionsAccountsAccountDisconnectParamSchema = z.object( + { account: z.string().max(5000) }, + ) + + const postFinancialConnectionsAccountsAccountDisconnectRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postFinancialConnectionsAccountsAccountDisconnectResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_account]], + s_error, + ) + + // postFinancialConnectionsAccountsAccountDisconnect + router.post( + `/v1/financial_connections/accounts/:account/disconnect`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postFinancialConnectionsAccountsAccountDisconnectParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postFinancialConnectionsAccountsAccountDisconnectRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postFinancialConnectionsAccountsAccountDisconnect( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postFinancialConnectionsAccountsAccountDisconnectResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFinancialConnectionsAccountsAccountOwnersParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getFinancialConnectionsAccountsAccountOwnersQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + ownership: z.string().max(5000), + starting_after: z.string().max(5000).optional(), + }) + + const getFinancialConnectionsAccountsAccountOwnersRequestBodySchema = z + .object({}) + .optional() + + const getFinancialConnectionsAccountsAccountOwnersResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_financial_connections_account_owner), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getFinancialConnectionsAccountsAccountOwners + router.get( + `/v1/financial_connections/accounts/:account/owners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getFinancialConnectionsAccountsAccountOwnersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getFinancialConnectionsAccountsAccountOwnersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFinancialConnectionsAccountsAccountOwnersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_financial_connections_account_owner[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFinancialConnectionsAccountsAccountOwners( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getFinancialConnectionsAccountsAccountOwnersResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postFinancialConnectionsAccountsAccountRefreshParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postFinancialConnectionsAccountsAccountRefreshRequestBodySchema = + z.object({ + expand: z.array(z.string().max(5000)).optional(), + features: z.array(z.enum(["balance", "ownership", "transactions"])), + }) + + const postFinancialConnectionsAccountsAccountRefreshResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_account]], + s_error, + ) + + // postFinancialConnectionsAccountsAccountRefresh + router.post( + `/v1/financial_connections/accounts/:account/refresh`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postFinancialConnectionsAccountsAccountRefreshParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postFinancialConnectionsAccountsAccountRefreshRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postFinancialConnectionsAccountsAccountRefresh( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postFinancialConnectionsAccountsAccountRefreshResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postFinancialConnectionsAccountsAccountSubscribeParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postFinancialConnectionsAccountsAccountSubscribeRequestBodySchema = + z.object({ + expand: z.array(z.string().max(5000)).optional(), + features: z.array(z.enum(["transactions"])), + }) + + const postFinancialConnectionsAccountsAccountSubscribeResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_account]], + s_error, + ) + + // postFinancialConnectionsAccountsAccountSubscribe + router.post( + `/v1/financial_connections/accounts/:account/subscribe`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postFinancialConnectionsAccountsAccountSubscribeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postFinancialConnectionsAccountsAccountSubscribeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postFinancialConnectionsAccountsAccountSubscribe( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postFinancialConnectionsAccountsAccountSubscribeResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postFinancialConnectionsAccountsAccountUnsubscribeParamSchema = + z.object({ account: z.string().max(5000) }) + + const postFinancialConnectionsAccountsAccountUnsubscribeRequestBodySchema = + z.object({ + expand: z.array(z.string().max(5000)).optional(), + features: z.array(z.enum(["transactions"])), + }) + + const postFinancialConnectionsAccountsAccountUnsubscribeResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_account]], + s_error, + ) + + // postFinancialConnectionsAccountsAccountUnsubscribe + router.post( + `/v1/financial_connections/accounts/:account/unsubscribe`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postFinancialConnectionsAccountsAccountUnsubscribeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postFinancialConnectionsAccountsAccountUnsubscribeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postFinancialConnectionsAccountsAccountUnsubscribe( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postFinancialConnectionsAccountsAccountUnsubscribeResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postFinancialConnectionsSessionsRequestBodySchema = z.object({ + account_holder: z.object({ + account: z.string().max(5000).optional(), + customer: z.string().max(5000).optional(), + type: z.enum(["account", "customer"]), + }), + expand: z.array(z.string().max(5000)).optional(), + filters: z + .object({ + account_subcategories: z + .array( + z.enum([ + "checking", + "credit_card", + "line_of_credit", + "mortgage", + "savings", + ]), + ) + .optional(), + countries: z.array(z.string().max(5000)).optional(), + }) + .optional(), + permissions: z.array( + z.enum(["balances", "ownership", "payment_method", "transactions"]), + ), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + return_url: z.string().max(5000).optional(), + }) + + const postFinancialConnectionsSessionsResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_session]], + s_error, + ) + + // postFinancialConnectionsSessions + router.post( + `/v1/financial_connections/sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postFinancialConnectionsSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postFinancialConnectionsSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postFinancialConnectionsSessionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFinancialConnectionsSessionsSessionParamSchema = z.object({ + session: z.string().max(5000), + }) + + const getFinancialConnectionsSessionsSessionQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getFinancialConnectionsSessionsSessionRequestBodySchema = z + .object({}) + .optional() + + const getFinancialConnectionsSessionsSessionResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_session]], + s_error, + ) + + // getFinancialConnectionsSessionsSession + router.get( + `/v1/financial_connections/sessions/:session`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getFinancialConnectionsSessionsSessionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getFinancialConnectionsSessionsSessionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFinancialConnectionsSessionsSessionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFinancialConnectionsSessionsSession( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getFinancialConnectionsSessionsSessionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFinancialConnectionsTransactionsQuerySchema = z.object({ + account: z.string().max(5000), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + transacted_at: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + transaction_refresh: z.object({ after: z.string().max(5000) }).optional(), + }) + + const getFinancialConnectionsTransactionsRequestBodySchema = z + .object({}) + .optional() + + const getFinancialConnectionsTransactionsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_financial_connections_transaction), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/financial_connections/transactions")), + }), + ], + ], + s_error, + ) + + // getFinancialConnectionsTransactions + router.get( + `/v1/financial_connections/transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getFinancialConnectionsTransactionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFinancialConnectionsTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_financial_connections_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFinancialConnectionsTransactions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getFinancialConnectionsTransactionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getFinancialConnectionsTransactionsTransactionParamSchema = z.object({ + transaction: z.string().max(5000), + }) + + const getFinancialConnectionsTransactionsTransactionQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getFinancialConnectionsTransactionsTransactionRequestBodySchema = z + .object({}) + .optional() + + const getFinancialConnectionsTransactionsTransactionResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_transaction]], + s_error, + ) + + // getFinancialConnectionsTransactionsTransaction + router.get( + `/v1/financial_connections/transactions/:transaction`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getFinancialConnectionsTransactionsTransactionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getFinancialConnectionsTransactionsTransactionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getFinancialConnectionsTransactionsTransactionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getFinancialConnectionsTransactionsTransaction( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getFinancialConnectionsTransactionsTransactionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getForwardingRequestsQuerySchema = z.object({ + created: z + .object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getForwardingRequestsRequestBodySchema = z.object({}).optional() + + const getForwardingRequestsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_forwarding_request), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getForwardingRequests + router.get( + `/v1/forwarding/requests`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getForwardingRequestsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getForwardingRequestsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_forwarding_request[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getForwardingRequests(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getForwardingRequestsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postForwardingRequestsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + payment_method: z.string().max(5000), + replacements: z.array( + z.enum([ + "card_cvc", + "card_expiry", + "card_number", + "cardholder_name", + "request_signature", + ]), + ), + request: z + .object({ + body: z.string().max(5000).optional(), + headers: z + .array( + z.object({ + name: z.string().max(5000), + value: z.string().max(5000), + }), + ) + .optional(), + }) + .optional(), + url: z.string().max(5000), + }) + + const postForwardingRequestsResponseBodyValidator = responseValidationFactory( + [["200", s_forwarding_request]], + s_error, + ) + + // postForwardingRequests + router.post( + `/v1/forwarding/requests`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postForwardingRequestsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postForwardingRequests(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postForwardingRequestsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getForwardingRequestsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getForwardingRequestsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getForwardingRequestsIdRequestBodySchema = z.object({}).optional() + + const getForwardingRequestsIdResponseBodyValidator = + responseValidationFactory([["200", s_forwarding_request]], s_error) + + // getForwardingRequestsId + router.get( + `/v1/forwarding/requests/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getForwardingRequestsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getForwardingRequestsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getForwardingRequestsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getForwardingRequestsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getForwardingRequestsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIdentityVerificationReportsQuerySchema = z.object({ + client_reference_id: z.string().max(5000).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + type: z.enum(["document", "id_number"]).optional(), + verification_session: z.string().max(5000).optional(), + }) + + const getIdentityVerificationReportsRequestBodySchema = z + .object({}) + .optional() + + const getIdentityVerificationReportsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_identity_verification_report), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/identity/verification_reports")), + }), + ], + ], + s_error, + ) + + // getIdentityVerificationReports + router.get( + `/v1/identity/verification_reports`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIdentityVerificationReportsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIdentityVerificationReportsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_identity_verification_report[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIdentityVerificationReports(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIdentityVerificationReportsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIdentityVerificationReportsReportParamSchema = z.object({ + report: z.string().max(5000), + }) + + const getIdentityVerificationReportsReportQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIdentityVerificationReportsReportRequestBodySchema = z + .object({}) + .optional() + + const getIdentityVerificationReportsReportResponseBodyValidator = + responseValidationFactory( + [["200", s_identity_verification_report]], + s_error, + ) + + // getIdentityVerificationReportsReport + router.get( + `/v1/identity/verification_reports/:report`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIdentityVerificationReportsReportParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIdentityVerificationReportsReportQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIdentityVerificationReportsReportRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIdentityVerificationReportsReport( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIdentityVerificationReportsReportResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIdentityVerificationSessionsQuerySchema = z.object({ + client_reference_id: z.string().max(5000).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + related_customer: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + status: z + .enum(["canceled", "processing", "requires_input", "verified"]) + .optional(), + }) + + const getIdentityVerificationSessionsRequestBodySchema = z + .object({}) + .optional() + + const getIdentityVerificationSessionsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_identity_verification_session), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/identity/verification_sessions")), + }), + ], + ], + s_error, + ) + + // getIdentityVerificationSessions + router.get( + `/v1/identity/verification_sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIdentityVerificationSessionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIdentityVerificationSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_identity_verification_session[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIdentityVerificationSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIdentityVerificationSessionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIdentityVerificationSessionsRequestBodySchema = z + .object({ + client_reference_id: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + options: z + .object({ + document: z + .union([ + z.object({ + allowed_types: z + .array(z.enum(["driving_license", "id_card", "passport"])) + .optional(), + require_id_number: PermissiveBoolean.optional(), + require_live_capture: PermissiveBoolean.optional(), + require_matching_selfie: PermissiveBoolean.optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + provided_details: z + .object({ email: z.string().optional(), phone: z.string().optional() }) + .optional(), + related_customer: z.string().max(5000).optional(), + return_url: z.string().optional(), + type: z.enum(["document", "id_number"]).optional(), + verification_flow: z.string().max(5000).optional(), + }) + .optional() + + const postIdentityVerificationSessionsResponseBodyValidator = + responseValidationFactory( + [["200", s_identity_verification_session]], + s_error, + ) + + // postIdentityVerificationSessions + router.post( + `/v1/identity/verification_sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postIdentityVerificationSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIdentityVerificationSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIdentityVerificationSessionsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIdentityVerificationSessionsSessionParamSchema = z.object({ + session: z.string().max(5000), + }) + + const getIdentityVerificationSessionsSessionQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIdentityVerificationSessionsSessionRequestBodySchema = z + .object({}) + .optional() + + const getIdentityVerificationSessionsSessionResponseBodyValidator = + responseValidationFactory( + [["200", s_identity_verification_session]], + s_error, + ) + + // getIdentityVerificationSessionsSession + router.get( + `/v1/identity/verification_sessions/:session`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIdentityVerificationSessionsSessionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIdentityVerificationSessionsSessionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIdentityVerificationSessionsSessionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIdentityVerificationSessionsSession( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIdentityVerificationSessionsSessionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIdentityVerificationSessionsSessionParamSchema = z.object({ + session: z.string().max(5000), + }) + + const postIdentityVerificationSessionsSessionRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + options: z + .object({ + document: z + .union([ + z.object({ + allowed_types: z + .array(z.enum(["driving_license", "id_card", "passport"])) + .optional(), + require_id_number: PermissiveBoolean.optional(), + require_live_capture: PermissiveBoolean.optional(), + require_matching_selfie: PermissiveBoolean.optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + provided_details: z + .object({ email: z.string().optional(), phone: z.string().optional() }) + .optional(), + type: z.enum(["document", "id_number"]).optional(), + }) + .optional() + + const postIdentityVerificationSessionsSessionResponseBodyValidator = + responseValidationFactory( + [["200", s_identity_verification_session]], + s_error, + ) + + // postIdentityVerificationSessionsSession + router.post( + `/v1/identity/verification_sessions/:session`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIdentityVerificationSessionsSessionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIdentityVerificationSessionsSessionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIdentityVerificationSessionsSession( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIdentityVerificationSessionsSessionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIdentityVerificationSessionsSessionCancelParamSchema = z.object({ + session: z.string().max(5000), + }) + + const postIdentityVerificationSessionsSessionCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postIdentityVerificationSessionsSessionCancelResponseBodyValidator = + responseValidationFactory( + [["200", s_identity_verification_session]], + s_error, + ) + + // postIdentityVerificationSessionsSessionCancel + router.post( + `/v1/identity/verification_sessions/:session/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIdentityVerificationSessionsSessionCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIdentityVerificationSessionsSessionCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIdentityVerificationSessionsSessionCancel( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIdentityVerificationSessionsSessionCancelResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIdentityVerificationSessionsSessionRedactParamSchema = z.object({ + session: z.string().max(5000), + }) + + const postIdentityVerificationSessionsSessionRedactRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postIdentityVerificationSessionsSessionRedactResponseBodyValidator = + responseValidationFactory( + [["200", s_identity_verification_session]], + s_error, + ) + + // postIdentityVerificationSessionsSessionRedact + router.post( + `/v1/identity/verification_sessions/:session/redact`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIdentityVerificationSessionsSessionRedactParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIdentityVerificationSessionsSessionRedactRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIdentityVerificationSessionsSessionRedact( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIdentityVerificationSessionsSessionRedactResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoicePaymentsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + invoice: z.string().max(5000).optional(), + limit: z.coerce.number().optional(), + payment: z + .object({ + payment_intent: z.string().max(5000).optional(), + type: z.enum(["payment_intent"]), + }) + .optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["canceled", "open", "paid"]).optional(), + }) + + const getInvoicePaymentsRequestBodySchema = z.object({}).optional() + + const getInvoicePaymentsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_invoice_payment)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getInvoicePayments + router.get( + `/v1/invoice_payments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getInvoicePaymentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoicePaymentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_invoice_payment[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoicePayments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getInvoicePaymentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoicePaymentsInvoicePaymentParamSchema = z.object({ + invoice_payment: z.string().max(5000), + }) + + const getInvoicePaymentsInvoicePaymentQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getInvoicePaymentsInvoicePaymentRequestBodySchema = z + .object({}) + .optional() + + const getInvoicePaymentsInvoicePaymentResponseBodyValidator = + responseValidationFactory([["200", s_invoice_payment]], s_error) + + // getInvoicePaymentsInvoicePayment + router.get( + `/v1/invoice_payments/:invoice_payment`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getInvoicePaymentsInvoicePaymentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getInvoicePaymentsInvoicePaymentQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoicePaymentsInvoicePaymentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoicePaymentsInvoicePayment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getInvoicePaymentsInvoicePaymentResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoiceRenderingTemplatesQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["active", "archived"]).optional(), + }) + + const getInvoiceRenderingTemplatesRequestBodySchema = z.object({}).optional() + + const getInvoiceRenderingTemplatesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_invoice_rendering_template), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getInvoiceRenderingTemplates + router.get( + `/v1/invoice_rendering_templates`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getInvoiceRenderingTemplatesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoiceRenderingTemplatesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_invoice_rendering_template[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoiceRenderingTemplates(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getInvoiceRenderingTemplatesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoiceRenderingTemplatesTemplateParamSchema = z.object({ + template: z.string().max(5000), + }) + + const getInvoiceRenderingTemplatesTemplateQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + version: z.coerce.number().optional(), + }) + + const getInvoiceRenderingTemplatesTemplateRequestBodySchema = z + .object({}) + .optional() + + const getInvoiceRenderingTemplatesTemplateResponseBodyValidator = + responseValidationFactory([["200", s_invoice_rendering_template]], s_error) + + // getInvoiceRenderingTemplatesTemplate + router.get( + `/v1/invoice_rendering_templates/:template`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getInvoiceRenderingTemplatesTemplateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getInvoiceRenderingTemplatesTemplateQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoiceRenderingTemplatesTemplateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoiceRenderingTemplatesTemplate( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getInvoiceRenderingTemplatesTemplateResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoiceRenderingTemplatesTemplateArchiveParamSchema = z.object({ + template: z.string().max(5000), + }) + + const postInvoiceRenderingTemplatesTemplateArchiveRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postInvoiceRenderingTemplatesTemplateArchiveResponseBodyValidator = + responseValidationFactory([["200", s_invoice_rendering_template]], s_error) + + // postInvoiceRenderingTemplatesTemplateArchive + router.post( + `/v1/invoice_rendering_templates/:template/archive`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoiceRenderingTemplatesTemplateArchiveParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoiceRenderingTemplatesTemplateArchiveRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoiceRenderingTemplatesTemplateArchive( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoiceRenderingTemplatesTemplateArchiveResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoiceRenderingTemplatesTemplateUnarchiveParamSchema = z.object({ + template: z.string().max(5000), + }) + + const postInvoiceRenderingTemplatesTemplateUnarchiveRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postInvoiceRenderingTemplatesTemplateUnarchiveResponseBodyValidator = + responseValidationFactory([["200", s_invoice_rendering_template]], s_error) + + // postInvoiceRenderingTemplatesTemplateUnarchive + router.post( + `/v1/invoice_rendering_templates/:template/unarchive`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoiceRenderingTemplatesTemplateUnarchiveParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoiceRenderingTemplatesTemplateUnarchiveRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoiceRenderingTemplatesTemplateUnarchive( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoiceRenderingTemplatesTemplateUnarchiveResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoiceitemsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + invoice: z.string().max(5000).optional(), + limit: z.coerce.number().optional(), + pending: PermissiveBoolean.optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getInvoiceitemsRequestBodySchema = z.object({}).optional() + + const getInvoiceitemsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_invoiceitem)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/invoiceitems")), + }), + ], + ], + s_error, + ) + + // getInvoiceitems + router.get( + `/v1/invoiceitems`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getInvoiceitemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoiceitemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_invoiceitem[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoiceitems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getInvoiceitemsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoiceitemsRequestBodySchema = z.object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + customer: z.string().max(5000), + description: z.string().max(5000).optional(), + discountable: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + period: z + .object({ end: z.coerce.number(), start: z.coerce.number() }) + .optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + pricing: z.object({ price: z.string().max(5000).optional() }).optional(), + quantity: z.coerce.number().optional(), + subscription: z.string().max(5000).optional(), + tax_behavior: z.enum(["exclusive", "inclusive", "unspecified"]).optional(), + tax_code: z.union([z.string(), z.enum([""])]).optional(), + tax_rates: z.array(z.string().max(5000)).optional(), + unit_amount_decimal: z.string().optional(), + }) + + const postInvoiceitemsResponseBodyValidator = responseValidationFactory( + [["200", s_invoiceitem]], + s_error, + ) + + // postInvoiceitems + router.post( + `/v1/invoiceitems`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postInvoiceitemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoiceitems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postInvoiceitemsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteInvoiceitemsInvoiceitemParamSchema = z.object({ + invoiceitem: z.string().max(5000), + }) + + const deleteInvoiceitemsInvoiceitemRequestBodySchema = z.object({}).optional() + + const deleteInvoiceitemsInvoiceitemResponseBodyValidator = + responseValidationFactory([["200", s_deleted_invoiceitem]], s_error) + + // deleteInvoiceitemsInvoiceitem + router.delete( + `/v1/invoiceitems/:invoiceitem`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteInvoiceitemsInvoiceitemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteInvoiceitemsInvoiceitemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteInvoiceitemsInvoiceitem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteInvoiceitemsInvoiceitemResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoiceitemsInvoiceitemParamSchema = z.object({ + invoiceitem: z.string().max(5000), + }) + + const getInvoiceitemsInvoiceitemQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getInvoiceitemsInvoiceitemRequestBodySchema = z.object({}).optional() + + const getInvoiceitemsInvoiceitemResponseBodyValidator = + responseValidationFactory([["200", s_invoiceitem]], s_error) + + // getInvoiceitemsInvoiceitem + router.get( + `/v1/invoiceitems/:invoiceitem`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getInvoiceitemsInvoiceitemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getInvoiceitemsInvoiceitemQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoiceitemsInvoiceitemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoiceitemsInvoiceitem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getInvoiceitemsInvoiceitemResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoiceitemsInvoiceitemParamSchema = z.object({ + invoiceitem: z.string().max(5000), + }) + + const postInvoiceitemsInvoiceitemRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + discountable: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + period: z + .object({ end: z.coerce.number(), start: z.coerce.number() }) + .optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + pricing: z.object({ price: z.string().max(5000).optional() }).optional(), + quantity: z.coerce.number().optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tax_code: z.union([z.string(), z.enum([""])]).optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional() + + const postInvoiceitemsInvoiceitemResponseBodyValidator = + responseValidationFactory([["200", s_invoiceitem]], s_error) + + // postInvoiceitemsInvoiceitem + router.post( + `/v1/invoiceitems/:invoiceitem`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoiceitemsInvoiceitemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoiceitemsInvoiceitemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoiceitemsInvoiceitem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoiceitemsInvoiceitemResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoicesQuerySchema = z.object({ + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + due_date: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z + .enum(["draft", "open", "paid", "uncollectible", "void"]) + .optional(), + subscription: z.string().max(5000).optional(), + }) + + const getInvoicesRequestBodySchema = z.object({}).optional() + + const getInvoicesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_invoice)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/invoices")), + }), + ], + ], + s_error, + ) + + // getInvoices + router.get( + `/v1/invoices`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getInvoicesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoicesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_invoice[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoices(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getInvoicesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesRequestBodySchema = z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + application_fee_amount: z.coerce.number().optional(), + auto_advance: PermissiveBoolean.optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + automatically_finalizes_at: z.coerce.number().optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + currency: z.string().optional(), + custom_fields: z + .union([ + z.array( + z.object({ name: z.string().max(40), value: z.string().max(140) }), + ), + z.enum([""]), + ]) + .optional(), + customer: z.string().max(5000).optional(), + days_until_due: z.coerce.number().optional(), + default_payment_method: z.string().max(5000).optional(), + default_source: z.string().max(5000).optional(), + default_tax_rates: z.array(z.string().max(5000)).optional(), + description: z.string().max(1500).optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + due_date: z.coerce.number().optional(), + effective_at: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + footer: z.string().max(5000).optional(), + from_invoice: z + .object({ action: z.enum(["revision"]), invoice: z.string().max(5000) }) + .optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + number: z.string().max(26).optional(), + on_behalf_of: z.string().optional(), + payment_settings: z + .object({ + default_mandate: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + transaction_type: z + .enum(["business", "personal"]) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z + .enum(["de", "en", "fr", "nl"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + installments: z + .object({ + enabled: PermissiveBoolean.optional(), + plan: z + .union([ + z.object({ + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), + type: z.enum(["fixed_count"]), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + type: z.string().optional(), + }) + .optional(), + funding_type: z.string().optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z.union([z.object({}), z.enum([""])]).optional(), + sepa_debit: z.union([z.object({}), z.enum([""])]).optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array( + z.enum(["balances", "ownership", "transactions"]), + ) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z + .union([ + z.array( + z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "jp_credit_transfer", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "multibanco", + "naver_pay", + "nz_bank_account", + "p24", + "payco", + "paynow", + "paypal", + "promptpay", + "revolut_pay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "swish", + "us_bank_account", + "wechat_pay", + ]), + ), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + pending_invoice_items_behavior: z.enum(["exclude", "include"]).optional(), + rendering: z + .object({ + amount_tax_display: z + .enum(["", "exclude_tax", "include_inclusive_tax"]) + .optional(), + pdf: z + .object({ page_size: z.enum(["a4", "auto", "letter"]).optional() }) + .optional(), + template: z.string().max(5000).optional(), + template_version: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }) + .optional(), + shipping_cost: z + .object({ + shipping_rate: z.string().max(5000).optional(), + shipping_rate_data: z + .object({ + delivery_estimate: z + .object({ + maximum: z + .object({ + unit: z.enum([ + "business_day", + "day", + "hour", + "month", + "week", + ]), + value: z.coerce.number(), + }) + .optional(), + minimum: z + .object({ + unit: z.enum([ + "business_day", + "day", + "hour", + "month", + "week", + ]), + value: z.coerce.number(), + }) + .optional(), + }) + .optional(), + display_name: z.string().max(100), + fixed_amount: z + .object({ + amount: z.coerce.number(), + currency: z.string(), + currency_options: z + .record( + z.object({ + amount: z.coerce.number(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + }), + ) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tax_code: z.string().optional(), + type: z.enum(["fixed_amount"]).optional(), + }) + .optional(), + }) + .optional(), + shipping_details: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + name: z.string().max(5000), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + statement_descriptor: z.string().max(22).optional(), + subscription: z.string().max(5000).optional(), + transfer_data: z + .object({ + amount: z.coerce.number().optional(), + destination: z.string(), + }) + .optional(), + }) + .optional() + + const postInvoicesResponseBodyValidator = responseValidationFactory( + [["200", s_invoice]], + s_error, + ) + + // postInvoices + router.post( + `/v1/invoices`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postInvoicesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoices(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postInvoicesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesCreatePreviewRequestBodySchema = z + .object({ + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + currency: z.string().optional(), + customer: z.string().max(5000).optional(), + customer_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + shipping: z + .union([ + z.object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + tax: z + .object({ + ip_address: z.union([z.string(), z.enum([""])]).optional(), + }) + .optional(), + tax_exempt: z.enum(["", "exempt", "none", "reverse"]).optional(), + tax_ids: z + .array( + z.object({ + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string(), + }), + ) + .optional(), + }) + .optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice_items: z + .array( + z.object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + description: z.string().max(5000).optional(), + discountable: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + invoiceitem: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + period: z + .object({ end: z.coerce.number(), start: z.coerce.number() }) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tax_code: z.union([z.string(), z.enum([""])]).optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ) + .optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + on_behalf_of: z.union([z.string(), z.enum([""])]).optional(), + preview_mode: z.enum(["next", "recurring"]).optional(), + schedule: z.string().max(5000).optional(), + schedule_details: z + .object({ + end_behavior: z.enum(["cancel", "release"]).optional(), + phases: z + .array( + z.object({ + add_invoice_items: z + .array( + z.object({ + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + application_fee_percent: z.coerce.number().optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_cycle_anchor: z + .enum(["automatic", "phase_start"]) + .optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + default_payment_method: z.string().max(5000).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + description: z + .union([z.string().max(500), z.enum([""])]) + .optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + end_date: z + .union([z.coerce.number(), z.enum(["now"])]) + .optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + days_until_due: z.coerce.number().optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + items: z.array( + z.object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), + iterations: z.coerce.number().optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.string().optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + start_date: z + .union([z.coerce.number(), z.enum(["now"])]) + .optional(), + transfer_data: z + .object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }) + .optional(), + trial: PermissiveBoolean.optional(), + trial_end: z + .union([z.coerce.number(), z.enum(["now"])]) + .optional(), + }), + ) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + }) + .optional(), + subscription: z.string().max(5000).optional(), + subscription_details: z + .object({ + billing_cycle_anchor: z + .union([z.enum(["now", "unchanged"]), z.coerce.number()]) + .optional(), + cancel_at: z.union([z.coerce.number(), z.enum([""])]).optional(), + cancel_at_period_end: PermissiveBoolean.optional(), + cancel_now: PermissiveBoolean.optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + items: z + .array( + z.object({ + clear_usage: PermissiveBoolean.optional(), + deleted: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + id: z.string().max(5000).optional(), + metadata: z + .union([z.record(z.string()), z.enum([""])]) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + proration_date: z.coerce.number().optional(), + resume_at: z.enum(["now"]).optional(), + start_date: z.coerce.number().optional(), + trial_end: z.union([z.enum(["now"]), z.coerce.number()]).optional(), + }) + .optional(), + }) + .optional() + + const postInvoicesCreatePreviewResponseBodyValidator = + responseValidationFactory([["200", s_invoice]], s_error) + + // postInvoicesCreatePreview + router.post( + `/v1/invoices/create_preview`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postInvoicesCreatePreviewRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesCreatePreview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postInvoicesCreatePreviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoicesSearchQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + page: z.string().max(5000).optional(), + query: z.string().max(5000), + }) + + const getInvoicesSearchRequestBodySchema = z.object({}).optional() + + const getInvoicesSearchResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_invoice)), + has_more: PermissiveBoolean, + next_page: z.string().max(5000).nullable().optional(), + object: z.enum(["search_result"]), + total_count: z.coerce.number().optional(), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getInvoicesSearch + router.get( + `/v1/invoices/search`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getInvoicesSearchQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoicesSearchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_invoice[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoicesSearch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getInvoicesSearchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteInvoicesInvoiceParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const deleteInvoicesInvoiceRequestBodySchema = z.object({}).optional() + + const deleteInvoicesInvoiceResponseBodyValidator = responseValidationFactory( + [["200", s_deleted_invoice]], + s_error, + ) + + // deleteInvoicesInvoice + router.delete( + `/v1/invoices/:invoice`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteInvoicesInvoiceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteInvoicesInvoiceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteInvoicesInvoice(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteInvoicesInvoiceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoicesInvoiceParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const getInvoicesInvoiceQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getInvoicesInvoiceRequestBodySchema = z.object({}).optional() + + const getInvoicesInvoiceResponseBodyValidator = responseValidationFactory( + [["200", s_invoice]], + s_error, + ) + + // getInvoicesInvoice + router.get( + `/v1/invoices/:invoice`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getInvoicesInvoiceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getInvoicesInvoiceQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoicesInvoiceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoicesInvoice(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getInvoicesInvoiceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoiceRequestBodySchema = z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + application_fee_amount: z.coerce.number().optional(), + auto_advance: PermissiveBoolean.optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + automatically_finalizes_at: z.coerce.number().optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + custom_fields: z + .union([ + z.array( + z.object({ name: z.string().max(40), value: z.string().max(140) }), + ), + z.enum([""]), + ]) + .optional(), + days_until_due: z.coerce.number().optional(), + default_payment_method: z.string().max(5000).optional(), + default_source: z.union([z.string().max(5000), z.enum([""])]).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + description: z.string().max(1500).optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + due_date: z.coerce.number().optional(), + effective_at: z.union([z.coerce.number(), z.enum([""])]).optional(), + expand: z.array(z.string().max(5000)).optional(), + footer: z.string().max(5000).optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + number: z.union([z.string().max(26), z.enum([""])]).optional(), + on_behalf_of: z.union([z.string(), z.enum([""])]).optional(), + payment_settings: z + .object({ + default_mandate: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + transaction_type: z + .enum(["business", "personal"]) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z + .enum(["de", "en", "fr", "nl"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + installments: z + .object({ + enabled: PermissiveBoolean.optional(), + plan: z + .union([ + z.object({ + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), + type: z.enum(["fixed_count"]), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + type: z.string().optional(), + }) + .optional(), + funding_type: z.string().optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z.union([z.object({}), z.enum([""])]).optional(), + sepa_debit: z.union([z.object({}), z.enum([""])]).optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array( + z.enum(["balances", "ownership", "transactions"]), + ) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z + .union([ + z.array( + z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "jp_credit_transfer", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "multibanco", + "naver_pay", + "nz_bank_account", + "p24", + "payco", + "paynow", + "paypal", + "promptpay", + "revolut_pay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "swish", + "us_bank_account", + "wechat_pay", + ]), + ), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + rendering: z + .object({ + amount_tax_display: z + .enum(["", "exclude_tax", "include_inclusive_tax"]) + .optional(), + pdf: z + .object({ page_size: z.enum(["a4", "auto", "letter"]).optional() }) + .optional(), + template: z.string().max(5000).optional(), + template_version: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }) + .optional(), + shipping_cost: z + .union([ + z.object({ + shipping_rate: z.string().max(5000).optional(), + shipping_rate_data: z + .object({ + delivery_estimate: z + .object({ + maximum: z + .object({ + unit: z.enum([ + "business_day", + "day", + "hour", + "month", + "week", + ]), + value: z.coerce.number(), + }) + .optional(), + minimum: z + .object({ + unit: z.enum([ + "business_day", + "day", + "hour", + "month", + "week", + ]), + value: z.coerce.number(), + }) + .optional(), + }) + .optional(), + display_name: z.string().max(100), + fixed_amount: z + .object({ + amount: z.coerce.number(), + currency: z.string(), + currency_options: z + .record( + z.object({ + amount: z.coerce.number(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + }), + ) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tax_code: z.string().optional(), + type: z.enum(["fixed_amount"]).optional(), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + shipping_details: z + .union([ + z.object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + name: z.string().max(5000), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }), + z.enum([""]), + ]) + .optional(), + statement_descriptor: z.string().max(22).optional(), + transfer_data: z + .union([ + z.object({ + amount: z.coerce.number().optional(), + destination: z.string(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional() + + const postInvoicesInvoiceResponseBodyValidator = responseValidationFactory( + [["200", s_invoice]], + s_error, + ) + + // postInvoicesInvoice + router.post( + `/v1/invoices/:invoice`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoice(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postInvoicesInvoiceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceAddLinesParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoiceAddLinesRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + invoice_metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + lines: z.array( + z.object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + discountable: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + invoice_item: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + period: z + .object({ end: z.coerce.number(), start: z.coerce.number() }) + .optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000).optional(), + product_data: z + .object({ + description: z.string().max(40000).optional(), + images: z.array(z.string()).optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000), + tax_code: z.string().max(5000).optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + pricing: z + .object({ price: z.string().max(5000).optional() }) + .optional(), + quantity: z.coerce.number().optional(), + tax_amounts: z + .union([ + z.array( + z.object({ + amount: z.coerce.number(), + tax_rate_data: z.object({ + country: z.string().max(5000).optional(), + description: z.string().max(5000).optional(), + display_name: z.string().max(100), + inclusive: PermissiveBoolean, + jurisdiction: z.string().max(200).optional(), + jurisdiction_level: z + .enum([ + "city", + "country", + "county", + "district", + "multiple", + "state", + ]) + .optional(), + percentage: z.coerce.number(), + state: z.string().max(5000).optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "retail_delivery_fee", + "rst", + "sales_tax", + "service_tax", + "vat", + ]) + .optional(), + }), + taxability_reason: z + .enum([ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ]) + .optional(), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), + }) + + const postInvoicesInvoiceAddLinesResponseBodyValidator = + responseValidationFactory([["200", s_invoice]], s_error) + + // postInvoicesInvoiceAddLines + router.post( + `/v1/invoices/:invoice/add_lines`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceAddLinesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceAddLinesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoiceAddLines(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoicesInvoiceAddLinesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceFinalizeParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoiceFinalizeRequestBodySchema = z + .object({ + auto_advance: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postInvoicesInvoiceFinalizeResponseBodyValidator = + responseValidationFactory([["200", s_invoice]], s_error) + + // postInvoicesInvoiceFinalize + router.post( + `/v1/invoices/:invoice/finalize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceFinalizeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceFinalizeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoiceFinalize(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoicesInvoiceFinalizeResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getInvoicesInvoiceLinesParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const getInvoicesInvoiceLinesQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getInvoicesInvoiceLinesRequestBodySchema = z.object({}).optional() + + const getInvoicesInvoiceLinesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_line_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getInvoicesInvoiceLines + router.get( + `/v1/invoices/:invoice/lines`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getInvoicesInvoiceLinesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getInvoicesInvoiceLinesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getInvoicesInvoiceLinesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_line_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getInvoicesInvoiceLines(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getInvoicesInvoiceLinesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceLinesLineItemIdParamSchema = z.object({ + invoice: z.string().max(5000), + line_item_id: z.string().max(5000), + }) + + const postInvoicesInvoiceLinesLineItemIdRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + discountable: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + period: z + .object({ end: z.coerce.number(), start: z.coerce.number() }) + .optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000).optional(), + product_data: z + .object({ + description: z.string().max(40000).optional(), + images: z.array(z.string()).optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000), + tax_code: z.string().max(5000).optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + pricing: z.object({ price: z.string().max(5000).optional() }).optional(), + quantity: z.coerce.number().optional(), + tax_amounts: z + .union([ + z.array( + z.object({ + amount: z.coerce.number(), + tax_rate_data: z.object({ + country: z.string().max(5000).optional(), + description: z.string().max(5000).optional(), + display_name: z.string().max(100), + inclusive: PermissiveBoolean, + jurisdiction: z.string().max(200).optional(), + jurisdiction_level: z + .enum([ + "city", + "country", + "county", + "district", + "multiple", + "state", + ]) + .optional(), + percentage: z.coerce.number(), + state: z.string().max(5000).optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "retail_delivery_fee", + "rst", + "sales_tax", + "service_tax", + "vat", + ]) + .optional(), + }), + taxability_reason: z + .enum([ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ]) + .optional(), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }) + .optional() + + const postInvoicesInvoiceLinesLineItemIdResponseBodyValidator = + responseValidationFactory([["200", s_line_item]], s_error) + + // postInvoicesInvoiceLinesLineItemId + router.post( + `/v1/invoices/:invoice/lines/:line_item_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceLinesLineItemIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceLinesLineItemIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoiceLinesLineItemId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoicesInvoiceLinesLineItemIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceMarkUncollectibleParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoiceMarkUncollectibleRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postInvoicesInvoiceMarkUncollectibleResponseBodyValidator = + responseValidationFactory([["200", s_invoice]], s_error) + + // postInvoicesInvoiceMarkUncollectible + router.post( + `/v1/invoices/:invoice/mark_uncollectible`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceMarkUncollectibleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceMarkUncollectibleRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoiceMarkUncollectible( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoicesInvoiceMarkUncollectibleResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoicePayParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoicePayRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + forgive: PermissiveBoolean.optional(), + mandate: z.union([z.string().max(5000), z.enum([""])]).optional(), + off_session: PermissiveBoolean.optional(), + paid_out_of_band: PermissiveBoolean.optional(), + payment_method: z.string().max(5000).optional(), + source: z.string().max(5000).optional(), + }) + .optional() + + const postInvoicesInvoicePayResponseBodyValidator = responseValidationFactory( + [["200", s_invoice]], + s_error, + ) + + // postInvoicesInvoicePay + router.post( + `/v1/invoices/:invoice/pay`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoicePayParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoicePayRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoicePay(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postInvoicesInvoicePayResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceRemoveLinesParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoiceRemoveLinesRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + invoice_metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + lines: z.array( + z.object({ + behavior: z.enum(["delete", "unassign"]), + id: z.string().max(5000), + }), + ), + }) + + const postInvoicesInvoiceRemoveLinesResponseBodyValidator = + responseValidationFactory([["200", s_invoice]], s_error) + + // postInvoicesInvoiceRemoveLines + router.post( + `/v1/invoices/:invoice/remove_lines`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceRemoveLinesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceRemoveLinesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoiceRemoveLines(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoicesInvoiceRemoveLinesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceSendParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoiceSendRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postInvoicesInvoiceSendResponseBodyValidator = + responseValidationFactory([["200", s_invoice]], s_error) + + // postInvoicesInvoiceSend + router.post( + `/v1/invoices/:invoice/send`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceSendParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceSendRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoiceSend(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postInvoicesInvoiceSendResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceUpdateLinesParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoiceUpdateLinesRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + invoice_metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + lines: z.array( + z.object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + discountable: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + id: z.string().max(5000), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + period: z + .object({ end: z.coerce.number(), start: z.coerce.number() }) + .optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000).optional(), + product_data: z + .object({ + description: z.string().max(40000).optional(), + images: z.array(z.string()).optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000), + tax_code: z.string().max(5000).optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + pricing: z + .object({ price: z.string().max(5000).optional() }) + .optional(), + quantity: z.coerce.number().optional(), + tax_amounts: z + .union([ + z.array( + z.object({ + amount: z.coerce.number(), + tax_rate_data: z.object({ + country: z.string().max(5000).optional(), + description: z.string().max(5000).optional(), + display_name: z.string().max(100), + inclusive: PermissiveBoolean, + jurisdiction: z.string().max(200).optional(), + jurisdiction_level: z + .enum([ + "city", + "country", + "county", + "district", + "multiple", + "state", + ]) + .optional(), + percentage: z.coerce.number(), + state: z.string().max(5000).optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "retail_delivery_fee", + "rst", + "sales_tax", + "service_tax", + "vat", + ]) + .optional(), + }), + taxability_reason: z + .enum([ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ]) + .optional(), + taxable_amount: z.coerce.number(), + }), + ), + z.enum([""]), + ]) + .optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), + }) + + const postInvoicesInvoiceUpdateLinesResponseBodyValidator = + responseValidationFactory([["200", s_invoice]], s_error) + + // postInvoicesInvoiceUpdateLines + router.post( + `/v1/invoices/:invoice/update_lines`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceUpdateLinesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceUpdateLinesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoiceUpdateLines(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postInvoicesInvoiceUpdateLinesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postInvoicesInvoiceVoidParamSchema = z.object({ + invoice: z.string().max(5000), + }) + + const postInvoicesInvoiceVoidRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postInvoicesInvoiceVoidResponseBodyValidator = + responseValidationFactory([["200", s_invoice]], s_error) + + // postInvoicesInvoiceVoid + router.post( + `/v1/invoices/:invoice/void`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postInvoicesInvoiceVoidParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postInvoicesInvoiceVoidRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postInvoicesInvoiceVoid(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postInvoicesInvoiceVoidResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingAuthorizationsQuerySchema = z.object({ + card: z.string().max(5000).optional(), + cardholder: z.string().max(5000).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["closed", "expired", "pending", "reversed"]).optional(), + }) + + const getIssuingAuthorizationsRequestBodySchema = z.object({}).optional() + + const getIssuingAuthorizationsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_issuing_authorization)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/issuing/authorizations")), + }), + ], + ], + s_error, + ) + + // getIssuingAuthorizations + router.get( + `/v1/issuing/authorizations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIssuingAuthorizationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingAuthorizationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_issuing_authorization[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingAuthorizations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingAuthorizationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingAuthorizationsAuthorizationParamSchema = z.object({ + authorization: z.string().max(5000), + }) + + const getIssuingAuthorizationsAuthorizationQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingAuthorizationsAuthorizationRequestBodySchema = z + .object({}) + .optional() + + const getIssuingAuthorizationsAuthorizationResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // getIssuingAuthorizationsAuthorization + router.get( + `/v1/issuing/authorizations/:authorization`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingAuthorizationsAuthorizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingAuthorizationsAuthorizationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingAuthorizationsAuthorizationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingAuthorizationsAuthorization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIssuingAuthorizationsAuthorizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingAuthorizationsAuthorizationParamSchema = z.object({ + authorization: z.string().max(5000), + }) + + const postIssuingAuthorizationsAuthorizationRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postIssuingAuthorizationsAuthorizationResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postIssuingAuthorizationsAuthorization + router.post( + `/v1/issuing/authorizations/:authorization`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingAuthorizationsAuthorizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingAuthorizationsAuthorizationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingAuthorizationsAuthorization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingAuthorizationsAuthorizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingAuthorizationsAuthorizationApproveParamSchema = z.object({ + authorization: z.string().max(5000), + }) + + const postIssuingAuthorizationsAuthorizationApproveRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postIssuingAuthorizationsAuthorizationApproveResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postIssuingAuthorizationsAuthorizationApprove + router.post( + `/v1/issuing/authorizations/:authorization/approve`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingAuthorizationsAuthorizationApproveParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingAuthorizationsAuthorizationApproveRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingAuthorizationsAuthorizationApprove( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingAuthorizationsAuthorizationApproveResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingAuthorizationsAuthorizationDeclineParamSchema = z.object({ + authorization: z.string().max(5000), + }) + + const postIssuingAuthorizationsAuthorizationDeclineRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postIssuingAuthorizationsAuthorizationDeclineResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postIssuingAuthorizationsAuthorizationDecline + router.post( + `/v1/issuing/authorizations/:authorization/decline`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingAuthorizationsAuthorizationDeclineParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingAuthorizationsAuthorizationDeclineRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingAuthorizationsAuthorizationDecline( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingAuthorizationsAuthorizationDeclineResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingCardholdersQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + email: z.string().optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + phone_number: z.string().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["active", "blocked", "inactive"]).optional(), + type: z.enum(["company", "individual"]).optional(), + }) + + const getIssuingCardholdersRequestBodySchema = z.object({}).optional() + + const getIssuingCardholdersResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_issuing_cardholder)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/issuing/cardholders")), + }), + ], + ], + s_error, + ) + + // getIssuingCardholders + router.get( + `/v1/issuing/cardholders`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIssuingCardholdersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingCardholdersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_issuing_cardholder[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingCardholders(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingCardholdersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingCardholdersRequestBodySchema = z.object({ + billing: z.object({ + address: z.object({ + city: z.string().max(5000), + country: z.string().max(5000), + line1: z.string().max(5000), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000), + state: z.string().max(5000).optional(), + }), + }), + company: z.object({ tax_id: z.string().max(5000).optional() }).optional(), + email: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + individual: z + .object({ + card_issuing: z + .object({ + user_terms_acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + first_name: z.string().optional(), + last_name: z.string().optional(), + verification: z + .object({ + document: z + .object({ + back: z.string().max(5000).optional(), + front: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + name: z.string(), + phone_number: z.string().optional(), + preferred_locales: z + .array(z.enum(["de", "en", "es", "fr", "it"])) + .optional(), + spending_controls: z + .object({ + allowed_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + allowed_merchant_countries: z.array(z.string().max(5000)).optional(), + blocked_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + blocked_merchant_countries: z.array(z.string().max(5000)).optional(), + spending_limits: z + .array( + z.object({ + amount: z.coerce.number(), + categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + interval: z.enum([ + "all_time", + "daily", + "monthly", + "per_authorization", + "weekly", + "yearly", + ]), + }), + ) + .optional(), + spending_limits_currency: z.string().optional(), + }) + .optional(), + status: z.enum(["active", "inactive"]).optional(), + type: z.enum(["company", "individual"]).optional(), + }) + + const postIssuingCardholdersResponseBodyValidator = responseValidationFactory( + [["200", s_issuing_cardholder]], + s_error, + ) + + // postIssuingCardholders + router.post( + `/v1/issuing/cardholders`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postIssuingCardholdersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingCardholders(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postIssuingCardholdersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingCardholdersCardholderParamSchema = z.object({ + cardholder: z.string().max(5000), + }) + + const getIssuingCardholdersCardholderQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingCardholdersCardholderRequestBodySchema = z + .object({}) + .optional() + + const getIssuingCardholdersCardholderResponseBodyValidator = + responseValidationFactory([["200", s_issuing_cardholder]], s_error) + + // getIssuingCardholdersCardholder + router.get( + `/v1/issuing/cardholders/:cardholder`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingCardholdersCardholderParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingCardholdersCardholderQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingCardholdersCardholderRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingCardholdersCardholder(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIssuingCardholdersCardholderResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingCardholdersCardholderParamSchema = z.object({ + cardholder: z.string().max(5000), + }) + + const postIssuingCardholdersCardholderRequestBodySchema = z + .object({ + billing: z + .object({ + address: z.object({ + city: z.string().max(5000), + country: z.string().max(5000), + line1: z.string().max(5000), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000), + state: z.string().max(5000).optional(), + }), + }) + .optional(), + company: z.object({ tax_id: z.string().max(5000).optional() }).optional(), + email: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + individual: z + .object({ + card_issuing: z + .object({ + user_terms_acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + first_name: z.string().optional(), + last_name: z.string().optional(), + verification: z + .object({ + document: z + .object({ + back: z.string().max(5000).optional(), + front: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + phone_number: z.string().optional(), + preferred_locales: z + .array(z.enum(["de", "en", "es", "fr", "it"])) + .optional(), + spending_controls: z + .object({ + allowed_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + allowed_merchant_countries: z.array(z.string().max(5000)).optional(), + blocked_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + blocked_merchant_countries: z.array(z.string().max(5000)).optional(), + spending_limits: z + .array( + z.object({ + amount: z.coerce.number(), + categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + interval: z.enum([ + "all_time", + "daily", + "monthly", + "per_authorization", + "weekly", + "yearly", + ]), + }), + ) + .optional(), + spending_limits_currency: z.string().optional(), + }) + .optional(), + status: z.enum(["active", "inactive"]).optional(), + }) + .optional() + + const postIssuingCardholdersCardholderResponseBodyValidator = + responseValidationFactory([["200", s_issuing_cardholder]], s_error) + + // postIssuingCardholdersCardholder + router.post( + `/v1/issuing/cardholders/:cardholder`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingCardholdersCardholderParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingCardholdersCardholderRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingCardholdersCardholder(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingCardholdersCardholderResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingCardsQuerySchema = z.object({ + cardholder: z.string().max(5000).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + exp_month: z.coerce.number().optional(), + exp_year: z.coerce.number().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + last4: z.string().max(5000).optional(), + limit: z.coerce.number().optional(), + personalization_design: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["active", "canceled", "inactive"]).optional(), + type: z.enum(["physical", "virtual"]).optional(), + }) + + const getIssuingCardsRequestBodySchema = z.object({}).optional() + + const getIssuingCardsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_issuing_card)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/issuing/cards")), + }), + ], + ], + s_error, + ) + + // getIssuingCards + router.get( + `/v1/issuing/cards`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIssuingCardsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingCardsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_issuing_card[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingCards(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingCardsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingCardsRequestBodySchema = z.object({ + cardholder: z.string().max(5000).optional(), + currency: z.string(), + expand: z.array(z.string().max(5000)).optional(), + financial_account: z.string().optional(), + metadata: z.record(z.string()).optional(), + personalization_design: z.string().max(5000).optional(), + pin: z + .object({ encrypted_number: z.string().max(5000).optional() }) + .optional(), + replacement_for: z.string().max(5000).optional(), + replacement_reason: z + .enum(["damaged", "expired", "lost", "stolen"]) + .optional(), + second_line: z.union([z.string().max(5000), z.enum([""])]).optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000), + country: z.string().max(5000), + line1: z.string().max(5000), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000), + state: z.string().max(5000).optional(), + }), + address_validation: z + .object({ + mode: z.enum([ + "disabled", + "normalization_only", + "validation_and_normalization", + ]), + }) + .optional(), + customs: z + .object({ eori_number: z.string().max(5000).optional() }) + .optional(), + name: z.string().max(5000), + phone_number: z.string().optional(), + require_signature: PermissiveBoolean.optional(), + service: z.enum(["express", "priority", "standard"]).optional(), + type: z.enum(["bulk", "individual"]).optional(), + }) + .optional(), + spending_controls: z + .object({ + allowed_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + allowed_merchant_countries: z.array(z.string().max(5000)).optional(), + blocked_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + blocked_merchant_countries: z.array(z.string().max(5000)).optional(), + spending_limits: z + .array( + z.object({ + amount: z.coerce.number(), + categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + interval: z.enum([ + "all_time", + "daily", + "monthly", + "per_authorization", + "weekly", + "yearly", + ]), + }), + ) + .optional(), + }) + .optional(), + status: z.enum(["active", "inactive"]).optional(), + type: z.enum(["physical", "virtual"]), + }) + + const postIssuingCardsResponseBodyValidator = responseValidationFactory( + [["200", s_issuing_card]], + s_error, + ) + + // postIssuingCards + router.post( + `/v1/issuing/cards`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postIssuingCardsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingCards(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postIssuingCardsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingCardsCardParamSchema = z.object({ + card: z.string().max(5000), + }) + + const getIssuingCardsCardQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingCardsCardRequestBodySchema = z.object({}).optional() + + const getIssuingCardsCardResponseBodyValidator = responseValidationFactory( + [["200", s_issuing_card]], + s_error, + ) + + // getIssuingCardsCard + router.get( + `/v1/issuing/cards/:card`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingCardsCardParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingCardsCardQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingCardsCardRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingCardsCard(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingCardsCardResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingCardsCardParamSchema = z.object({ + card: z.string().max(5000), + }) + + const postIssuingCardsCardRequestBodySchema = z + .object({ + cancellation_reason: z.enum(["lost", "stolen"]).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + personalization_design: z.string().max(5000).optional(), + pin: z + .object({ encrypted_number: z.string().max(5000).optional() }) + .optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000), + country: z.string().max(5000), + line1: z.string().max(5000), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000), + state: z.string().max(5000).optional(), + }), + address_validation: z + .object({ + mode: z.enum([ + "disabled", + "normalization_only", + "validation_and_normalization", + ]), + }) + .optional(), + customs: z + .object({ eori_number: z.string().max(5000).optional() }) + .optional(), + name: z.string().max(5000), + phone_number: z.string().optional(), + require_signature: PermissiveBoolean.optional(), + service: z.enum(["express", "priority", "standard"]).optional(), + type: z.enum(["bulk", "individual"]).optional(), + }) + .optional(), + spending_controls: z + .object({ + allowed_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + allowed_merchant_countries: z.array(z.string().max(5000)).optional(), + blocked_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + blocked_merchant_countries: z.array(z.string().max(5000)).optional(), + spending_limits: z + .array( + z.object({ + amount: z.coerce.number(), + categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .optional(), + interval: z.enum([ + "all_time", + "daily", + "monthly", + "per_authorization", + "weekly", + "yearly", + ]), + }), + ) + .optional(), + }) + .optional(), + status: z.enum(["active", "canceled", "inactive"]).optional(), + }) + .optional() + + const postIssuingCardsCardResponseBodyValidator = responseValidationFactory( + [["200", s_issuing_card]], + s_error, + ) + + // postIssuingCardsCard + router.post( + `/v1/issuing/cards/:card`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingCardsCardParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingCardsCardRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingCardsCard(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postIssuingCardsCardResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingDisputesQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z + .enum(["expired", "lost", "submitted", "unsubmitted", "won"]) + .optional(), + transaction: z.string().max(5000).optional(), + }) + + const getIssuingDisputesRequestBodySchema = z.object({}).optional() + + const getIssuingDisputesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_issuing_dispute)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/issuing/disputes")), + }), + ], + ], + s_error, + ) + + // getIssuingDisputes + router.get( + `/v1/issuing/disputes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIssuingDisputesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingDisputesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_issuing_dispute[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingDisputes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingDisputesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingDisputesRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + evidence: z + .object({ + canceled: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + canceled_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + cancellation_policy_provided: z + .union([PermissiveBoolean, z.enum([""])]) + .optional(), + cancellation_reason: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + expected_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_type: z.enum(["", "merchandise", "service"]).optional(), + return_status: z + .enum(["", "merchant_rejected", "successful"]) + .optional(), + returned_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + duplicate: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + card_statement: z.union([z.string(), z.enum([""])]).optional(), + cash_receipt: z.union([z.string(), z.enum([""])]).optional(), + check_image: z.union([z.string(), z.enum([""])]).optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + original_transaction: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + fraudulent: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + merchandise_not_as_described: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + received_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + return_description: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + return_status: z + .enum(["", "merchant_rejected", "successful"]) + .optional(), + returned_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + no_valid_authorization: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + not_received: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + expected_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_type: z.enum(["", "merchandise", "service"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + other: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_type: z.enum(["", "merchandise", "service"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + reason: z + .enum([ + "canceled", + "duplicate", + "fraudulent", + "merchandise_not_as_described", + "no_valid_authorization", + "not_received", + "other", + "service_not_as_described", + ]) + .optional(), + service_not_as_described: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + canceled_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + cancellation_reason: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + received_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + transaction: z.string().max(5000).optional(), + treasury: z.object({ received_debit: z.string().max(5000) }).optional(), + }) + .optional() + + const postIssuingDisputesResponseBodyValidator = responseValidationFactory( + [["200", s_issuing_dispute]], + s_error, + ) + + // postIssuingDisputes + router.post( + `/v1/issuing/disputes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postIssuingDisputesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingDisputes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postIssuingDisputesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingDisputesDisputeParamSchema = z.object({ + dispute: z.string().max(5000), + }) + + const getIssuingDisputesDisputeQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingDisputesDisputeRequestBodySchema = z.object({}).optional() + + const getIssuingDisputesDisputeResponseBodyValidator = + responseValidationFactory([["200", s_issuing_dispute]], s_error) + + // getIssuingDisputesDispute + router.get( + `/v1/issuing/disputes/:dispute`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingDisputesDisputeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingDisputesDisputeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingDisputesDisputeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingDisputesDispute(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingDisputesDisputeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingDisputesDisputeParamSchema = z.object({ + dispute: z.string().max(5000), + }) + + const postIssuingDisputesDisputeRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + evidence: z + .object({ + canceled: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + canceled_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + cancellation_policy_provided: z + .union([PermissiveBoolean, z.enum([""])]) + .optional(), + cancellation_reason: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + expected_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_type: z.enum(["", "merchandise", "service"]).optional(), + return_status: z + .enum(["", "merchant_rejected", "successful"]) + .optional(), + returned_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + duplicate: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + card_statement: z.union([z.string(), z.enum([""])]).optional(), + cash_receipt: z.union([z.string(), z.enum([""])]).optional(), + check_image: z.union([z.string(), z.enum([""])]).optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + original_transaction: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + fraudulent: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + merchandise_not_as_described: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + received_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + return_description: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + return_status: z + .enum(["", "merchant_rejected", "successful"]) + .optional(), + returned_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + no_valid_authorization: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + not_received: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + expected_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_type: z.enum(["", "merchandise", "service"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + other: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + product_type: z.enum(["", "merchandise", "service"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + reason: z + .enum([ + "canceled", + "duplicate", + "fraudulent", + "merchandise_not_as_described", + "no_valid_authorization", + "not_received", + "other", + "service_not_as_described", + ]) + .optional(), + service_not_as_described: z + .union([ + z.object({ + additional_documentation: z + .union([z.string(), z.enum([""])]) + .optional(), + canceled_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + cancellation_reason: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + explanation: z + .union([z.string().max(2500), z.enum([""])]) + .optional(), + received_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postIssuingDisputesDisputeResponseBodyValidator = + responseValidationFactory([["200", s_issuing_dispute]], s_error) + + // postIssuingDisputesDispute + router.post( + `/v1/issuing/disputes/:dispute`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingDisputesDisputeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingDisputesDisputeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingDisputesDispute(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingDisputesDisputeResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingDisputesDisputeSubmitParamSchema = z.object({ + dispute: z.string().max(5000), + }) + + const postIssuingDisputesDisputeSubmitRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postIssuingDisputesDisputeSubmitResponseBodyValidator = + responseValidationFactory([["200", s_issuing_dispute]], s_error) + + // postIssuingDisputesDisputeSubmit + router.post( + `/v1/issuing/disputes/:dispute/submit`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingDisputesDisputeSubmitParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingDisputesDisputeSubmitRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingDisputesDisputeSubmit(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingDisputesDisputeSubmitResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingPersonalizationDesignsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + lookup_keys: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(200)), + ) + .optional(), + preferences: z + .object({ + is_default: PermissiveBoolean.optional(), + is_platform_default: PermissiveBoolean.optional(), + }) + .optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["active", "inactive", "rejected", "review"]).optional(), + }) + + const getIssuingPersonalizationDesignsRequestBodySchema = z + .object({}) + .optional() + + const getIssuingPersonalizationDesignsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_issuing_personalization_design)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/issuing/personalization_designs")), + }), + ], + ], + s_error, + ) + + // getIssuingPersonalizationDesigns + router.get( + `/v1/issuing/personalization_designs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIssuingPersonalizationDesignsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingPersonalizationDesignsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_issuing_personalization_design[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingPersonalizationDesigns(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIssuingPersonalizationDesignsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingPersonalizationDesignsRequestBodySchema = z.object({ + card_logo: z.string().optional(), + carrier_text: z + .object({ + footer_body: z.union([z.string().max(200), z.enum([""])]).optional(), + footer_title: z.union([z.string().max(30), z.enum([""])]).optional(), + header_body: z.union([z.string().max(200), z.enum([""])]).optional(), + header_title: z.union([z.string().max(30), z.enum([""])]).optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + lookup_key: z.string().max(200).optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(200).optional(), + physical_bundle: z.string().max(5000), + preferences: z.object({ is_default: PermissiveBoolean }).optional(), + transfer_lookup_key: PermissiveBoolean.optional(), + }) + + const postIssuingPersonalizationDesignsResponseBodyValidator = + responseValidationFactory( + [["200", s_issuing_personalization_design]], + s_error, + ) + + // postIssuingPersonalizationDesigns + router.post( + `/v1/issuing/personalization_designs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postIssuingPersonalizationDesignsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingPersonalizationDesigns(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingPersonalizationDesignsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingPersonalizationDesignsPersonalizationDesignParamSchema = + z.object({ personalization_design: z.string().max(5000) }) + + const getIssuingPersonalizationDesignsPersonalizationDesignQuerySchema = + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema = + z.object({}).optional() + + const getIssuingPersonalizationDesignsPersonalizationDesignResponseBodyValidator = + responseValidationFactory( + [["200", s_issuing_personalization_design]], + s_error, + ) + + // getIssuingPersonalizationDesignsPersonalizationDesign + router.get( + `/v1/issuing/personalization_designs/:personalization_design`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingPersonalizationDesignsPersonalizationDesignParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingPersonalizationDesignsPersonalizationDesignQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingPersonalizationDesignsPersonalizationDesign( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIssuingPersonalizationDesignsPersonalizationDesignResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingPersonalizationDesignsPersonalizationDesignParamSchema = + z.object({ personalization_design: z.string().max(5000) }) + + const postIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema = + z + .object({ + card_logo: z.union([z.string(), z.enum([""])]).optional(), + carrier_text: z + .union([ + z.object({ + footer_body: z + .union([z.string().max(200), z.enum([""])]) + .optional(), + footer_title: z + .union([z.string().max(30), z.enum([""])]) + .optional(), + header_body: z + .union([z.string().max(200), z.enum([""])]) + .optional(), + header_title: z + .union([z.string().max(30), z.enum([""])]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + lookup_key: z.union([z.string().max(200), z.enum([""])]).optional(), + metadata: z.record(z.string()).optional(), + name: z.union([z.string().max(200), z.enum([""])]).optional(), + physical_bundle: z.string().max(5000).optional(), + preferences: z.object({ is_default: PermissiveBoolean }).optional(), + transfer_lookup_key: PermissiveBoolean.optional(), + }) + .optional() + + const postIssuingPersonalizationDesignsPersonalizationDesignResponseBodyValidator = + responseValidationFactory( + [["200", s_issuing_personalization_design]], + s_error, + ) + + // postIssuingPersonalizationDesignsPersonalizationDesign + router.post( + `/v1/issuing/personalization_designs/:personalization_design`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingPersonalizationDesignsPersonalizationDesignParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingPersonalizationDesignsPersonalizationDesign( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingPersonalizationDesignsPersonalizationDesignResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingPhysicalBundlesQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["active", "inactive", "review"]).optional(), + type: z.enum(["custom", "standard"]).optional(), + }) + + const getIssuingPhysicalBundlesRequestBodySchema = z.object({}).optional() + + const getIssuingPhysicalBundlesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_issuing_physical_bundle), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/issuing/physical_bundles")), + }), + ], + ], + s_error, + ) + + // getIssuingPhysicalBundles + router.get( + `/v1/issuing/physical_bundles`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIssuingPhysicalBundlesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingPhysicalBundlesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_issuing_physical_bundle[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingPhysicalBundles(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingPhysicalBundlesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingPhysicalBundlesPhysicalBundleParamSchema = z.object({ + physical_bundle: z.string().max(5000), + }) + + const getIssuingPhysicalBundlesPhysicalBundleQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingPhysicalBundlesPhysicalBundleRequestBodySchema = z + .object({}) + .optional() + + const getIssuingPhysicalBundlesPhysicalBundleResponseBodyValidator = + responseValidationFactory([["200", s_issuing_physical_bundle]], s_error) + + // getIssuingPhysicalBundlesPhysicalBundle + router.get( + `/v1/issuing/physical_bundles/:physical_bundle`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingPhysicalBundlesPhysicalBundleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingPhysicalBundlesPhysicalBundleQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingPhysicalBundlesPhysicalBundleRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingPhysicalBundlesPhysicalBundle( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIssuingPhysicalBundlesPhysicalBundleResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingSettlementsSettlementParamSchema = z.object({ + settlement: z.string().max(5000), + }) + + const getIssuingSettlementsSettlementQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingSettlementsSettlementRequestBodySchema = z + .object({}) + .optional() + + const getIssuingSettlementsSettlementResponseBodyValidator = + responseValidationFactory([["200", s_issuing_settlement]], s_error) + + // getIssuingSettlementsSettlement + router.get( + `/v1/issuing/settlements/:settlement`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingSettlementsSettlementParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingSettlementsSettlementQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingSettlementsSettlementRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingSettlementsSettlement(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIssuingSettlementsSettlementResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingSettlementsSettlementParamSchema = z.object({ + settlement: z.string().max(5000), + }) + + const postIssuingSettlementsSettlementRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + }) + .optional() + + const postIssuingSettlementsSettlementResponseBodyValidator = + responseValidationFactory([["200", s_issuing_settlement]], s_error) + + // postIssuingSettlementsSettlement + router.post( + `/v1/issuing/settlements/:settlement`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingSettlementsSettlementParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingSettlementsSettlementRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingSettlementsSettlement(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingSettlementsSettlementResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingTokensQuerySchema = z.object({ + card: z.string().max(5000), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["active", "deleted", "requested", "suspended"]).optional(), + }) + + const getIssuingTokensRequestBodySchema = z.object({}).optional() + + const getIssuingTokensResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_issuing_token)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getIssuingTokens + router.get( + `/v1/issuing/tokens`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIssuingTokensQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingTokensRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_issuing_token[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingTokens(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingTokensResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingTokensTokenParamSchema = z.object({ + token: z.string().max(5000), + }) + + const getIssuingTokensTokenQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingTokensTokenRequestBodySchema = z.object({}).optional() + + const getIssuingTokensTokenResponseBodyValidator = responseValidationFactory( + [["200", s_issuing_token]], + s_error, + ) + + // getIssuingTokensToken + router.get( + `/v1/issuing/tokens/:token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingTokensTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingTokensTokenQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingTokensTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingTokensToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingTokensTokenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingTokensTokenParamSchema = z.object({ + token: z.string().max(5000), + }) + + const postIssuingTokensTokenRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + status: z.enum(["active", "deleted", "suspended"]), + }) + + const postIssuingTokensTokenResponseBodyValidator = responseValidationFactory( + [["200", s_issuing_token]], + s_error, + ) + + // postIssuingTokensToken + router.post( + `/v1/issuing/tokens/:token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingTokensTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingTokensTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingTokensToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postIssuingTokensTokenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingTransactionsQuerySchema = z.object({ + card: z.string().max(5000).optional(), + cardholder: z.string().max(5000).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + type: z.enum(["capture", "refund"]).optional(), + }) + + const getIssuingTransactionsRequestBodySchema = z.object({}).optional() + + const getIssuingTransactionsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_issuing_transaction)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/issuing/transactions")), + }), + ], + ], + s_error, + ) + + // getIssuingTransactions + router.get( + `/v1/issuing/transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getIssuingTransactionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_issuing_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingTransactions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getIssuingTransactionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getIssuingTransactionsTransactionParamSchema = z.object({ + transaction: z.string().max(5000), + }) + + const getIssuingTransactionsTransactionQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getIssuingTransactionsTransactionRequestBodySchema = z + .object({}) + .optional() + + const getIssuingTransactionsTransactionResponseBodyValidator = + responseValidationFactory([["200", s_issuing_transaction]], s_error) + + // getIssuingTransactionsTransaction + router.get( + `/v1/issuing/transactions/:transaction`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getIssuingTransactionsTransactionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getIssuingTransactionsTransactionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getIssuingTransactionsTransactionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getIssuingTransactionsTransaction(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getIssuingTransactionsTransactionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postIssuingTransactionsTransactionParamSchema = z.object({ + transaction: z.string().max(5000), + }) + + const postIssuingTransactionsTransactionRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postIssuingTransactionsTransactionResponseBodyValidator = + responseValidationFactory([["200", s_issuing_transaction]], s_error) + + // postIssuingTransactionsTransaction + router.post( + `/v1/issuing/transactions/:transaction`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postIssuingTransactionsTransactionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postIssuingTransactionsTransactionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postIssuingTransactionsTransaction(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postIssuingTransactionsTransactionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postLinkAccountSessionsRequestBodySchema = z.object({ + account_holder: z.object({ + account: z.string().max(5000).optional(), + customer: z.string().max(5000).optional(), + type: z.enum(["account", "customer"]), + }), + expand: z.array(z.string().max(5000)).optional(), + filters: z + .object({ + account_subcategories: z + .array( + z.enum([ + "checking", + "credit_card", + "line_of_credit", + "mortgage", + "savings", + ]), + ) + .optional(), + countries: z.array(z.string().max(5000)).optional(), + }) + .optional(), + permissions: z.array( + z.enum(["balances", "ownership", "payment_method", "transactions"]), + ), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + return_url: z.string().max(5000).optional(), + }) + + const postLinkAccountSessionsResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_session]], + s_error, + ) + + // postLinkAccountSessions + router.post( + `/v1/link_account_sessions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postLinkAccountSessionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postLinkAccountSessions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postLinkAccountSessionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getLinkAccountSessionsSessionParamSchema = z.object({ + session: z.string().max(5000), + }) + + const getLinkAccountSessionsSessionQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getLinkAccountSessionsSessionRequestBodySchema = z.object({}).optional() + + const getLinkAccountSessionsSessionResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_session]], + s_error, + ) + + // getLinkAccountSessionsSession + router.get( + `/v1/link_account_sessions/:session`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getLinkAccountSessionsSessionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getLinkAccountSessionsSessionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getLinkAccountSessionsSessionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getLinkAccountSessionsSession(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getLinkAccountSessionsSessionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getLinkedAccountsQuerySchema = z.object({ + account_holder: z + .object({ + account: z.string().max(5000).optional(), + customer: z.string().max(5000).optional(), + }) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + session: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getLinkedAccountsRequestBodySchema = z.object({}).optional() + + const getLinkedAccountsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_financial_connections_account)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/financial_connections/accounts")), + }), + ], + ], + s_error, + ) + + // getLinkedAccounts + router.get( + `/v1/linked_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getLinkedAccountsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getLinkedAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_financial_connections_account[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getLinkedAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getLinkedAccountsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getLinkedAccountsAccountParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getLinkedAccountsAccountQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getLinkedAccountsAccountRequestBodySchema = z.object({}).optional() + + const getLinkedAccountsAccountResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_account]], + s_error, + ) + + // getLinkedAccountsAccount + router.get( + `/v1/linked_accounts/:account`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getLinkedAccountsAccountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getLinkedAccountsAccountQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getLinkedAccountsAccountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getLinkedAccountsAccount(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getLinkedAccountsAccountResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postLinkedAccountsAccountDisconnectParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postLinkedAccountsAccountDisconnectRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postLinkedAccountsAccountDisconnectResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_account]], + s_error, + ) + + // postLinkedAccountsAccountDisconnect + router.post( + `/v1/linked_accounts/:account/disconnect`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postLinkedAccountsAccountDisconnectParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postLinkedAccountsAccountDisconnectRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postLinkedAccountsAccountDisconnect(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postLinkedAccountsAccountDisconnectResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getLinkedAccountsAccountOwnersParamSchema = z.object({ + account: z.string().max(5000), + }) + + const getLinkedAccountsAccountOwnersQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + ownership: z.string().max(5000), + starting_after: z.string().max(5000).optional(), + }) + + const getLinkedAccountsAccountOwnersRequestBodySchema = z + .object({}) + .optional() + + const getLinkedAccountsAccountOwnersResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_financial_connections_account_owner), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getLinkedAccountsAccountOwners + router.get( + `/v1/linked_accounts/:account/owners`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getLinkedAccountsAccountOwnersParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getLinkedAccountsAccountOwnersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getLinkedAccountsAccountOwnersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_financial_connections_account_owner[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getLinkedAccountsAccountOwners(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getLinkedAccountsAccountOwnersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postLinkedAccountsAccountRefreshParamSchema = z.object({ + account: z.string().max(5000), + }) + + const postLinkedAccountsAccountRefreshRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + features: z.array(z.enum(["balance", "ownership", "transactions"])), + }) + + const postLinkedAccountsAccountRefreshResponseBodyValidator = + responseValidationFactory( + [["200", s_financial_connections_account]], + s_error, + ) + + // postLinkedAccountsAccountRefresh + router.post( + `/v1/linked_accounts/:account/refresh`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postLinkedAccountsAccountRefreshParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postLinkedAccountsAccountRefreshRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postLinkedAccountsAccountRefresh(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postLinkedAccountsAccountRefreshResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getMandatesMandateParamSchema = z.object({ mandate: z.string() }) + + const getMandatesMandateQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getMandatesMandateRequestBodySchema = z.object({}).optional() + + const getMandatesMandateResponseBodyValidator = responseValidationFactory( + [["200", s_mandate]], + s_error, + ) + + // getMandatesMandate + router.get( + `/v1/mandates/:mandate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getMandatesMandateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getMandatesMandateQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getMandatesMandateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getMandatesMandate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getMandatesMandateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentIntentsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getPaymentIntentsRequestBodySchema = z.object({}).optional() + + const getPaymentIntentsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_payment_intent)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/payment_intents")), + }), + ], + ], + s_error, + ) + + // getPaymentIntents + router.get( + `/v1/payment_intents`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPaymentIntentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentIntentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_payment_intent[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentIntents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPaymentIntentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentIntentsRequestBodySchema = z.object({ + amount: z.coerce.number(), + application_fee_amount: z.coerce.number().optional(), + automatic_payment_methods: z + .object({ + allow_redirects: z.enum(["always", "never"]).optional(), + enabled: PermissiveBoolean, + }) + .optional(), + capture_method: z + .enum(["automatic", "automatic_async", "manual"]) + .optional(), + confirm: PermissiveBoolean.optional(), + confirmation_method: z.enum(["automatic", "manual"]).optional(), + confirmation_token: z.string().max(5000).optional(), + currency: z.string(), + customer: z.string().max(5000).optional(), + description: z.string().max(1000).optional(), + error_on_requires_action: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + mandate: z.string().max(5000).optional(), + mandate_data: z + .union([ + z.object({ + customer_acceptance: z.object({ + accepted_at: z.coerce.number().optional(), + offline: z.object({}).optional(), + online: z + .object({ + ip_address: z.string(), + user_agent: z.string().max(5000), + }) + .optional(), + type: z.enum(["offline", "online"]), + }), + }), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + off_session: z + .union([PermissiveBoolean, z.enum(["one_off", "recurring"])]) + .optional(), + on_behalf_of: z.string().optional(), + payment_method: z.string().max(5000).optional(), + payment_method_configuration: z.string().max(100).optional(), + payment_method_data: z + .object({ + acss_debit: z + .object({ + account_number: z.string().max(5000), + institution_number: z.string().max(5000), + transit_number: z.string().max(5000), + }) + .optional(), + affirm: z.object({}).optional(), + afterpay_clearpay: z.object({}).optional(), + alipay: z.object({}).optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + alma: z.object({}).optional(), + amazon_pay: z.object({}).optional(), + au_becs_debit: z + .object({ + account_number: z.string().max(5000), + bsb_number: z.string().max(5000), + }) + .optional(), + bacs_debit: z + .object({ + account_number: z.string().max(5000).optional(), + sort_code: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z.object({}).optional(), + billie: z.object({}).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + blik: z.object({}).optional(), + boleto: z.object({ tax_id: z.string().max(5000) }).optional(), + cashapp: z.object({}).optional(), + customer_balance: z.object({}).optional(), + eps: z + .object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .optional(), + }) + .optional(), + fpx: z + .object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + }) + .optional(), + giropay: z.object({}).optional(), + grabpay: z.object({}).optional(), + ideal: z + .object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .optional(), + }) + .optional(), + interac_present: z.object({}).optional(), + kakao_pay: z.object({}).optional(), + klarna: z + .object({ + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + }) + .optional(), + konbini: z.object({}).optional(), + kr_card: z.object({}).optional(), + link: z.object({}).optional(), + metadata: z.record(z.string()).optional(), + mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), + naver_pay: z + .object({ funding: z.enum(["card", "points"]).optional() }) + .optional(), + nz_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000), + bank_code: z.string().max(5000), + branch_code: z.string().max(5000), + reference: z.string().max(128).optional(), + suffix: z.string().max(5000), + }) + .optional(), + oxxo: z.object({}).optional(), + p24: z + .object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z.object({}).optional(), + paynow: z.object({}).optional(), + paypal: z.object({}).optional(), + pix: z.object({}).optional(), + promptpay: z.object({}).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + revolut_pay: z.object({}).optional(), + samsung_pay: z.object({}).optional(), + satispay: z.object({}).optional(), + sepa_debit: z.object({ iban: z.string().max(5000) }).optional(), + sofort: z + .object({ country: z.enum(["AT", "BE", "DE", "ES", "IT", "NL"]) }) + .optional(), + swish: z.object({}).optional(), + twint: z.object({}).optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + wechat_pay: z.object({}).optional(), + zip: z.object({}).optional(), + }) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + custom_mandate_url: z + .union([z.string(), z.enum([""])]) + .optional(), + interval_description: z.string().max(500).optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .optional(), + transaction_type: z.enum(["business", "personal"]).optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + affirm: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z.string().max(30).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + afterpay_clearpay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + reference: z.string().max(128).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + alipay: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + alma: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + amazon_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + au_becs_debit: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + bacs_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z.enum(["de", "en", "fr", "nl"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + blik: z + .union([ + z.object({ + code: z.string().max(5000).optional(), + setup_future_usage: z.enum(["", "none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + boleto: z + .union([ + z.object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + cvc_token: z.string().max(5000).optional(), + installments: z + .object({ + enabled: PermissiveBoolean.optional(), + plan: z + .union([ + z.object({ + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), + type: z.enum(["fixed_count"]), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + mandate_options: z + .object({ + amount: z.coerce.number(), + amount_type: z.enum(["fixed", "maximum"]), + description: z.string().max(200).optional(), + end_date: z.coerce.number().optional(), + interval: z.enum([ + "day", + "month", + "sporadic", + "week", + "year", + ]), + interval_count: z.coerce.number().optional(), + reference: z.string().max(80), + start_date: z.coerce.number(), + supported_types: z.array(z.enum(["india"])).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_extended_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_incremental_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_multicapture: z + .enum(["if_available", "never"]) + .optional(), + request_overcapture: z.enum(["if_available", "never"]).optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + require_cvc_recollection: PermissiveBoolean.optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + statement_descriptor_suffix_kana: z + .union([z.string().max(22), z.enum([""])]) + .optional(), + statement_descriptor_suffix_kanji: z + .union([z.string().max(17), z.enum([""])]) + .optional(), + three_d_secure: z + .object({ + ares_trans_status: z + .enum(["A", "C", "I", "N", "R", "U", "Y"]) + .optional(), + cryptogram: z.string().max(5000), + electronic_commerce_indicator: z + .enum(["01", "02", "05", "06", "07"]) + .optional(), + exemption_indicator: z.enum(["low_risk", "none"]).optional(), + network_options: z + .object({ + cartes_bancaires: z + .object({ + cb_avalgo: z.enum(["0", "1", "2", "3", "4", "A"]), + cb_exemption: z.string().max(4).optional(), + cb_score: z.coerce.number().optional(), + }) + .optional(), + }) + .optional(), + requestor_challenge_indicator: z.string().max(2).optional(), + transaction_id: z.string().max(5000), + version: z.enum(["1.0.2", "2.1.0", "2.2.0"]), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card_present: z + .union([ + z.object({ + request_extended_authorization: PermissiveBoolean.optional(), + request_incremental_authorization_support: + PermissiveBoolean.optional(), + routing: z + .object({ + requested_priority: z + .enum(["domestic", "international"]) + .optional(), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + cashapp: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + requested_address_types: z + .array( + z.enum([ + "aba", + "iban", + "sepa", + "sort_code", + "spei", + "swift", + "zengin", + ]), + ) + .optional(), + type: z.enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]), + }) + .optional(), + funding_type: z.enum(["bank_transfer"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + eps: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + fpx: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + giropay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + grabpay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + ideal: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + interac_present: z.union([z.object({}), z.enum([""])]).optional(), + kakao_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + klarna: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z + .enum([ + "cs-CZ", + "da-DK", + "de-AT", + "de-CH", + "de-DE", + "el-GR", + "en-AT", + "en-AU", + "en-BE", + "en-CA", + "en-CH", + "en-CZ", + "en-DE", + "en-DK", + "en-ES", + "en-FI", + "en-FR", + "en-GB", + "en-GR", + "en-IE", + "en-IT", + "en-NL", + "en-NO", + "en-NZ", + "en-PL", + "en-PT", + "en-RO", + "en-SE", + "en-US", + "es-ES", + "es-US", + "fi-FI", + "fr-BE", + "fr-CA", + "fr-CH", + "fr-FR", + "it-CH", + "it-IT", + "nb-NO", + "nl-BE", + "nl-NL", + "pl-PL", + "pt-PT", + "ro-RO", + "sv-FI", + "sv-SE", + ]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z + .union([ + z.object({ + confirmation_number: z + .union([z.string().max(11), z.enum([""])]) + .optional(), + expires_after_days: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + expires_at: z.union([z.coerce.number(), z.enum([""])]).optional(), + product_description: z + .union([z.string().max(22), z.enum([""])]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + kr_card: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + link: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + mobilepay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + multibanco: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + naver_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + nz_bank_account: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + oxxo: z + .union([ + z.object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + p24: z + .union([ + z.object({ + setup_future_usage: z.enum(["none"]).optional(), + tos_shown_and_accepted: PermissiveBoolean.optional(), + }), + z.enum([""]), + ]) + .optional(), + pay_by_bank: z.union([z.object({}), z.enum([""])]).optional(), + payco: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + paynow: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + paypal: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z + .enum([ + "cs-CZ", + "da-DK", + "de-AT", + "de-DE", + "de-LU", + "el-GR", + "en-GB", + "en-US", + "es-ES", + "fi-FI", + "fr-BE", + "fr-FR", + "fr-LU", + "hu-HU", + "it-IT", + "nl-BE", + "nl-NL", + "pl-PL", + "pt-PT", + "sk-SK", + "sv-SE", + ]) + .optional(), + reference: z.string().max(127).optional(), + risk_correlation_id: z.string().max(32).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + pix: z + .union([ + z.object({ + expires_after_seconds: z.coerce.number().optional(), + expires_at: z.coerce.number().optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + promptpay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + revolut_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + samsung_pay: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + sepa_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + sofort: z + .union([ + z.object({ + preferred_language: z + .enum(["", "de", "en", "es", "fr", "it", "nl", "pl"]) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + swish: z + .union([ + z.object({ + reference: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + twint: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + return_url: z.string().max(5000).optional(), + }) + .optional(), + mandate_options: z + .object({ collection_method: z.enum(["", "paper"]).optional() }) + .optional(), + networks: z + .object({ + requested: z + .array(z.enum(["ach", "us_domestic_wire"])) + .optional(), + }) + .optional(), + preferred_settlement_speed: z + .enum(["", "fastest", "standard"]) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + wechat_pay: z + .union([ + z.object({ + app_id: z.string().max(5000).optional(), + client: z.enum(["android", "ios", "web"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + zip: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z.array(z.string().max(5000)).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + receipt_email: z.string().optional(), + return_url: z.string().optional(), + setup_future_usage: z.enum(["off_session", "on_session"]).optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + carrier: z.string().max(5000).optional(), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + tracking_number: z.string().max(5000).optional(), + }) + .optional(), + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_suffix: z.string().max(22).optional(), + transfer_data: z + .object({ amount: z.coerce.number().optional(), destination: z.string() }) + .optional(), + transfer_group: z.string().optional(), + use_stripe_sdk: PermissiveBoolean.optional(), + }) + + const postPaymentIntentsResponseBodyValidator = responseValidationFactory( + [["200", s_payment_intent]], + s_error, + ) + + // postPaymentIntents + router.post( + `/v1/payment_intents`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPaymentIntentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentIntents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPaymentIntentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentIntentsSearchQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + page: z.string().max(5000).optional(), + query: z.string().max(5000), + }) + + const getPaymentIntentsSearchRequestBodySchema = z.object({}).optional() + + const getPaymentIntentsSearchResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_payment_intent)), + has_more: PermissiveBoolean, + next_page: z.string().max(5000).nullable().optional(), + object: z.enum(["search_result"]), + total_count: z.coerce.number().optional(), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getPaymentIntentsSearch + router.get( + `/v1/payment_intents/search`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPaymentIntentsSearchQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentIntentsSearchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_payment_intent[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentIntentsSearch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPaymentIntentsSearchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentIntentsIntentParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const getPaymentIntentsIntentQuerySchema = z.object({ + client_secret: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPaymentIntentsIntentRequestBodySchema = z.object({}).optional() + + const getPaymentIntentsIntentResponseBodyValidator = + responseValidationFactory([["200", s_payment_intent]], s_error) + + // getPaymentIntentsIntent + router.get( + `/v1/payment_intents/:intent`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPaymentIntentsIntentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPaymentIntentsIntentQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentIntentsIntentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentIntentsIntent(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPaymentIntentsIntentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentIntentsIntentParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postPaymentIntentsIntentRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + application_fee_amount: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + capture_method: z + .enum(["automatic", "automatic_async", "manual"]) + .optional(), + currency: z.string().optional(), + customer: z.string().max(5000).optional(), + description: z.string().max(1000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + payment_method: z.string().max(5000).optional(), + payment_method_configuration: z.string().max(100).optional(), + payment_method_data: z + .object({ + acss_debit: z + .object({ + account_number: z.string().max(5000), + institution_number: z.string().max(5000), + transit_number: z.string().max(5000), + }) + .optional(), + affirm: z.object({}).optional(), + afterpay_clearpay: z.object({}).optional(), + alipay: z.object({}).optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + alma: z.object({}).optional(), + amazon_pay: z.object({}).optional(), + au_becs_debit: z + .object({ + account_number: z.string().max(5000), + bsb_number: z.string().max(5000), + }) + .optional(), + bacs_debit: z + .object({ + account_number: z.string().max(5000).optional(), + sort_code: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z.object({}).optional(), + billie: z.object({}).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + blik: z.object({}).optional(), + boleto: z.object({ tax_id: z.string().max(5000) }).optional(), + cashapp: z.object({}).optional(), + customer_balance: z.object({}).optional(), + eps: z + .object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .optional(), + }) + .optional(), + fpx: z + .object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + }) + .optional(), + giropay: z.object({}).optional(), + grabpay: z.object({}).optional(), + ideal: z + .object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .optional(), + }) + .optional(), + interac_present: z.object({}).optional(), + kakao_pay: z.object({}).optional(), + klarna: z + .object({ + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + }) + .optional(), + konbini: z.object({}).optional(), + kr_card: z.object({}).optional(), + link: z.object({}).optional(), + metadata: z.record(z.string()).optional(), + mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), + naver_pay: z + .object({ funding: z.enum(["card", "points"]).optional() }) + .optional(), + nz_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000), + bank_code: z.string().max(5000), + branch_code: z.string().max(5000), + reference: z.string().max(128).optional(), + suffix: z.string().max(5000), + }) + .optional(), + oxxo: z.object({}).optional(), + p24: z + .object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z.object({}).optional(), + paynow: z.object({}).optional(), + paypal: z.object({}).optional(), + pix: z.object({}).optional(), + promptpay: z.object({}).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + revolut_pay: z.object({}).optional(), + samsung_pay: z.object({}).optional(), + satispay: z.object({}).optional(), + sepa_debit: z.object({ iban: z.string().max(5000) }).optional(), + sofort: z + .object({ country: z.enum(["AT", "BE", "DE", "ES", "IT", "NL"]) }) + .optional(), + swish: z.object({}).optional(), + twint: z.object({}).optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + wechat_pay: z.object({}).optional(), + zip: z.object({}).optional(), + }) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + custom_mandate_url: z + .union([z.string(), z.enum([""])]) + .optional(), + interval_description: z.string().max(500).optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .optional(), + transaction_type: z + .enum(["business", "personal"]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + affirm: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z.string().max(30).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + afterpay_clearpay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + reference: z.string().max(128).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + alipay: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + alma: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + amazon_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + au_becs_debit: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + bacs_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z.enum(["de", "en", "fr", "nl"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + blik: z + .union([ + z.object({ + code: z.string().max(5000).optional(), + setup_future_usage: z.enum(["", "none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + boleto: z + .union([ + z.object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + cvc_token: z.string().max(5000).optional(), + installments: z + .object({ + enabled: PermissiveBoolean.optional(), + plan: z + .union([ + z.object({ + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), + type: z.enum(["fixed_count"]), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + mandate_options: z + .object({ + amount: z.coerce.number(), + amount_type: z.enum(["fixed", "maximum"]), + description: z.string().max(200).optional(), + end_date: z.coerce.number().optional(), + interval: z.enum([ + "day", + "month", + "sporadic", + "week", + "year", + ]), + interval_count: z.coerce.number().optional(), + reference: z.string().max(80), + start_date: z.coerce.number(), + supported_types: z.array(z.enum(["india"])).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_extended_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_incremental_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_multicapture: z + .enum(["if_available", "never"]) + .optional(), + request_overcapture: z + .enum(["if_available", "never"]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + require_cvc_recollection: PermissiveBoolean.optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + statement_descriptor_suffix_kana: z + .union([z.string().max(22), z.enum([""])]) + .optional(), + statement_descriptor_suffix_kanji: z + .union([z.string().max(17), z.enum([""])]) + .optional(), + three_d_secure: z + .object({ + ares_trans_status: z + .enum(["A", "C", "I", "N", "R", "U", "Y"]) + .optional(), + cryptogram: z.string().max(5000), + electronic_commerce_indicator: z + .enum(["01", "02", "05", "06", "07"]) + .optional(), + exemption_indicator: z + .enum(["low_risk", "none"]) + .optional(), + network_options: z + .object({ + cartes_bancaires: z + .object({ + cb_avalgo: z.enum(["0", "1", "2", "3", "4", "A"]), + cb_exemption: z.string().max(4).optional(), + cb_score: z.coerce.number().optional(), + }) + .optional(), + }) + .optional(), + requestor_challenge_indicator: z.string().max(2).optional(), + transaction_id: z.string().max(5000), + version: z.enum(["1.0.2", "2.1.0", "2.2.0"]), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card_present: z + .union([ + z.object({ + request_extended_authorization: PermissiveBoolean.optional(), + request_incremental_authorization_support: + PermissiveBoolean.optional(), + routing: z + .object({ + requested_priority: z + .enum(["domestic", "international"]) + .optional(), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + cashapp: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + requested_address_types: z + .array( + z.enum([ + "aba", + "iban", + "sepa", + "sort_code", + "spei", + "swift", + "zengin", + ]), + ) + .optional(), + type: z.enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]), + }) + .optional(), + funding_type: z.enum(["bank_transfer"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + eps: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + fpx: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + giropay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + grabpay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + ideal: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + interac_present: z.union([z.object({}), z.enum([""])]).optional(), + kakao_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + klarna: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z + .enum([ + "cs-CZ", + "da-DK", + "de-AT", + "de-CH", + "de-DE", + "el-GR", + "en-AT", + "en-AU", + "en-BE", + "en-CA", + "en-CH", + "en-CZ", + "en-DE", + "en-DK", + "en-ES", + "en-FI", + "en-FR", + "en-GB", + "en-GR", + "en-IE", + "en-IT", + "en-NL", + "en-NO", + "en-NZ", + "en-PL", + "en-PT", + "en-RO", + "en-SE", + "en-US", + "es-ES", + "es-US", + "fi-FI", + "fr-BE", + "fr-CA", + "fr-CH", + "fr-FR", + "it-CH", + "it-IT", + "nb-NO", + "nl-BE", + "nl-NL", + "pl-PL", + "pt-PT", + "ro-RO", + "sv-FI", + "sv-SE", + ]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z + .union([ + z.object({ + confirmation_number: z + .union([z.string().max(11), z.enum([""])]) + .optional(), + expires_after_days: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + expires_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(22), z.enum([""])]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + kr_card: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + link: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + mobilepay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + multibanco: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + naver_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + nz_bank_account: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + oxxo: z + .union([ + z.object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + p24: z + .union([ + z.object({ + setup_future_usage: z.enum(["none"]).optional(), + tos_shown_and_accepted: PermissiveBoolean.optional(), + }), + z.enum([""]), + ]) + .optional(), + pay_by_bank: z.union([z.object({}), z.enum([""])]).optional(), + payco: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + paynow: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + paypal: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z + .enum([ + "cs-CZ", + "da-DK", + "de-AT", + "de-DE", + "de-LU", + "el-GR", + "en-GB", + "en-US", + "es-ES", + "fi-FI", + "fr-BE", + "fr-FR", + "fr-LU", + "hu-HU", + "it-IT", + "nl-BE", + "nl-NL", + "pl-PL", + "pt-PT", + "sk-SK", + "sv-SE", + ]) + .optional(), + reference: z.string().max(127).optional(), + risk_correlation_id: z.string().max(32).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + pix: z + .union([ + z.object({ + expires_after_seconds: z.coerce.number().optional(), + expires_at: z.coerce.number().optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + promptpay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + revolut_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + samsung_pay: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + sepa_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + sofort: z + .union([ + z.object({ + preferred_language: z + .enum(["", "de", "en", "es", "fr", "it", "nl", "pl"]) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + swish: z + .union([ + z.object({ + reference: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + twint: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + return_url: z.string().max(5000).optional(), + }) + .optional(), + mandate_options: z + .object({ + collection_method: z.enum(["", "paper"]).optional(), + }) + .optional(), + networks: z + .object({ + requested: z + .array(z.enum(["ach", "us_domestic_wire"])) + .optional(), + }) + .optional(), + preferred_settlement_speed: z + .enum(["", "fastest", "standard"]) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + wechat_pay: z + .union([ + z.object({ + app_id: z.string().max(5000).optional(), + client: z.enum(["android", "ios", "web"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + zip: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z.array(z.string().max(5000)).optional(), + receipt_email: z.union([z.string(), z.enum([""])]).optional(), + setup_future_usage: z.enum(["", "off_session", "on_session"]).optional(), + shipping: z + .union([ + z.object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + carrier: z.string().max(5000).optional(), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + tracking_number: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_suffix: z.string().max(22).optional(), + transfer_data: z + .object({ amount: z.coerce.number().optional() }) + .optional(), + transfer_group: z.string().optional(), + }) + .optional() + + const postPaymentIntentsIntentResponseBodyValidator = + responseValidationFactory([["200", s_payment_intent]], s_error) + + // postPaymentIntentsIntent + router.post( + `/v1/payment_intents/:intent`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentIntentsIntentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentIntentsIntentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentIntentsIntent(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPaymentIntentsIntentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentIntentsIntentApplyCustomerBalanceParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postPaymentIntentsIntentApplyCustomerBalanceRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postPaymentIntentsIntentApplyCustomerBalanceResponseBodyValidator = + responseValidationFactory([["200", s_payment_intent]], s_error) + + // postPaymentIntentsIntentApplyCustomerBalance + router.post( + `/v1/payment_intents/:intent/apply_customer_balance`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentIntentsIntentApplyCustomerBalanceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentIntentsIntentApplyCustomerBalanceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentIntentsIntentApplyCustomerBalance( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentIntentsIntentApplyCustomerBalanceResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentIntentsIntentCancelParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postPaymentIntentsIntentCancelRequestBodySchema = z + .object({ + cancellation_reason: z + .enum(["abandoned", "duplicate", "fraudulent", "requested_by_customer"]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postPaymentIntentsIntentCancelResponseBodyValidator = + responseValidationFactory([["200", s_payment_intent]], s_error) + + // postPaymentIntentsIntentCancel + router.post( + `/v1/payment_intents/:intent/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentIntentsIntentCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentIntentsIntentCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentIntentsIntentCancel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentIntentsIntentCancelResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentIntentsIntentCaptureParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postPaymentIntentsIntentCaptureRequestBodySchema = z + .object({ + amount_to_capture: z.coerce.number().optional(), + application_fee_amount: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + final_capture: PermissiveBoolean.optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_suffix: z.string().max(22).optional(), + transfer_data: z + .object({ amount: z.coerce.number().optional() }) + .optional(), + }) + .optional() + + const postPaymentIntentsIntentCaptureResponseBodyValidator = + responseValidationFactory([["200", s_payment_intent]], s_error) + + // postPaymentIntentsIntentCapture + router.post( + `/v1/payment_intents/:intent/capture`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentIntentsIntentCaptureParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentIntentsIntentCaptureRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentIntentsIntentCapture(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentIntentsIntentCaptureResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentIntentsIntentConfirmParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postPaymentIntentsIntentConfirmRequestBodySchema = z + .object({ + capture_method: z + .enum(["automatic", "automatic_async", "manual"]) + .optional(), + client_secret: z.string().max(5000).optional(), + confirmation_token: z.string().max(5000).optional(), + error_on_requires_action: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + mandate: z.string().max(5000).optional(), + mandate_data: z + .union([ + z.object({ + customer_acceptance: z.object({ + accepted_at: z.coerce.number().optional(), + offline: z.object({}).optional(), + online: z + .object({ + ip_address: z.string(), + user_agent: z.string().max(5000), + }) + .optional(), + type: z.enum(["offline", "online"]), + }), + }), + z.enum([""]), + z.object({ + customer_acceptance: z.object({ + online: z.object({ + ip_address: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }), + type: z.enum(["online"]), + }), + }), + ]) + .optional(), + off_session: z + .union([PermissiveBoolean, z.enum(["one_off", "recurring"])]) + .optional(), + payment_method: z.string().max(5000).optional(), + payment_method_data: z + .object({ + acss_debit: z + .object({ + account_number: z.string().max(5000), + institution_number: z.string().max(5000), + transit_number: z.string().max(5000), + }) + .optional(), + affirm: z.object({}).optional(), + afterpay_clearpay: z.object({}).optional(), + alipay: z.object({}).optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + alma: z.object({}).optional(), + amazon_pay: z.object({}).optional(), + au_becs_debit: z + .object({ + account_number: z.string().max(5000), + bsb_number: z.string().max(5000), + }) + .optional(), + bacs_debit: z + .object({ + account_number: z.string().max(5000).optional(), + sort_code: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z.object({}).optional(), + billie: z.object({}).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + blik: z.object({}).optional(), + boleto: z.object({ tax_id: z.string().max(5000) }).optional(), + cashapp: z.object({}).optional(), + customer_balance: z.object({}).optional(), + eps: z + .object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .optional(), + }) + .optional(), + fpx: z + .object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + }) + .optional(), + giropay: z.object({}).optional(), + grabpay: z.object({}).optional(), + ideal: z + .object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .optional(), + }) + .optional(), + interac_present: z.object({}).optional(), + kakao_pay: z.object({}).optional(), + klarna: z + .object({ + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + }) + .optional(), + konbini: z.object({}).optional(), + kr_card: z.object({}).optional(), + link: z.object({}).optional(), + metadata: z.record(z.string()).optional(), + mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), + naver_pay: z + .object({ funding: z.enum(["card", "points"]).optional() }) + .optional(), + nz_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000), + bank_code: z.string().max(5000), + branch_code: z.string().max(5000), + reference: z.string().max(128).optional(), + suffix: z.string().max(5000), + }) + .optional(), + oxxo: z.object({}).optional(), + p24: z + .object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z.object({}).optional(), + paynow: z.object({}).optional(), + paypal: z.object({}).optional(), + pix: z.object({}).optional(), + promptpay: z.object({}).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + revolut_pay: z.object({}).optional(), + samsung_pay: z.object({}).optional(), + satispay: z.object({}).optional(), + sepa_debit: z.object({ iban: z.string().max(5000) }).optional(), + sofort: z + .object({ country: z.enum(["AT", "BE", "DE", "ES", "IT", "NL"]) }) + .optional(), + swish: z.object({}).optional(), + twint: z.object({}).optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + wechat_pay: z.object({}).optional(), + zip: z.object({}).optional(), + }) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + custom_mandate_url: z + .union([z.string(), z.enum([""])]) + .optional(), + interval_description: z.string().max(500).optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .optional(), + transaction_type: z + .enum(["business", "personal"]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + affirm: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z.string().max(30).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + afterpay_clearpay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + reference: z.string().max(128).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + alipay: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + alma: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + amazon_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + au_becs_debit: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + bacs_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z.enum(["de", "en", "fr", "nl"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + blik: z + .union([ + z.object({ + code: z.string().max(5000).optional(), + setup_future_usage: z.enum(["", "none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + boleto: z + .union([ + z.object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + cvc_token: z.string().max(5000).optional(), + installments: z + .object({ + enabled: PermissiveBoolean.optional(), + plan: z + .union([ + z.object({ + count: z.coerce.number().optional(), + interval: z.enum(["month"]).optional(), + type: z.enum(["fixed_count"]), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + mandate_options: z + .object({ + amount: z.coerce.number(), + amount_type: z.enum(["fixed", "maximum"]), + description: z.string().max(200).optional(), + end_date: z.coerce.number().optional(), + interval: z.enum([ + "day", + "month", + "sporadic", + "week", + "year", + ]), + interval_count: z.coerce.number().optional(), + reference: z.string().max(80), + start_date: z.coerce.number(), + supported_types: z.array(z.enum(["india"])).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_extended_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_incremental_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_multicapture: z + .enum(["if_available", "never"]) + .optional(), + request_overcapture: z + .enum(["if_available", "never"]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + require_cvc_recollection: PermissiveBoolean.optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + statement_descriptor_suffix_kana: z + .union([z.string().max(22), z.enum([""])]) + .optional(), + statement_descriptor_suffix_kanji: z + .union([z.string().max(17), z.enum([""])]) + .optional(), + three_d_secure: z + .object({ + ares_trans_status: z + .enum(["A", "C", "I", "N", "R", "U", "Y"]) + .optional(), + cryptogram: z.string().max(5000), + electronic_commerce_indicator: z + .enum(["01", "02", "05", "06", "07"]) + .optional(), + exemption_indicator: z + .enum(["low_risk", "none"]) + .optional(), + network_options: z + .object({ + cartes_bancaires: z + .object({ + cb_avalgo: z.enum(["0", "1", "2", "3", "4", "A"]), + cb_exemption: z.string().max(4).optional(), + cb_score: z.coerce.number().optional(), + }) + .optional(), + }) + .optional(), + requestor_challenge_indicator: z.string().max(2).optional(), + transaction_id: z.string().max(5000), + version: z.enum(["1.0.2", "2.1.0", "2.2.0"]), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card_present: z + .union([ + z.object({ + request_extended_authorization: PermissiveBoolean.optional(), + request_incremental_authorization_support: + PermissiveBoolean.optional(), + routing: z + .object({ + requested_priority: z + .enum(["domestic", "international"]) + .optional(), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + cashapp: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + requested_address_types: z + .array( + z.enum([ + "aba", + "iban", + "sepa", + "sort_code", + "spei", + "swift", + "zengin", + ]), + ) + .optional(), + type: z.enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]), + }) + .optional(), + funding_type: z.enum(["bank_transfer"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + eps: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + fpx: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + giropay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + grabpay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + ideal: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + interac_present: z.union([z.object({}), z.enum([""])]).optional(), + kakao_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + klarna: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z + .enum([ + "cs-CZ", + "da-DK", + "de-AT", + "de-CH", + "de-DE", + "el-GR", + "en-AT", + "en-AU", + "en-BE", + "en-CA", + "en-CH", + "en-CZ", + "en-DE", + "en-DK", + "en-ES", + "en-FI", + "en-FR", + "en-GB", + "en-GR", + "en-IE", + "en-IT", + "en-NL", + "en-NO", + "en-NZ", + "en-PL", + "en-PT", + "en-RO", + "en-SE", + "en-US", + "es-ES", + "es-US", + "fi-FI", + "fr-BE", + "fr-CA", + "fr-CH", + "fr-FR", + "it-CH", + "it-IT", + "nb-NO", + "nl-BE", + "nl-NL", + "pl-PL", + "pt-PT", + "ro-RO", + "sv-FI", + "sv-SE", + ]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z + .union([ + z.object({ + confirmation_number: z + .union([z.string().max(11), z.enum([""])]) + .optional(), + expires_after_days: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + expires_at: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + product_description: z + .union([z.string().max(22), z.enum([""])]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + kr_card: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + link: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + mobilepay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + multibanco: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + naver_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + nz_bank_account: z + .union([ + z.object({ + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + oxxo: z + .union([ + z.object({ + expires_after_days: z.coerce.number().optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + p24: z + .union([ + z.object({ + setup_future_usage: z.enum(["none"]).optional(), + tos_shown_and_accepted: PermissiveBoolean.optional(), + }), + z.enum([""]), + ]) + .optional(), + pay_by_bank: z.union([z.object({}), z.enum([""])]).optional(), + payco: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + paynow: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + paypal: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + preferred_locale: z + .enum([ + "cs-CZ", + "da-DK", + "de-AT", + "de-DE", + "de-LU", + "el-GR", + "en-GB", + "en-US", + "es-ES", + "fi-FI", + "fr-BE", + "fr-FR", + "fr-LU", + "hu-HU", + "it-IT", + "nl-BE", + "nl-NL", + "pl-PL", + "pt-PT", + "sk-SK", + "sv-SE", + ]) + .optional(), + reference: z.string().max(127).optional(), + risk_correlation_id: z.string().max(32).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + pix: z + .union([ + z.object({ + expires_after_seconds: z.coerce.number().optional(), + expires_at: z.coerce.number().optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + promptpay: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + revolut_pay: z + .union([ + z.object({ + capture_method: z.enum(["", "manual"]).optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + samsung_pay: z + .union([ + z.object({ capture_method: z.enum(["", "manual"]).optional() }), + z.enum([""]), + ]) + .optional(), + sepa_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + sofort: z + .union([ + z.object({ + preferred_language: z + .enum(["", "de", "en", "es", "fr", "it", "nl", "pl"]) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + swish: z + .union([ + z.object({ + reference: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + twint: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + return_url: z.string().max(5000).optional(), + }) + .optional(), + mandate_options: z + .object({ + collection_method: z.enum(["", "paper"]).optional(), + }) + .optional(), + networks: z + .object({ + requested: z + .array(z.enum(["ach", "us_domestic_wire"])) + .optional(), + }) + .optional(), + preferred_settlement_speed: z + .enum(["", "fastest", "standard"]) + .optional(), + setup_future_usage: z + .enum(["", "none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + wechat_pay: z + .union([ + z.object({ + app_id: z.string().max(5000).optional(), + client: z.enum(["android", "ios", "web"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + zip: z + .union([ + z.object({ setup_future_usage: z.enum(["none"]).optional() }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z.array(z.string().max(5000)).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + receipt_email: z.union([z.string(), z.enum([""])]).optional(), + return_url: z.string().optional(), + setup_future_usage: z.enum(["", "off_session", "on_session"]).optional(), + shipping: z + .union([ + z.object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + carrier: z.string().max(5000).optional(), + name: z.string().max(5000), + phone: z.string().max(5000).optional(), + tracking_number: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + use_stripe_sdk: PermissiveBoolean.optional(), + }) + .optional() + + const postPaymentIntentsIntentConfirmResponseBodyValidator = + responseValidationFactory([["200", s_payment_intent]], s_error) + + // postPaymentIntentsIntentConfirm + router.post( + `/v1/payment_intents/:intent/confirm`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentIntentsIntentConfirmParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentIntentsIntentConfirmRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentIntentsIntentConfirm(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentIntentsIntentConfirmResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentIntentsIntentIncrementAuthorizationParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postPaymentIntentsIntentIncrementAuthorizationRequestBodySchema = + z.object({ + amount: z.coerce.number(), + application_fee_amount: z.coerce.number().optional(), + description: z.string().max(1000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + statement_descriptor: z.string().max(22).optional(), + transfer_data: z + .object({ amount: z.coerce.number().optional() }) + .optional(), + }) + + const postPaymentIntentsIntentIncrementAuthorizationResponseBodyValidator = + responseValidationFactory([["200", s_payment_intent]], s_error) + + // postPaymentIntentsIntentIncrementAuthorization + router.post( + `/v1/payment_intents/:intent/increment_authorization`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentIntentsIntentIncrementAuthorizationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentIntentsIntentIncrementAuthorizationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentIntentsIntentIncrementAuthorization( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentIntentsIntentIncrementAuthorizationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentIntentsIntentVerifyMicrodepositsParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postPaymentIntentsIntentVerifyMicrodepositsRequestBodySchema = z + .object({ + amounts: z.array(z.coerce.number()).optional(), + client_secret: z.string().max(5000).optional(), + descriptor_code: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postPaymentIntentsIntentVerifyMicrodepositsResponseBodyValidator = + responseValidationFactory([["200", s_payment_intent]], s_error) + + // postPaymentIntentsIntentVerifyMicrodeposits + router.post( + `/v1/payment_intents/:intent/verify_microdeposits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentIntentsIntentVerifyMicrodepositsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentIntentsIntentVerifyMicrodepositsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentIntentsIntentVerifyMicrodeposits( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentIntentsIntentVerifyMicrodepositsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentLinksQuerySchema = z.object({ + active: PermissiveBoolean.optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getPaymentLinksRequestBodySchema = z.object({}).optional() + + const getPaymentLinksResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_payment_link)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/payment_links")), + }), + ], + ], + s_error, + ) + + // getPaymentLinks + router.get( + `/v1/payment_links`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPaymentLinksQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentLinksRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_payment_link[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentLinks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPaymentLinksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentLinksRequestBodySchema = z.object({ + after_completion: z + .object({ + hosted_confirmation: z + .object({ custom_message: z.string().max(500).optional() }) + .optional(), + redirect: z.object({ url: z.string().max(2048) }).optional(), + type: z.enum(["hosted_confirmation", "redirect"]), + }) + .optional(), + allow_promotion_codes: PermissiveBoolean.optional(), + application_fee_amount: z.coerce.number().optional(), + application_fee_percent: z.coerce.number().optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_address_collection: z.enum(["auto", "required"]).optional(), + consent_collection: z + .object({ + payment_method_reuse_agreement: z + .object({ position: z.enum(["auto", "hidden"]) }) + .optional(), + promotions: z.enum(["auto", "none"]).optional(), + terms_of_service: z.enum(["none", "required"]).optional(), + }) + .optional(), + currency: z.string().optional(), + custom_fields: z + .array( + z.object({ + dropdown: z + .object({ + default_value: z.string().max(100).optional(), + options: z.array( + z.object({ + label: z.string().max(100), + value: z.string().max(100), + }), + ), + }) + .optional(), + key: z.string().max(200), + label: z.object({ + custom: z.string().max(50), + type: z.enum(["custom"]), + }), + numeric: z + .object({ + default_value: z.string().max(255).optional(), + maximum_length: z.coerce.number().optional(), + minimum_length: z.coerce.number().optional(), + }) + .optional(), + optional: PermissiveBoolean.optional(), + text: z + .object({ + default_value: z.string().max(255).optional(), + maximum_length: z.coerce.number().optional(), + minimum_length: z.coerce.number().optional(), + }) + .optional(), + type: z.enum(["dropdown", "numeric", "text"]), + }), + ) + .optional(), + custom_text: z + .object({ + after_submit: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + shipping_address: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + submit: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + terms_of_service_acceptance: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + }) + .optional(), + customer_creation: z.enum(["always", "if_required"]).optional(), + expand: z.array(z.string().max(5000)).optional(), + inactive_message: z.string().max(500).optional(), + invoice_creation: z + .object({ + enabled: PermissiveBoolean, + invoice_data: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + custom_fields: z + .union([ + z.array( + z.object({ + name: z.string().max(40), + value: z.string().max(140), + }), + ), + z.enum([""]), + ]) + .optional(), + description: z.string().max(1500).optional(), + footer: z.string().max(5000).optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + rendering_options: z + .union([ + z.object({ + amount_tax_display: z + .enum(["", "exclude_tax", "include_inclusive_tax"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + }) + .optional(), + line_items: z.array( + z.object({ + adjustable_quantity: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + }) + .optional(), + price: z.string().max(5000), + quantity: z.coerce.number(), + }), + ), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.string().optional(), + optional_items: z + .array( + z.object({ + adjustable_quantity: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + }) + .optional(), + price: z.string().max(5000), + quantity: z.coerce.number(), + }), + ) + .optional(), + payment_intent_data: z + .object({ + capture_method: z + .enum(["automatic", "automatic_async", "manual"]) + .optional(), + description: z.string().max(1000).optional(), + metadata: z.record(z.string()).optional(), + setup_future_usage: z.enum(["off_session", "on_session"]).optional(), + statement_descriptor: z.string().max(22).optional(), + statement_descriptor_suffix: z.string().max(22).optional(), + transfer_group: z.string().max(5000).optional(), + }) + .optional(), + payment_method_collection: z.enum(["always", "if_required"]).optional(), + payment_method_types: z + .array( + z.enum([ + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "klarna", + "konbini", + "link", + "mobilepay", + "multibanco", + "oxxo", + "p24", + "pay_by_bank", + "paynow", + "paypal", + "pix", + "promptpay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + ) + .optional(), + phone_number_collection: z + .object({ enabled: PermissiveBoolean }) + .optional(), + restrictions: z + .object({ completed_sessions: z.object({ limit: z.coerce.number() }) }) + .optional(), + shipping_address_collection: z + .object({ + allowed_countries: z.array( + z.enum([ + "AC", + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MK", + "ML", + "MM", + "MN", + "MO", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TA", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + "ZZ", + ]), + ), + }) + .optional(), + shipping_options: z + .array(z.object({ shipping_rate: z.string().max(5000).optional() })) + .optional(), + submit_type: z + .enum(["auto", "book", "donate", "pay", "subscribe"]) + .optional(), + subscription_data: z + .object({ + description: z.string().max(500).optional(), + invoice_settings: z + .object({ + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + trial_period_days: z.coerce.number().optional(), + trial_settings: z + .object({ + end_behavior: z.object({ + missing_payment_method: z.enum([ + "cancel", + "create_invoice", + "pause", + ]), + }), + }) + .optional(), + }) + .optional(), + tax_id_collection: z + .object({ + enabled: PermissiveBoolean, + required: z.enum(["if_supported", "never"]).optional(), + }) + .optional(), + transfer_data: z + .object({ amount: z.coerce.number().optional(), destination: z.string() }) + .optional(), + }) + + const postPaymentLinksResponseBodyValidator = responseValidationFactory( + [["200", s_payment_link]], + s_error, + ) + + // postPaymentLinks + router.post( + `/v1/payment_links`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPaymentLinksRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentLinks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPaymentLinksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentLinksPaymentLinkParamSchema = z.object({ + payment_link: z.string().max(5000), + }) + + const getPaymentLinksPaymentLinkQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPaymentLinksPaymentLinkRequestBodySchema = z.object({}).optional() + + const getPaymentLinksPaymentLinkResponseBodyValidator = + responseValidationFactory([["200", s_payment_link]], s_error) + + // getPaymentLinksPaymentLink + router.get( + `/v1/payment_links/:payment_link`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPaymentLinksPaymentLinkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPaymentLinksPaymentLinkQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentLinksPaymentLinkRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentLinksPaymentLink(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getPaymentLinksPaymentLinkResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentLinksPaymentLinkParamSchema = z.object({ + payment_link: z.string().max(5000), + }) + + const postPaymentLinksPaymentLinkRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + after_completion: z + .object({ + hosted_confirmation: z + .object({ custom_message: z.string().max(500).optional() }) + .optional(), + redirect: z.object({ url: z.string().max(2048) }).optional(), + type: z.enum(["hosted_confirmation", "redirect"]), + }) + .optional(), + allow_promotion_codes: PermissiveBoolean.optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_address_collection: z.enum(["auto", "required"]).optional(), + custom_fields: z + .union([ + z.array( + z.object({ + dropdown: z + .object({ + default_value: z.string().max(100).optional(), + options: z.array( + z.object({ + label: z.string().max(100), + value: z.string().max(100), + }), + ), + }) + .optional(), + key: z.string().max(200), + label: z.object({ + custom: z.string().max(50), + type: z.enum(["custom"]), + }), + numeric: z + .object({ + default_value: z.string().max(255).optional(), + maximum_length: z.coerce.number().optional(), + minimum_length: z.coerce.number().optional(), + }) + .optional(), + optional: PermissiveBoolean.optional(), + text: z + .object({ + default_value: z.string().max(255).optional(), + maximum_length: z.coerce.number().optional(), + minimum_length: z.coerce.number().optional(), + }) + .optional(), + type: z.enum(["dropdown", "numeric", "text"]), + }), + ), + z.enum([""]), + ]) + .optional(), + custom_text: z + .object({ + after_submit: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + shipping_address: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + submit: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + terms_of_service_acceptance: z + .union([z.object({ message: z.string().max(1200) }), z.enum([""])]) + .optional(), + }) + .optional(), + customer_creation: z.enum(["always", "if_required"]).optional(), + expand: z.array(z.string().max(5000)).optional(), + inactive_message: z.union([z.string().max(500), z.enum([""])]).optional(), + invoice_creation: z + .object({ + enabled: PermissiveBoolean, + invoice_data: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + custom_fields: z + .union([ + z.array( + z.object({ + name: z.string().max(40), + value: z.string().max(140), + }), + ), + z.enum([""]), + ]) + .optional(), + description: z.string().max(1500).optional(), + footer: z.string().max(5000).optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + metadata: z + .union([z.record(z.string()), z.enum([""])]) + .optional(), + rendering_options: z + .union([ + z.object({ + amount_tax_display: z + .enum(["", "exclude_tax", "include_inclusive_tax"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + }) + .optional(), + line_items: z + .array( + z.object({ + adjustable_quantity: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + }) + .optional(), + id: z.string().max(5000), + quantity: z.coerce.number().optional(), + }), + ) + .optional(), + metadata: z.record(z.string()).optional(), + payment_intent_data: z + .object({ + description: z.union([z.string().max(1000), z.enum([""])]).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + statement_descriptor: z + .union([z.string().max(22), z.enum([""])]) + .optional(), + statement_descriptor_suffix: z + .union([z.string().max(22), z.enum([""])]) + .optional(), + transfer_group: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + payment_method_collection: z.enum(["always", "if_required"]).optional(), + payment_method_types: z + .union([ + z.array( + z.enum([ + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "klarna", + "konbini", + "link", + "mobilepay", + "multibanco", + "oxxo", + "p24", + "pay_by_bank", + "paynow", + "paypal", + "pix", + "promptpay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + ), + z.enum([""]), + ]) + .optional(), + phone_number_collection: z + .object({ enabled: PermissiveBoolean }) + .optional(), + restrictions: z + .union([ + z.object({ + completed_sessions: z.object({ limit: z.coerce.number() }), + }), + z.enum([""]), + ]) + .optional(), + shipping_address_collection: z + .union([ + z.object({ + allowed_countries: z.array( + z.enum([ + "AC", + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MK", + "ML", + "MM", + "MN", + "MO", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TA", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + "ZZ", + ]), + ), + }), + z.enum([""]), + ]) + .optional(), + submit_type: z + .enum(["auto", "book", "donate", "pay", "subscribe"]) + .optional(), + subscription_data: z + .object({ + invoice_settings: z + .object({ + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + trial_period_days: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + trial_settings: z + .union([ + z.object({ + end_behavior: z.object({ + missing_payment_method: z.enum([ + "cancel", + "create_invoice", + "pause", + ]), + }), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + tax_id_collection: z + .object({ + enabled: PermissiveBoolean, + required: z.enum(["if_supported", "never"]).optional(), + }) + .optional(), + }) + .optional() + + const postPaymentLinksPaymentLinkResponseBodyValidator = + responseValidationFactory([["200", s_payment_link]], s_error) + + // postPaymentLinksPaymentLink + router.post( + `/v1/payment_links/:payment_link`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentLinksPaymentLinkParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentLinksPaymentLinkRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentLinksPaymentLink(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentLinksPaymentLinkResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentLinksPaymentLinkLineItemsParamSchema = z.object({ + payment_link: z.string().max(5000), + }) + + const getPaymentLinksPaymentLinkLineItemsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getPaymentLinksPaymentLinkLineItemsRequestBodySchema = z + .object({}) + .optional() + + const getPaymentLinksPaymentLinkLineItemsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getPaymentLinksPaymentLinkLineItems + router.get( + `/v1/payment_links/:payment_link/line_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPaymentLinksPaymentLinkLineItemsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPaymentLinksPaymentLinkLineItemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentLinksPaymentLinkLineItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentLinksPaymentLinkLineItems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getPaymentLinksPaymentLinkLineItemsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentMethodConfigurationsQuerySchema = z.object({ + application: z.union([z.string().max(100), z.enum([""])]).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getPaymentMethodConfigurationsRequestBodySchema = z + .object({}) + .optional() + + const getPaymentMethodConfigurationsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_payment_method_configuration), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/payment_method_configurations")), + }), + ], + ], + s_error, + ) + + // getPaymentMethodConfigurations + router.get( + `/v1/payment_method_configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPaymentMethodConfigurationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentMethodConfigurationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_payment_method_configuration[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentMethodConfigurations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getPaymentMethodConfigurationsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodConfigurationsRequestBodySchema = z + .object({ + acss_debit: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + affirm: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + afterpay_clearpay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + alipay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + alma: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + amazon_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + apple_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + apple_pay_later: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + au_becs_debit: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + bacs_debit: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + bancontact: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + billie: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + blik: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + boleto: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + card: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + cartes_bancaires: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + cashapp: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + customer_balance: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + eps: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + fpx: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + giropay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + google_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + grabpay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + ideal: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + jcb: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + klarna: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + konbini: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + link: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + mobilepay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + multibanco: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + name: z.string().max(100).optional(), + nz_bank_account: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + oxxo: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + p24: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + parent: z.string().max(100).optional(), + pay_by_bank: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + paynow: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + paypal: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + promptpay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + revolut_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + satispay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + sepa_debit: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + sofort: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + swish: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + twint: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + us_bank_account: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + wechat_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + zip: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + }) + .optional() + + const postPaymentMethodConfigurationsResponseBodyValidator = + responseValidationFactory( + [["200", s_payment_method_configuration]], + s_error, + ) + + // postPaymentMethodConfigurations + router.post( + `/v1/payment_method_configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPaymentMethodConfigurationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethodConfigurations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentMethodConfigurationsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentMethodConfigurationsConfigurationParamSchema = z.object({ + configuration: z.string().max(5000), + }) + + const getPaymentMethodConfigurationsConfigurationQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPaymentMethodConfigurationsConfigurationRequestBodySchema = z + .object({}) + .optional() + + const getPaymentMethodConfigurationsConfigurationResponseBodyValidator = + responseValidationFactory( + [["200", s_payment_method_configuration]], + s_error, + ) + + // getPaymentMethodConfigurationsConfiguration + router.get( + `/v1/payment_method_configurations/:configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPaymentMethodConfigurationsConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPaymentMethodConfigurationsConfigurationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentMethodConfigurationsConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentMethodConfigurationsConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getPaymentMethodConfigurationsConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodConfigurationsConfigurationParamSchema = z.object({ + configuration: z.string().max(5000), + }) + + const postPaymentMethodConfigurationsConfigurationRequestBodySchema = z + .object({ + acss_debit: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + active: PermissiveBoolean.optional(), + affirm: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + afterpay_clearpay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + alipay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + alma: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + amazon_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + apple_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + apple_pay_later: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + au_becs_debit: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + bacs_debit: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + bancontact: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + billie: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + blik: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + boleto: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + card: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + cartes_bancaires: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + cashapp: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + customer_balance: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + eps: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + fpx: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + giropay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + google_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + grabpay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + ideal: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + jcb: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + klarna: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + konbini: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + link: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + mobilepay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + multibanco: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + name: z.string().max(100).optional(), + nz_bank_account: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + oxxo: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + p24: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + pay_by_bank: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + paynow: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + paypal: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + promptpay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + revolut_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + satispay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + sepa_debit: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + sofort: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + swish: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + twint: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + us_bank_account: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + wechat_pay: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + zip: z + .object({ + display_preference: z + .object({ preference: z.enum(["none", "off", "on"]).optional() }) + .optional(), + }) + .optional(), + }) + .optional() + + const postPaymentMethodConfigurationsConfigurationResponseBodyValidator = + responseValidationFactory( + [["200", s_payment_method_configuration]], + s_error, + ) + + // postPaymentMethodConfigurationsConfiguration + router.post( + `/v1/payment_method_configurations/:configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentMethodConfigurationsConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentMethodConfigurationsConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethodConfigurationsConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentMethodConfigurationsConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentMethodDomainsQuerySchema = z.object({ + domain_name: z.string().max(5000).optional(), + enabled: PermissiveBoolean.optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getPaymentMethodDomainsRequestBodySchema = z.object({}).optional() + + const getPaymentMethodDomainsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_payment_method_domain), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/payment_method_domains")), + }), + ], + ], + s_error, + ) + + // getPaymentMethodDomains + router.get( + `/v1/payment_method_domains`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPaymentMethodDomainsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentMethodDomainsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_payment_method_domain[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentMethodDomains(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPaymentMethodDomainsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodDomainsRequestBodySchema = z.object({ + domain_name: z.string().max(5000), + enabled: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + + const postPaymentMethodDomainsResponseBodyValidator = + responseValidationFactory([["200", s_payment_method_domain]], s_error) + + // postPaymentMethodDomains + router.post( + `/v1/payment_method_domains`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPaymentMethodDomainsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethodDomains(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPaymentMethodDomainsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentMethodDomainsPaymentMethodDomainParamSchema = z.object({ + payment_method_domain: z.string().max(5000), + }) + + const getPaymentMethodDomainsPaymentMethodDomainQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPaymentMethodDomainsPaymentMethodDomainRequestBodySchema = z + .object({}) + .optional() + + const getPaymentMethodDomainsPaymentMethodDomainResponseBodyValidator = + responseValidationFactory([["200", s_payment_method_domain]], s_error) + + // getPaymentMethodDomainsPaymentMethodDomain + router.get( + `/v1/payment_method_domains/:payment_method_domain`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPaymentMethodDomainsPaymentMethodDomainParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPaymentMethodDomainsPaymentMethodDomainQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentMethodDomainsPaymentMethodDomainRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentMethodDomainsPaymentMethodDomain( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getPaymentMethodDomainsPaymentMethodDomainResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodDomainsPaymentMethodDomainParamSchema = z.object({ + payment_method_domain: z.string().max(5000), + }) + + const postPaymentMethodDomainsPaymentMethodDomainRequestBodySchema = z + .object({ + enabled: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postPaymentMethodDomainsPaymentMethodDomainResponseBodyValidator = + responseValidationFactory([["200", s_payment_method_domain]], s_error) + + // postPaymentMethodDomainsPaymentMethodDomain + router.post( + `/v1/payment_method_domains/:payment_method_domain`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentMethodDomainsPaymentMethodDomainParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentMethodDomainsPaymentMethodDomainRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethodDomainsPaymentMethodDomain( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentMethodDomainsPaymentMethodDomainResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodDomainsPaymentMethodDomainValidateParamSchema = + z.object({ payment_method_domain: z.string().max(5000) }) + + const postPaymentMethodDomainsPaymentMethodDomainValidateRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postPaymentMethodDomainsPaymentMethodDomainValidateResponseBodyValidator = + responseValidationFactory([["200", s_payment_method_domain]], s_error) + + // postPaymentMethodDomainsPaymentMethodDomainValidate + router.post( + `/v1/payment_method_domains/:payment_method_domain/validate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentMethodDomainsPaymentMethodDomainValidateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentMethodDomainsPaymentMethodDomainValidateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethodDomainsPaymentMethodDomainValidate( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentMethodDomainsPaymentMethodDomainValidateResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentMethodsQuerySchema = z.object({ + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + type: z + .enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]) + .optional(), + }) + + const getPaymentMethodsRequestBodySchema = z.object({}).optional() + + const getPaymentMethodsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_payment_method)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/payment_methods")), + }), + ], + ], + s_error, + ) + + // getPaymentMethods + router.get( + `/v1/payment_methods`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPaymentMethodsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentMethodsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_payment_method[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentMethods(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPaymentMethodsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodsRequestBodySchema = z + .object({ + acss_debit: z + .object({ + account_number: z.string().max(5000), + institution_number: z.string().max(5000), + transit_number: z.string().max(5000), + }) + .optional(), + affirm: z.object({}).optional(), + afterpay_clearpay: z.object({}).optional(), + alipay: z.object({}).optional(), + allow_redisplay: z.enum(["always", "limited", "unspecified"]).optional(), + alma: z.object({}).optional(), + amazon_pay: z.object({}).optional(), + au_becs_debit: z + .object({ + account_number: z.string().max(5000), + bsb_number: z.string().max(5000), + }) + .optional(), + bacs_debit: z + .object({ + account_number: z.string().max(5000).optional(), + sort_code: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z.object({}).optional(), + billie: z.object({}).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + blik: z.object({}).optional(), + boleto: z.object({ tax_id: z.string().max(5000) }).optional(), + card: z + .union([ + z.object({ + cvc: z.string().max(5000).optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + networks: z + .object({ + preferred: z + .enum(["cartes_bancaires", "mastercard", "visa"]) + .optional(), + }) + .optional(), + number: z.string().max(5000), + }), + z.object({ token: z.string().max(5000) }), + ]) + .optional(), + cashapp: z.object({}).optional(), + customer: z.string().max(5000).optional(), + customer_balance: z.object({}).optional(), + eps: z + .object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + fpx: z + .object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + }) + .optional(), + giropay: z.object({}).optional(), + grabpay: z.object({}).optional(), + ideal: z + .object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .optional(), + }) + .optional(), + interac_present: z.object({}).optional(), + kakao_pay: z.object({}).optional(), + klarna: z + .object({ + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + }) + .optional(), + konbini: z.object({}).optional(), + kr_card: z.object({}).optional(), + link: z.object({}).optional(), + metadata: z.record(z.string()).optional(), + mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), + naver_pay: z + .object({ funding: z.enum(["card", "points"]).optional() }) + .optional(), + nz_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000), + bank_code: z.string().max(5000), + branch_code: z.string().max(5000), + reference: z.string().max(128).optional(), + suffix: z.string().max(5000), + }) + .optional(), + oxxo: z.object({}).optional(), + p24: z + .object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z.object({}).optional(), + payment_method: z.string().max(5000).optional(), + paynow: z.object({}).optional(), + paypal: z.object({}).optional(), + pix: z.object({}).optional(), + promptpay: z.object({}).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + revolut_pay: z.object({}).optional(), + samsung_pay: z.object({}).optional(), + satispay: z.object({}).optional(), + sepa_debit: z.object({ iban: z.string().max(5000) }).optional(), + sofort: z + .object({ country: z.enum(["AT", "BE", "DE", "ES", "IT", "NL"]) }) + .optional(), + swish: z.object({}).optional(), + twint: z.object({}).optional(), + type: z + .enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]) + .optional(), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + wechat_pay: z.object({}).optional(), + zip: z.object({}).optional(), + }) + .optional() + + const postPaymentMethodsResponseBodyValidator = responseValidationFactory( + [["200", s_payment_method]], + s_error, + ) + + // postPaymentMethods + router.post( + `/v1/payment_methods`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPaymentMethodsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethods(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPaymentMethodsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPaymentMethodsPaymentMethodParamSchema = z.object({ + payment_method: z.string().max(5000), + }) + + const getPaymentMethodsPaymentMethodQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPaymentMethodsPaymentMethodRequestBodySchema = z + .object({}) + .optional() + + const getPaymentMethodsPaymentMethodResponseBodyValidator = + responseValidationFactory([["200", s_payment_method]], s_error) + + // getPaymentMethodsPaymentMethod + router.get( + `/v1/payment_methods/:payment_method`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPaymentMethodsPaymentMethodParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPaymentMethodsPaymentMethodQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPaymentMethodsPaymentMethodRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPaymentMethodsPaymentMethod(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getPaymentMethodsPaymentMethodResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodsPaymentMethodParamSchema = z.object({ + payment_method: z.string().max(5000), + }) + + const postPaymentMethodsPaymentMethodRequestBodySchema = z + .object({ + allow_redisplay: z.enum(["always", "limited", "unspecified"]).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + card: z + .object({ + exp_month: z.coerce.number().optional(), + exp_year: z.coerce.number().optional(), + networks: z + .object({ + preferred: z + .enum(["", "cartes_bancaires", "mastercard", "visa"]) + .optional(), + }) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + link: z.object({}).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + pay_by_bank: z.object({}).optional(), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + }) + .optional(), + }) + .optional() + + const postPaymentMethodsPaymentMethodResponseBodyValidator = + responseValidationFactory([["200", s_payment_method]], s_error) + + // postPaymentMethodsPaymentMethod + router.post( + `/v1/payment_methods/:payment_method`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentMethodsPaymentMethodParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentMethodsPaymentMethodRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethodsPaymentMethod(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentMethodsPaymentMethodResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodsPaymentMethodAttachParamSchema = z.object({ + payment_method: z.string().max(5000), + }) + + const postPaymentMethodsPaymentMethodAttachRequestBodySchema = z.object({ + customer: z.string().max(5000), + expand: z.array(z.string().max(5000)).optional(), + }) + + const postPaymentMethodsPaymentMethodAttachResponseBodyValidator = + responseValidationFactory([["200", s_payment_method]], s_error) + + // postPaymentMethodsPaymentMethodAttach + router.post( + `/v1/payment_methods/:payment_method/attach`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentMethodsPaymentMethodAttachParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentMethodsPaymentMethodAttachRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethodsPaymentMethodAttach( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentMethodsPaymentMethodAttachResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPaymentMethodsPaymentMethodDetachParamSchema = z.object({ + payment_method: z.string().max(5000), + }) + + const postPaymentMethodsPaymentMethodDetachRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postPaymentMethodsPaymentMethodDetachResponseBodyValidator = + responseValidationFactory([["200", s_payment_method]], s_error) + + // postPaymentMethodsPaymentMethodDetach + router.post( + `/v1/payment_methods/:payment_method/detach`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPaymentMethodsPaymentMethodDetachParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPaymentMethodsPaymentMethodDetachRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPaymentMethodsPaymentMethodDetach( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPaymentMethodsPaymentMethodDetachResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPayoutsQuerySchema = z.object({ + arrival_date: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + destination: z.string().optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.string().max(5000).optional(), + }) + + const getPayoutsRequestBodySchema = z.object({}).optional() + + const getPayoutsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_payout)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/payouts")), + }), + ], + ], + s_error, + ) + + // getPayouts + router.get( + `/v1/payouts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPayoutsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPayoutsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_payout[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPayouts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPayoutsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPayoutsRequestBodySchema = z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).optional(), + destination: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + method: z.enum(["instant", "standard"]).optional(), + source_type: z.enum(["bank_account", "card", "fpx"]).optional(), + statement_descriptor: z.string().max(22).optional(), + }) + + const postPayoutsResponseBodyValidator = responseValidationFactory( + [["200", s_payout]], + s_error, + ) + + // postPayouts + router.post( + `/v1/payouts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPayoutsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPayouts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPayoutsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPayoutsPayoutParamSchema = z.object({ payout: z.string().max(5000) }) + + const getPayoutsPayoutQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPayoutsPayoutRequestBodySchema = z.object({}).optional() + + const getPayoutsPayoutResponseBodyValidator = responseValidationFactory( + [["200", s_payout]], + s_error, + ) + + // getPayoutsPayout + router.get( + `/v1/payouts/:payout`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPayoutsPayoutParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPayoutsPayoutQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPayoutsPayoutRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPayoutsPayout(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPayoutsPayoutResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPayoutsPayoutParamSchema = z.object({ + payout: z.string().max(5000), + }) + + const postPayoutsPayoutRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postPayoutsPayoutResponseBodyValidator = responseValidationFactory( + [["200", s_payout]], + s_error, + ) + + // postPayoutsPayout + router.post( + `/v1/payouts/:payout`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPayoutsPayoutParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPayoutsPayoutRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPayoutsPayout(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPayoutsPayoutResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPayoutsPayoutCancelParamSchema = z.object({ + payout: z.string().max(5000), + }) + + const postPayoutsPayoutCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postPayoutsPayoutCancelResponseBodyValidator = + responseValidationFactory([["200", s_payout]], s_error) + + // postPayoutsPayoutCancel + router.post( + `/v1/payouts/:payout/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPayoutsPayoutCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPayoutsPayoutCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPayoutsPayoutCancel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPayoutsPayoutCancelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPayoutsPayoutReverseParamSchema = z.object({ + payout: z.string().max(5000), + }) + + const postPayoutsPayoutReverseRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + }) + .optional() + + const postPayoutsPayoutReverseResponseBodyValidator = + responseValidationFactory([["200", s_payout]], s_error) + + // postPayoutsPayoutReverse + router.post( + `/v1/payouts/:payout/reverse`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPayoutsPayoutReverseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPayoutsPayoutReverseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPayoutsPayoutReverse(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPayoutsPayoutReverseResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPlansQuerySchema = z.object({ + active: PermissiveBoolean.optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + product: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getPlansRequestBodySchema = z.object({}).optional() + + const getPlansResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_plan)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/plans")), + }), + ], + ], + s_error, + ) + + // getPlans + router.get( + `/v1/plans`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPlansQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPlansRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_plan[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPlans(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPlansResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPlansRequestBodySchema = z.object({ + active: PermissiveBoolean.optional(), + amount: z.coerce.number().optional(), + amount_decimal: z.string().optional(), + billing_scheme: z.enum(["per_unit", "tiered"]).optional(), + currency: z.string(), + expand: z.array(z.string().max(5000)).optional(), + id: z.string().max(5000).optional(), + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + meter: z.string().max(5000).optional(), + nickname: z.string().max(5000).optional(), + product: z + .union([ + z.object({ + active: PermissiveBoolean.optional(), + id: z.string().max(5000).optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000), + statement_descriptor: z.string().max(22).optional(), + tax_code: z.string().max(5000).optional(), + unit_label: z.string().max(12).optional(), + }), + z.string().max(5000), + ]) + .optional(), + tiers: z + .array( + z.object({ + flat_amount: z.coerce.number().optional(), + flat_amount_decimal: z.string().optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + up_to: z.union([z.enum(["inf"]), z.coerce.number()]), + }), + ) + .optional(), + tiers_mode: z.enum(["graduated", "volume"]).optional(), + transform_usage: z + .object({ divide_by: z.coerce.number(), round: z.enum(["down", "up"]) }) + .optional(), + trial_period_days: z.coerce.number().optional(), + usage_type: z.enum(["licensed", "metered"]).optional(), + }) + + const postPlansResponseBodyValidator = responseValidationFactory( + [["200", s_plan]], + s_error, + ) + + // postPlans + router.post( + `/v1/plans`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPlansRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPlans(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPlansResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deletePlansPlanParamSchema = z.object({ plan: z.string().max(5000) }) + + const deletePlansPlanRequestBodySchema = z.object({}).optional() + + const deletePlansPlanResponseBodyValidator = responseValidationFactory( + [["200", s_deleted_plan]], + s_error, + ) + + // deletePlansPlan + router.delete( + `/v1/plans/:plan`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deletePlansPlanParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deletePlansPlanRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deletePlansPlan(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deletePlansPlanResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPlansPlanParamSchema = z.object({ plan: z.string().max(5000) }) + + const getPlansPlanQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPlansPlanRequestBodySchema = z.object({}).optional() + + const getPlansPlanResponseBodyValidator = responseValidationFactory( + [["200", s_plan]], + s_error, + ) + + // getPlansPlan + router.get( + `/v1/plans/:plan`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPlansPlanParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPlansPlanQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPlansPlanRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPlansPlan(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPlansPlanResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPlansPlanParamSchema = z.object({ plan: z.string().max(5000) }) + + const postPlansPlanRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + nickname: z.string().max(5000).optional(), + product: z.string().max(5000).optional(), + trial_period_days: z.coerce.number().optional(), + }) + .optional() + + const postPlansPlanResponseBodyValidator = responseValidationFactory( + [["200", s_plan]], + s_error, + ) + + // postPlansPlan + router.post( + `/v1/plans/:plan`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPlansPlanParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPlansPlanRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPlansPlan(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPlansPlanResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPricesQuerySchema = z.object({ + active: PermissiveBoolean.optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + currency: z.string().optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + lookup_keys: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + product: z.string().max(5000).optional(), + recurring: z + .object({ + interval: z.enum(["day", "month", "week", "year"]).optional(), + meter: z.string().max(5000).optional(), + usage_type: z.enum(["licensed", "metered"]).optional(), + }) + .optional(), + starting_after: z.string().max(5000).optional(), + type: z.enum(["one_time", "recurring"]).optional(), + }) + + const getPricesRequestBodySchema = z.object({}).optional() + + const getPricesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_price)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/prices")), + }), + ], + ], + s_error, + ) + + // getPrices + router.get( + `/v1/prices`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPricesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPricesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_price[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPrices(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPricesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPricesRequestBodySchema = z.object({ + active: PermissiveBoolean.optional(), + billing_scheme: z.enum(["per_unit", "tiered"]).optional(), + currency: z.string(), + currency_options: z + .record( + z.object({ + custom_unit_amount: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + preset: z.coerce.number().optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tiers: z + .array( + z.object({ + flat_amount: z.coerce.number().optional(), + flat_amount_decimal: z.string().optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + up_to: z.union([z.enum(["inf"]), z.coerce.number()]), + }), + ) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ) + .optional(), + custom_unit_amount: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + preset: z.coerce.number().optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + lookup_key: z.string().max(200).optional(), + metadata: z.record(z.string()).optional(), + nickname: z.string().max(5000).optional(), + product: z.string().max(5000).optional(), + product_data: z + .object({ + active: PermissiveBoolean.optional(), + id: z.string().max(5000).optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000), + statement_descriptor: z.string().max(22).optional(), + tax_code: z.string().max(5000).optional(), + unit_label: z.string().max(12).optional(), + }) + .optional(), + recurring: z + .object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + meter: z.string().max(5000).optional(), + usage_type: z.enum(["licensed", "metered"]).optional(), + }) + .optional(), + tax_behavior: z.enum(["exclusive", "inclusive", "unspecified"]).optional(), + tiers: z + .array( + z.object({ + flat_amount: z.coerce.number().optional(), + flat_amount_decimal: z.string().optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + up_to: z.union([z.enum(["inf"]), z.coerce.number()]), + }), + ) + .optional(), + tiers_mode: z.enum(["graduated", "volume"]).optional(), + transfer_lookup_key: PermissiveBoolean.optional(), + transform_quantity: z + .object({ divide_by: z.coerce.number(), round: z.enum(["down", "up"]) }) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + + const postPricesResponseBodyValidator = responseValidationFactory( + [["200", s_price]], + s_error, + ) + + // postPrices + router.post( + `/v1/prices`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPricesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPrices(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPricesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPricesSearchQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + page: z.string().max(5000).optional(), + query: z.string().max(5000), + }) + + const getPricesSearchRequestBodySchema = z.object({}).optional() + + const getPricesSearchResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_price)), + has_more: PermissiveBoolean, + next_page: z.string().max(5000).nullable().optional(), + object: z.enum(["search_result"]), + total_count: z.coerce.number().optional(), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getPricesSearch + router.get( + `/v1/prices/search`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPricesSearchQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPricesSearchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_price[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPricesSearch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPricesSearchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPricesPriceParamSchema = z.object({ price: z.string().max(5000) }) + + const getPricesPriceQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPricesPriceRequestBodySchema = z.object({}).optional() + + const getPricesPriceResponseBodyValidator = responseValidationFactory( + [["200", s_price]], + s_error, + ) + + // getPricesPrice + router.get( + `/v1/prices/:price`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPricesPriceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPricesPriceQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPricesPriceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPricesPrice(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPricesPriceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPricesPriceParamSchema = z.object({ price: z.string().max(5000) }) + + const postPricesPriceRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + currency_options: z + .union([ + z.record( + z.object({ + custom_unit_amount: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + preset: z.coerce.number().optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tiers: z + .array( + z.object({ + flat_amount: z.coerce.number().optional(), + flat_amount_decimal: z.string().optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + up_to: z.union([z.enum(["inf"]), z.coerce.number()]), + }), + ) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + lookup_key: z.string().max(200).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + nickname: z.string().max(5000).optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + transfer_lookup_key: PermissiveBoolean.optional(), + }) + .optional() + + const postPricesPriceResponseBodyValidator = responseValidationFactory( + [["200", s_price]], + s_error, + ) + + // postPricesPrice + router.post( + `/v1/prices/:price`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPricesPriceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPricesPriceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPricesPrice(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPricesPriceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getProductsQuerySchema = z.object({ + active: PermissiveBoolean.optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + ids: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + shippable: PermissiveBoolean.optional(), + starting_after: z.string().max(5000).optional(), + url: z.string().max(5000).optional(), + }) + + const getProductsRequestBodySchema = z.object({}).optional() + + const getProductsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_product)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/products")), + }), + ], + ], + s_error, + ) + + // getProducts + router.get( + `/v1/products`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getProductsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getProductsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_product[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getProducts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getProductsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postProductsRequestBodySchema = z.object({ + active: PermissiveBoolean.optional(), + default_price_data: z + .object({ + currency: z.string(), + currency_options: z + .record( + z.object({ + custom_unit_amount: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + preset: z.coerce.number().optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + tiers: z + .array( + z.object({ + flat_amount: z.coerce.number().optional(), + flat_amount_decimal: z.string().optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + up_to: z.union([z.enum(["inf"]), z.coerce.number()]), + }), + ) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }), + ) + .optional(), + custom_unit_amount: z + .object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().optional(), + minimum: z.coerce.number().optional(), + preset: z.coerce.number().optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + recurring: z + .object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + description: z.string().max(40000).optional(), + expand: z.array(z.string().max(5000)).optional(), + id: z.string().max(5000).optional(), + images: z.array(z.string()).optional(), + marketing_features: z + .array(z.object({ name: z.string().max(5000) })) + .optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(5000), + package_dimensions: z + .object({ + height: z.coerce.number(), + length: z.coerce.number(), + weight: z.coerce.number(), + width: z.coerce.number(), + }) + .optional(), + shippable: PermissiveBoolean.optional(), + statement_descriptor: z.string().max(22).optional(), + tax_code: z.string().optional(), + unit_label: z.string().max(12).optional(), + url: z.string().max(5000).optional(), + }) + + const postProductsResponseBodyValidator = responseValidationFactory( + [["200", s_product]], + s_error, + ) + + // postProducts + router.post( + `/v1/products`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postProductsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postProducts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postProductsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getProductsSearchQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + page: z.string().max(5000).optional(), + query: z.string().max(5000), + }) + + const getProductsSearchRequestBodySchema = z.object({}).optional() + + const getProductsSearchResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_product)), + has_more: PermissiveBoolean, + next_page: z.string().max(5000).nullable().optional(), + object: z.enum(["search_result"]), + total_count: z.coerce.number().optional(), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getProductsSearch + router.get( + `/v1/products/search`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getProductsSearchQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getProductsSearchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_product[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getProductsSearch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getProductsSearchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteProductsIdParamSchema = z.object({ id: z.string().max(5000) }) + + const deleteProductsIdRequestBodySchema = z.object({}).optional() + + const deleteProductsIdResponseBodyValidator = responseValidationFactory( + [["200", s_deleted_product]], + s_error, + ) + + // deleteProductsId + router.delete( + `/v1/products/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteProductsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteProductsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteProductsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteProductsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getProductsIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getProductsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getProductsIdRequestBodySchema = z.object({}).optional() + + const getProductsIdResponseBodyValidator = responseValidationFactory( + [["200", s_product]], + s_error, + ) + + // getProductsId + router.get( + `/v1/products/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getProductsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getProductsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getProductsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getProductsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getProductsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postProductsIdParamSchema = z.object({ id: z.string().max(5000) }) + + const postProductsIdRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + default_price: z.string().max(5000).optional(), + description: z.union([z.string().max(40000), z.enum([""])]).optional(), + expand: z.array(z.string().max(5000)).optional(), + images: z.union([z.array(z.string()), z.enum([""])]).optional(), + marketing_features: z + .union([ + z.array(z.object({ name: z.string().max(5000) })), + z.enum([""]), + ]) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + name: z.string().max(5000).optional(), + package_dimensions: z + .union([ + z.object({ + height: z.coerce.number(), + length: z.coerce.number(), + weight: z.coerce.number(), + width: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + shippable: PermissiveBoolean.optional(), + statement_descriptor: z.string().max(22).optional(), + tax_code: z.union([z.string(), z.enum([""])]).optional(), + unit_label: z.union([z.string().max(12), z.enum([""])]).optional(), + url: z.union([z.string(), z.enum([""])]).optional(), + }) + .optional() + + const postProductsIdResponseBodyValidator = responseValidationFactory( + [["200", s_product]], + s_error, + ) + + // postProductsId + router.post( + `/v1/products/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postProductsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postProductsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postProductsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postProductsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getProductsProductFeaturesParamSchema = z.object({ + product: z.string().max(5000), + }) + + const getProductsProductFeaturesQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getProductsProductFeaturesRequestBodySchema = z.object({}).optional() + + const getProductsProductFeaturesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_product_feature), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getProductsProductFeatures + router.get( + `/v1/products/:product/features`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getProductsProductFeaturesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getProductsProductFeaturesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getProductsProductFeaturesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_product_feature[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getProductsProductFeatures(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getProductsProductFeaturesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postProductsProductFeaturesParamSchema = z.object({ + product: z.string().max(5000), + }) + + const postProductsProductFeaturesRequestBodySchema = z.object({ + entitlement_feature: z.string().max(5000), + expand: z.array(z.string().max(5000)).optional(), + }) + + const postProductsProductFeaturesResponseBodyValidator = + responseValidationFactory([["200", s_product_feature]], s_error) + + // postProductsProductFeatures + router.post( + `/v1/products/:product/features`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postProductsProductFeaturesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postProductsProductFeaturesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postProductsProductFeatures(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postProductsProductFeaturesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteProductsProductFeaturesIdParamSchema = z.object({ + id: z.string().max(5000), + product: z.string().max(5000), + }) + + const deleteProductsProductFeaturesIdRequestBodySchema = z + .object({}) + .optional() + + const deleteProductsProductFeaturesIdResponseBodyValidator = + responseValidationFactory([["200", s_deleted_product_feature]], s_error) + + // deleteProductsProductFeaturesId + router.delete( + `/v1/products/:product/features/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteProductsProductFeaturesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteProductsProductFeaturesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteProductsProductFeaturesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteProductsProductFeaturesIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getProductsProductFeaturesIdParamSchema = z.object({ + id: z.string().max(5000), + product: z.string().max(5000), + }) + + const getProductsProductFeaturesIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getProductsProductFeaturesIdRequestBodySchema = z.object({}).optional() + + const getProductsProductFeaturesIdResponseBodyValidator = + responseValidationFactory([["200", s_product_feature]], s_error) + + // getProductsProductFeaturesId + router.get( + `/v1/products/:product/features/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getProductsProductFeaturesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getProductsProductFeaturesIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getProductsProductFeaturesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getProductsProductFeaturesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getProductsProductFeaturesIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPromotionCodesQuerySchema = z.object({ + active: PermissiveBoolean.optional(), + code: z.string().max(5000).optional(), + coupon: z.string().max(5000).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getPromotionCodesRequestBodySchema = z.object({}).optional() + + const getPromotionCodesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_promotion_code)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/promotion_codes")), + }), + ], + ], + s_error, + ) + + // getPromotionCodes + router.get( + `/v1/promotion_codes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getPromotionCodesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPromotionCodesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_promotion_code[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPromotionCodes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getPromotionCodesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPromotionCodesRequestBodySchema = z.object({ + active: PermissiveBoolean.optional(), + code: z.string().max(500).optional(), + coupon: z.string().max(5000), + customer: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + max_redemptions: z.coerce.number().optional(), + metadata: z.record(z.string()).optional(), + restrictions: z + .object({ + currency_options: z + .record(z.object({ minimum_amount: z.coerce.number().optional() })) + .optional(), + first_time_transaction: PermissiveBoolean.optional(), + minimum_amount: z.coerce.number().optional(), + minimum_amount_currency: z.string().optional(), + }) + .optional(), + }) + + const postPromotionCodesResponseBodyValidator = responseValidationFactory( + [["200", s_promotion_code]], + s_error, + ) + + // postPromotionCodes + router.post( + `/v1/promotion_codes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postPromotionCodesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPromotionCodes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postPromotionCodesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getPromotionCodesPromotionCodeParamSchema = z.object({ + promotion_code: z.string().max(5000), + }) + + const getPromotionCodesPromotionCodeQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getPromotionCodesPromotionCodeRequestBodySchema = z + .object({}) + .optional() + + const getPromotionCodesPromotionCodeResponseBodyValidator = + responseValidationFactory([["200", s_promotion_code]], s_error) + + // getPromotionCodesPromotionCode + router.get( + `/v1/promotion_codes/:promotion_code`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getPromotionCodesPromotionCodeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getPromotionCodesPromotionCodeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getPromotionCodesPromotionCodeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getPromotionCodesPromotionCode(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getPromotionCodesPromotionCodeResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postPromotionCodesPromotionCodeParamSchema = z.object({ + promotion_code: z.string().max(5000), + }) + + const postPromotionCodesPromotionCodeRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + restrictions: z + .object({ + currency_options: z + .record(z.object({ minimum_amount: z.coerce.number().optional() })) + .optional(), + }) + .optional(), + }) + .optional() + + const postPromotionCodesPromotionCodeResponseBodyValidator = + responseValidationFactory([["200", s_promotion_code]], s_error) + + // postPromotionCodesPromotionCode + router.post( + `/v1/promotion_codes/:promotion_code`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postPromotionCodesPromotionCodeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postPromotionCodesPromotionCodeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postPromotionCodesPromotionCode(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postPromotionCodesPromotionCodeResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getQuotesQuerySchema = z.object({ + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["accepted", "canceled", "draft", "open"]).optional(), + test_clock: z.string().max(5000).optional(), + }) + + const getQuotesRequestBodySchema = z.object({}).optional() + + const getQuotesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_quote)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/quotes")), + }), + ], + ], + s_error, + ) + + // getQuotes + router.get( + `/v1/quotes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getQuotesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getQuotesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_quote[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getQuotes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getQuotesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postQuotesRequestBodySchema = z + .object({ + application_fee_amount: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + application_fee_percent: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + customer: z.string().max(5000).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + description: z.union([z.string().max(500), z.enum([""])]).optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + footer: z.union([z.string().max(500), z.enum([""])]).optional(), + from_quote: z + .object({ + is_revision: PermissiveBoolean.optional(), + quote: z.string().max(5000), + }) + .optional(), + header: z.union([z.string().max(50), z.enum([""])]).optional(), + invoice_settings: z + .object({ + days_until_due: z.coerce.number().optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + line_items: z + .array( + z.object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z + .object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.union([z.string(), z.enum([""])]).optional(), + subscription_data: z + .object({ + description: z.string().max(500).optional(), + effective_date: z + .union([ + z.enum(["current_period_end"]), + z.coerce.number(), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + trial_period_days: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }) + .optional(), + test_clock: z.string().max(5000).optional(), + transfer_data: z + .union([ + z.object({ + amount: z.coerce.number().optional(), + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional() + + const postQuotesResponseBodyValidator = responseValidationFactory( + [["200", s_quote]], + s_error, + ) + + // postQuotes + router.post( + `/v1/quotes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postQuotesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postQuotes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postQuotesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getQuotesQuoteParamSchema = z.object({ quote: z.string().max(5000) }) + + const getQuotesQuoteQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getQuotesQuoteRequestBodySchema = z.object({}).optional() + + const getQuotesQuoteResponseBodyValidator = responseValidationFactory( + [["200", s_quote]], + s_error, + ) + + // getQuotesQuote + router.get( + `/v1/quotes/:quote`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getQuotesQuoteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getQuotesQuoteQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getQuotesQuoteRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getQuotesQuote(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getQuotesQuoteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postQuotesQuoteParamSchema = z.object({ quote: z.string().max(5000) }) + + const postQuotesQuoteRequestBodySchema = z + .object({ + application_fee_amount: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + application_fee_percent: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + customer: z.string().max(5000).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + description: z.union([z.string().max(500), z.enum([""])]).optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + footer: z.union([z.string().max(500), z.enum([""])]).optional(), + header: z.union([z.string().max(50), z.enum([""])]).optional(), + invoice_settings: z + .object({ + days_until_due: z.coerce.number().optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + line_items: z + .array( + z.object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + id: z.string().max(5000).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z + .object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }) + .optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.union([z.string(), z.enum([""])]).optional(), + subscription_data: z + .object({ + description: z.union([z.string().max(500), z.enum([""])]).optional(), + effective_date: z + .union([ + z.enum(["current_period_end"]), + z.coerce.number(), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + trial_period_days: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + }) + .optional(), + transfer_data: z + .union([ + z.object({ + amount: z.coerce.number().optional(), + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional() + + const postQuotesQuoteResponseBodyValidator = responseValidationFactory( + [["200", s_quote]], + s_error, + ) + + // postQuotesQuote + router.post( + `/v1/quotes/:quote`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postQuotesQuoteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postQuotesQuoteRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postQuotesQuote(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postQuotesQuoteResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postQuotesQuoteAcceptParamSchema = z.object({ + quote: z.string().max(5000), + }) + + const postQuotesQuoteAcceptRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postQuotesQuoteAcceptResponseBodyValidator = responseValidationFactory( + [["200", s_quote]], + s_error, + ) + + // postQuotesQuoteAccept + router.post( + `/v1/quotes/:quote/accept`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postQuotesQuoteAcceptParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postQuotesQuoteAcceptRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postQuotesQuoteAccept(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postQuotesQuoteAcceptResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postQuotesQuoteCancelParamSchema = z.object({ + quote: z.string().max(5000), + }) + + const postQuotesQuoteCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postQuotesQuoteCancelResponseBodyValidator = responseValidationFactory( + [["200", s_quote]], + s_error, + ) + + // postQuotesQuoteCancel + router.post( + `/v1/quotes/:quote/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postQuotesQuoteCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postQuotesQuoteCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postQuotesQuoteCancel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postQuotesQuoteCancelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getQuotesQuoteComputedUpfrontLineItemsParamSchema = z.object({ + quote: z.string().max(5000), + }) + + const getQuotesQuoteComputedUpfrontLineItemsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getQuotesQuoteComputedUpfrontLineItemsRequestBodySchema = z + .object({}) + .optional() + + const getQuotesQuoteComputedUpfrontLineItemsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getQuotesQuoteComputedUpfrontLineItems + router.get( + `/v1/quotes/:quote/computed_upfront_line_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getQuotesQuoteComputedUpfrontLineItemsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getQuotesQuoteComputedUpfrontLineItemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getQuotesQuoteComputedUpfrontLineItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getQuotesQuoteComputedUpfrontLineItems( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getQuotesQuoteComputedUpfrontLineItemsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postQuotesQuoteFinalizeParamSchema = z.object({ + quote: z.string().max(5000), + }) + + const postQuotesQuoteFinalizeRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + }) + .optional() + + const postQuotesQuoteFinalizeResponseBodyValidator = + responseValidationFactory([["200", s_quote]], s_error) + + // postQuotesQuoteFinalize + router.post( + `/v1/quotes/:quote/finalize`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postQuotesQuoteFinalizeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postQuotesQuoteFinalizeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postQuotesQuoteFinalize(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postQuotesQuoteFinalizeResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getQuotesQuoteLineItemsParamSchema = z.object({ + quote: z.string().max(5000), + }) + + const getQuotesQuoteLineItemsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getQuotesQuoteLineItemsRequestBodySchema = z.object({}).optional() + + const getQuotesQuoteLineItemsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getQuotesQuoteLineItems + router.get( + `/v1/quotes/:quote/line_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getQuotesQuoteLineItemsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getQuotesQuoteLineItemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getQuotesQuoteLineItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getQuotesQuoteLineItems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getQuotesQuoteLineItemsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getQuotesQuotePdfParamSchema = z.object({ quote: z.string().max(5000) }) + + const getQuotesQuotePdfQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getQuotesQuotePdfRequestBodySchema = z.object({}).optional() + + const getQuotesQuotePdfResponseBodyValidator = responseValidationFactory( + [["200", z.string()]], + s_error, + ) + + // getQuotesQuotePdf + router.get( + `/v1/quotes/:quote/pdf`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getQuotesQuotePdfParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getQuotesQuotePdfQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getQuotesQuotePdfRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getQuotesQuotePdf(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getQuotesQuotePdfResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getRadarEarlyFraudWarningsQuerySchema = z.object({ + charge: z.string().optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + payment_intent: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getRadarEarlyFraudWarningsRequestBodySchema = z.object({}).optional() + + const getRadarEarlyFraudWarningsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_radar_early_fraud_warning)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/radar/early_fraud_warnings")), + }), + ], + ], + s_error, + ) + + // getRadarEarlyFraudWarnings + router.get( + `/v1/radar/early_fraud_warnings`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getRadarEarlyFraudWarningsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getRadarEarlyFraudWarningsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_radar_early_fraud_warning[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getRadarEarlyFraudWarnings(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getRadarEarlyFraudWarningsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getRadarEarlyFraudWarningsEarlyFraudWarningParamSchema = z.object({ + early_fraud_warning: z.string().max(5000), + }) + + const getRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getRadarEarlyFraudWarningsEarlyFraudWarningRequestBodySchema = z + .object({}) + .optional() + + const getRadarEarlyFraudWarningsEarlyFraudWarningResponseBodyValidator = + responseValidationFactory([["200", s_radar_early_fraud_warning]], s_error) + + // getRadarEarlyFraudWarningsEarlyFraudWarning + router.get( + `/v1/radar/early_fraud_warnings/:early_fraud_warning`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getRadarEarlyFraudWarningsEarlyFraudWarningParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getRadarEarlyFraudWarningsEarlyFraudWarningRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getRadarEarlyFraudWarningsEarlyFraudWarning( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getRadarEarlyFraudWarningsEarlyFraudWarningResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getRadarValueListItemsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + value: z.string().max(800).optional(), + value_list: z.string().max(5000), + }) + + const getRadarValueListItemsRequestBodySchema = z.object({}).optional() + + const getRadarValueListItemsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_radar_value_list_item), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/radar/value_list_items")), + }), + ], + ], + s_error, + ) + + // getRadarValueListItems + router.get( + `/v1/radar/value_list_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getRadarValueListItemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getRadarValueListItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_radar_value_list_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getRadarValueListItems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getRadarValueListItemsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postRadarValueListItemsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + value: z.string().max(800), + value_list: z.string().max(5000), + }) + + const postRadarValueListItemsResponseBodyValidator = + responseValidationFactory([["200", s_radar_value_list_item]], s_error) + + // postRadarValueListItems + router.post( + `/v1/radar/value_list_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postRadarValueListItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postRadarValueListItems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postRadarValueListItemsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteRadarValueListItemsItemParamSchema = z.object({ + item: z.string().max(5000), + }) + + const deleteRadarValueListItemsItemRequestBodySchema = z.object({}).optional() + + const deleteRadarValueListItemsItemResponseBodyValidator = + responseValidationFactory( + [["200", s_deleted_radar_value_list_item]], + s_error, + ) + + // deleteRadarValueListItemsItem + router.delete( + `/v1/radar/value_list_items/:item`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteRadarValueListItemsItemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteRadarValueListItemsItemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteRadarValueListItemsItem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteRadarValueListItemsItemResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getRadarValueListItemsItemParamSchema = z.object({ + item: z.string().max(5000), + }) + + const getRadarValueListItemsItemQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getRadarValueListItemsItemRequestBodySchema = z.object({}).optional() + + const getRadarValueListItemsItemResponseBodyValidator = + responseValidationFactory([["200", s_radar_value_list_item]], s_error) + + // getRadarValueListItemsItem + router.get( + `/v1/radar/value_list_items/:item`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getRadarValueListItemsItemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getRadarValueListItemsItemQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getRadarValueListItemsItemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getRadarValueListItemsItem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getRadarValueListItemsItemResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getRadarValueListsQuerySchema = z.object({ + alias: z.string().max(100).optional(), + contains: z.string().max(800).optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getRadarValueListsRequestBodySchema = z.object({}).optional() + + const getRadarValueListsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_radar_value_list), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/radar/value_lists")), + }), + ], + ], + s_error, + ) + + // getRadarValueLists + router.get( + `/v1/radar/value_lists`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getRadarValueListsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getRadarValueListsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_radar_value_list[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getRadarValueLists(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getRadarValueListsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postRadarValueListsRequestBodySchema = z.object({ + alias: z.string().max(100), + expand: z.array(z.string().max(5000)).optional(), + item_type: z + .enum([ + "card_bin", + "card_fingerprint", + "case_sensitive_string", + "country", + "customer_id", + "email", + "ip_address", + "sepa_debit_fingerprint", + "string", + "us_bank_account_fingerprint", + ]) + .optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(100), + }) + + const postRadarValueListsResponseBodyValidator = responseValidationFactory( + [["200", s_radar_value_list]], + s_error, + ) + + // postRadarValueLists + router.post( + `/v1/radar/value_lists`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postRadarValueListsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postRadarValueLists(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postRadarValueListsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteRadarValueListsValueListParamSchema = z.object({ + value_list: z.string().max(5000), + }) + + const deleteRadarValueListsValueListRequestBodySchema = z + .object({}) + .optional() + + const deleteRadarValueListsValueListResponseBodyValidator = + responseValidationFactory([["200", s_deleted_radar_value_list]], s_error) + + // deleteRadarValueListsValueList + router.delete( + `/v1/radar/value_lists/:value_list`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteRadarValueListsValueListParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteRadarValueListsValueListRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteRadarValueListsValueList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteRadarValueListsValueListResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getRadarValueListsValueListParamSchema = z.object({ + value_list: z.string().max(5000), + }) + + const getRadarValueListsValueListQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getRadarValueListsValueListRequestBodySchema = z.object({}).optional() + + const getRadarValueListsValueListResponseBodyValidator = + responseValidationFactory([["200", s_radar_value_list]], s_error) + + // getRadarValueListsValueList + router.get( + `/v1/radar/value_lists/:value_list`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getRadarValueListsValueListParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getRadarValueListsValueListQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getRadarValueListsValueListRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getRadarValueListsValueList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getRadarValueListsValueListResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postRadarValueListsValueListParamSchema = z.object({ + value_list: z.string().max(5000), + }) + + const postRadarValueListsValueListRequestBodySchema = z + .object({ + alias: z.string().max(100).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + name: z.string().max(100).optional(), + }) + .optional() + + const postRadarValueListsValueListResponseBodyValidator = + responseValidationFactory([["200", s_radar_value_list]], s_error) + + // postRadarValueListsValueList + router.post( + `/v1/radar/value_lists/:value_list`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postRadarValueListsValueListParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postRadarValueListsValueListRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postRadarValueListsValueList(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postRadarValueListsValueListResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getRefundsQuerySchema = z.object({ + charge: z.string().optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + payment_intent: z.string().max(5000).optional(), + starting_after: z.string().optional(), + }) + + const getRefundsRequestBodySchema = z.object({}).optional() + + const getRefundsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_refund)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/refunds")), + }), + ], + ], + s_error, + ) + + // getRefunds + router.get( + `/v1/refunds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getRefundsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getRefundsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_refund[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getRefunds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getRefundsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postRefundsRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + charge: z.string().max(5000).optional(), + currency: z.string().optional(), + customer: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + instructions_email: z.string().optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + origin: z.enum(["customer_balance"]).optional(), + payment_intent: z.string().max(5000).optional(), + reason: z + .enum(["duplicate", "fraudulent", "requested_by_customer"]) + .optional(), + refund_application_fee: PermissiveBoolean.optional(), + reverse_transfer: PermissiveBoolean.optional(), + }) + .optional() + + const postRefundsResponseBodyValidator = responseValidationFactory( + [["200", s_refund]], + s_error, + ) + + // postRefunds + router.post( + `/v1/refunds`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postRefundsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postRefunds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postRefundsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getRefundsRefundParamSchema = z.object({ refund: z.string() }) + + const getRefundsRefundQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getRefundsRefundRequestBodySchema = z.object({}).optional() + + const getRefundsRefundResponseBodyValidator = responseValidationFactory( + [["200", s_refund]], + s_error, + ) + + // getRefundsRefund + router.get( + `/v1/refunds/:refund`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getRefundsRefundParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getRefundsRefundQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getRefundsRefundRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getRefundsRefund(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getRefundsRefundResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postRefundsRefundParamSchema = z.object({ refund: z.string() }) + + const postRefundsRefundRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postRefundsRefundResponseBodyValidator = responseValidationFactory( + [["200", s_refund]], + s_error, + ) + + // postRefundsRefund + router.post( + `/v1/refunds/:refund`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postRefundsRefundParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postRefundsRefundRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postRefundsRefund(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postRefundsRefundResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postRefundsRefundCancelParamSchema = z.object({ refund: z.string() }) + + const postRefundsRefundCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postRefundsRefundCancelResponseBodyValidator = + responseValidationFactory([["200", s_refund]], s_error) + + // postRefundsRefundCancel + router.post( + `/v1/refunds/:refund/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postRefundsRefundCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postRefundsRefundCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postRefundsRefundCancel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postRefundsRefundCancelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getReportingReportRunsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getReportingReportRunsRequestBodySchema = z.object({}).optional() + + const getReportingReportRunsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_reporting_report_run)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/reporting/report_runs")), + }), + ], + ], + s_error, + ) + + // getReportingReportRuns + router.get( + `/v1/reporting/report_runs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getReportingReportRunsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getReportingReportRunsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_reporting_report_run[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getReportingReportRuns(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getReportingReportRunsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postReportingReportRunsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + parameters: z + .object({ + columns: z.array(z.string().max(5000)).optional(), + connected_account: z.string().optional(), + currency: z.string().optional(), + interval_end: z.coerce.number().optional(), + interval_start: z.coerce.number().optional(), + payout: z.string().optional(), + reporting_category: z + .enum([ + "advance", + "advance_funding", + "anticipation_repayment", + "charge", + "charge_failure", + "climate_order_purchase", + "climate_order_refund", + "connect_collection_transfer", + "connect_reserved_funds", + "contribution", + "dispute", + "dispute_reversal", + "fee", + "financing_paydown", + "financing_paydown_reversal", + "financing_payout", + "financing_payout_reversal", + "issuing_authorization_hold", + "issuing_authorization_release", + "issuing_dispute", + "issuing_transaction", + "network_cost", + "other_adjustment", + "partial_capture_reversal", + "payout", + "payout_reversal", + "platform_earning", + "platform_earning_refund", + "refund", + "refund_failure", + "risk_reserved_funds", + "tax", + "topup", + "topup_reversal", + "transfer", + "transfer_reversal", + "unreconciled_customer_funds", + ]) + .optional(), + timezone: z + .enum([ + "Africa/Abidjan", + "Africa/Accra", + "Africa/Addis_Ababa", + "Africa/Algiers", + "Africa/Asmara", + "Africa/Asmera", + "Africa/Bamako", + "Africa/Bangui", + "Africa/Banjul", + "Africa/Bissau", + "Africa/Blantyre", + "Africa/Brazzaville", + "Africa/Bujumbura", + "Africa/Cairo", + "Africa/Casablanca", + "Africa/Ceuta", + "Africa/Conakry", + "Africa/Dakar", + "Africa/Dar_es_Salaam", + "Africa/Djibouti", + "Africa/Douala", + "Africa/El_Aaiun", + "Africa/Freetown", + "Africa/Gaborone", + "Africa/Harare", + "Africa/Johannesburg", + "Africa/Juba", + "Africa/Kampala", + "Africa/Khartoum", + "Africa/Kigali", + "Africa/Kinshasa", + "Africa/Lagos", + "Africa/Libreville", + "Africa/Lome", + "Africa/Luanda", + "Africa/Lubumbashi", + "Africa/Lusaka", + "Africa/Malabo", + "Africa/Maputo", + "Africa/Maseru", + "Africa/Mbabane", + "Africa/Mogadishu", + "Africa/Monrovia", + "Africa/Nairobi", + "Africa/Ndjamena", + "Africa/Niamey", + "Africa/Nouakchott", + "Africa/Ouagadougou", + "Africa/Porto-Novo", + "Africa/Sao_Tome", + "Africa/Timbuktu", + "Africa/Tripoli", + "Africa/Tunis", + "Africa/Windhoek", + "America/Adak", + "America/Anchorage", + "America/Anguilla", + "America/Antigua", + "America/Araguaina", + "America/Argentina/Buenos_Aires", + "America/Argentina/Catamarca", + "America/Argentina/ComodRivadavia", + "America/Argentina/Cordoba", + "America/Argentina/Jujuy", + "America/Argentina/La_Rioja", + "America/Argentina/Mendoza", + "America/Argentina/Rio_Gallegos", + "America/Argentina/Salta", + "America/Argentina/San_Juan", + "America/Argentina/San_Luis", + "America/Argentina/Tucuman", + "America/Argentina/Ushuaia", + "America/Aruba", + "America/Asuncion", + "America/Atikokan", + "America/Atka", + "America/Bahia", + "America/Bahia_Banderas", + "America/Barbados", + "America/Belem", + "America/Belize", + "America/Blanc-Sablon", + "America/Boa_Vista", + "America/Bogota", + "America/Boise", + "America/Buenos_Aires", + "America/Cambridge_Bay", + "America/Campo_Grande", + "America/Cancun", + "America/Caracas", + "America/Catamarca", + "America/Cayenne", + "America/Cayman", + "America/Chicago", + "America/Chihuahua", + "America/Ciudad_Juarez", + "America/Coral_Harbour", + "America/Cordoba", + "America/Costa_Rica", + "America/Creston", + "America/Cuiaba", + "America/Curacao", + "America/Danmarkshavn", + "America/Dawson", + "America/Dawson_Creek", + "America/Denver", + "America/Detroit", + "America/Dominica", + "America/Edmonton", + "America/Eirunepe", + "America/El_Salvador", + "America/Ensenada", + "America/Fort_Nelson", + "America/Fort_Wayne", + "America/Fortaleza", + "America/Glace_Bay", + "America/Godthab", + "America/Goose_Bay", + "America/Grand_Turk", + "America/Grenada", + "America/Guadeloupe", + "America/Guatemala", + "America/Guayaquil", + "America/Guyana", + "America/Halifax", + "America/Havana", + "America/Hermosillo", + "America/Indiana/Indianapolis", + "America/Indiana/Knox", + "America/Indiana/Marengo", + "America/Indiana/Petersburg", + "America/Indiana/Tell_City", + "America/Indiana/Vevay", + "America/Indiana/Vincennes", + "America/Indiana/Winamac", + "America/Indianapolis", + "America/Inuvik", + "America/Iqaluit", + "America/Jamaica", + "America/Jujuy", + "America/Juneau", + "America/Kentucky/Louisville", + "America/Kentucky/Monticello", + "America/Knox_IN", + "America/Kralendijk", + "America/La_Paz", + "America/Lima", + "America/Los_Angeles", + "America/Louisville", + "America/Lower_Princes", + "America/Maceio", + "America/Managua", + "America/Manaus", + "America/Marigot", + "America/Martinique", + "America/Matamoros", + "America/Mazatlan", + "America/Mendoza", + "America/Menominee", + "America/Merida", + "America/Metlakatla", + "America/Mexico_City", + "America/Miquelon", + "America/Moncton", + "America/Monterrey", + "America/Montevideo", + "America/Montreal", + "America/Montserrat", + "America/Nassau", + "America/New_York", + "America/Nipigon", + "America/Nome", + "America/Noronha", + "America/North_Dakota/Beulah", + "America/North_Dakota/Center", + "America/North_Dakota/New_Salem", + "America/Nuuk", + "America/Ojinaga", + "America/Panama", + "America/Pangnirtung", + "America/Paramaribo", + "America/Phoenix", + "America/Port-au-Prince", + "America/Port_of_Spain", + "America/Porto_Acre", + "America/Porto_Velho", + "America/Puerto_Rico", + "America/Punta_Arenas", + "America/Rainy_River", + "America/Rankin_Inlet", + "America/Recife", + "America/Regina", + "America/Resolute", + "America/Rio_Branco", + "America/Rosario", + "America/Santa_Isabel", + "America/Santarem", + "America/Santiago", + "America/Santo_Domingo", + "America/Sao_Paulo", + "America/Scoresbysund", + "America/Shiprock", + "America/Sitka", + "America/St_Barthelemy", + "America/St_Johns", + "America/St_Kitts", + "America/St_Lucia", + "America/St_Thomas", + "America/St_Vincent", + "America/Swift_Current", + "America/Tegucigalpa", + "America/Thule", + "America/Thunder_Bay", + "America/Tijuana", + "America/Toronto", + "America/Tortola", + "America/Vancouver", + "America/Virgin", + "America/Whitehorse", + "America/Winnipeg", + "America/Yakutat", + "America/Yellowknife", + "Antarctica/Casey", + "Antarctica/Davis", + "Antarctica/DumontDUrville", + "Antarctica/Macquarie", + "Antarctica/Mawson", + "Antarctica/McMurdo", + "Antarctica/Palmer", + "Antarctica/Rothera", + "Antarctica/South_Pole", + "Antarctica/Syowa", + "Antarctica/Troll", + "Antarctica/Vostok", + "Arctic/Longyearbyen", + "Asia/Aden", + "Asia/Almaty", + "Asia/Amman", + "Asia/Anadyr", + "Asia/Aqtau", + "Asia/Aqtobe", + "Asia/Ashgabat", + "Asia/Ashkhabad", + "Asia/Atyrau", + "Asia/Baghdad", + "Asia/Bahrain", + "Asia/Baku", + "Asia/Bangkok", + "Asia/Barnaul", + "Asia/Beirut", + "Asia/Bishkek", + "Asia/Brunei", + "Asia/Calcutta", + "Asia/Chita", + "Asia/Choibalsan", + "Asia/Chongqing", + "Asia/Chungking", + "Asia/Colombo", + "Asia/Dacca", + "Asia/Damascus", + "Asia/Dhaka", + "Asia/Dili", + "Asia/Dubai", + "Asia/Dushanbe", + "Asia/Famagusta", + "Asia/Gaza", + "Asia/Harbin", + "Asia/Hebron", + "Asia/Ho_Chi_Minh", + "Asia/Hong_Kong", + "Asia/Hovd", + "Asia/Irkutsk", + "Asia/Istanbul", + "Asia/Jakarta", + "Asia/Jayapura", + "Asia/Jerusalem", + "Asia/Kabul", + "Asia/Kamchatka", + "Asia/Karachi", + "Asia/Kashgar", + "Asia/Kathmandu", + "Asia/Katmandu", + "Asia/Khandyga", + "Asia/Kolkata", + "Asia/Krasnoyarsk", + "Asia/Kuala_Lumpur", + "Asia/Kuching", + "Asia/Kuwait", + "Asia/Macao", + "Asia/Macau", + "Asia/Magadan", + "Asia/Makassar", + "Asia/Manila", + "Asia/Muscat", + "Asia/Nicosia", + "Asia/Novokuznetsk", + "Asia/Novosibirsk", + "Asia/Omsk", + "Asia/Oral", + "Asia/Phnom_Penh", + "Asia/Pontianak", + "Asia/Pyongyang", + "Asia/Qatar", + "Asia/Qostanay", + "Asia/Qyzylorda", + "Asia/Rangoon", + "Asia/Riyadh", + "Asia/Saigon", + "Asia/Sakhalin", + "Asia/Samarkand", + "Asia/Seoul", + "Asia/Shanghai", + "Asia/Singapore", + "Asia/Srednekolymsk", + "Asia/Taipei", + "Asia/Tashkent", + "Asia/Tbilisi", + "Asia/Tehran", + "Asia/Tel_Aviv", + "Asia/Thimbu", + "Asia/Thimphu", + "Asia/Tokyo", + "Asia/Tomsk", + "Asia/Ujung_Pandang", + "Asia/Ulaanbaatar", + "Asia/Ulan_Bator", + "Asia/Urumqi", + "Asia/Ust-Nera", + "Asia/Vientiane", + "Asia/Vladivostok", + "Asia/Yakutsk", + "Asia/Yangon", + "Asia/Yekaterinburg", + "Asia/Yerevan", + "Atlantic/Azores", + "Atlantic/Bermuda", + "Atlantic/Canary", + "Atlantic/Cape_Verde", + "Atlantic/Faeroe", + "Atlantic/Faroe", + "Atlantic/Jan_Mayen", + "Atlantic/Madeira", + "Atlantic/Reykjavik", + "Atlantic/South_Georgia", + "Atlantic/St_Helena", + "Atlantic/Stanley", + "Australia/ACT", + "Australia/Adelaide", + "Australia/Brisbane", + "Australia/Broken_Hill", + "Australia/Canberra", + "Australia/Currie", + "Australia/Darwin", + "Australia/Eucla", + "Australia/Hobart", + "Australia/LHI", + "Australia/Lindeman", + "Australia/Lord_Howe", + "Australia/Melbourne", + "Australia/NSW", + "Australia/North", + "Australia/Perth", + "Australia/Queensland", + "Australia/South", + "Australia/Sydney", + "Australia/Tasmania", + "Australia/Victoria", + "Australia/West", + "Australia/Yancowinna", + "Brazil/Acre", + "Brazil/DeNoronha", + "Brazil/East", + "Brazil/West", + "CET", + "CST6CDT", + "Canada/Atlantic", + "Canada/Central", + "Canada/Eastern", + "Canada/Mountain", + "Canada/Newfoundland", + "Canada/Pacific", + "Canada/Saskatchewan", + "Canada/Yukon", + "Chile/Continental", + "Chile/EasterIsland", + "Cuba", + "EET", + "EST", + "EST5EDT", + "Egypt", + "Eire", + "Etc/GMT", + "Etc/GMT+0", + "Etc/GMT+1", + "Etc/GMT+10", + "Etc/GMT+11", + "Etc/GMT+12", + "Etc/GMT+2", + "Etc/GMT+3", + "Etc/GMT+4", + "Etc/GMT+5", + "Etc/GMT+6", + "Etc/GMT+7", + "Etc/GMT+8", + "Etc/GMT+9", + "Etc/GMT-0", + "Etc/GMT-1", + "Etc/GMT-10", + "Etc/GMT-11", + "Etc/GMT-12", + "Etc/GMT-13", + "Etc/GMT-14", + "Etc/GMT-2", + "Etc/GMT-3", + "Etc/GMT-4", + "Etc/GMT-5", + "Etc/GMT-6", + "Etc/GMT-7", + "Etc/GMT-8", + "Etc/GMT-9", + "Etc/GMT0", + "Etc/Greenwich", + "Etc/UCT", + "Etc/UTC", + "Etc/Universal", + "Etc/Zulu", + "Europe/Amsterdam", + "Europe/Andorra", + "Europe/Astrakhan", + "Europe/Athens", + "Europe/Belfast", + "Europe/Belgrade", + "Europe/Berlin", + "Europe/Bratislava", + "Europe/Brussels", + "Europe/Bucharest", + "Europe/Budapest", + "Europe/Busingen", + "Europe/Chisinau", + "Europe/Copenhagen", + "Europe/Dublin", + "Europe/Gibraltar", + "Europe/Guernsey", + "Europe/Helsinki", + "Europe/Isle_of_Man", + "Europe/Istanbul", + "Europe/Jersey", + "Europe/Kaliningrad", + "Europe/Kiev", + "Europe/Kirov", + "Europe/Kyiv", + "Europe/Lisbon", + "Europe/Ljubljana", + "Europe/London", + "Europe/Luxembourg", + "Europe/Madrid", + "Europe/Malta", + "Europe/Mariehamn", + "Europe/Minsk", + "Europe/Monaco", + "Europe/Moscow", + "Europe/Nicosia", + "Europe/Oslo", + "Europe/Paris", + "Europe/Podgorica", + "Europe/Prague", + "Europe/Riga", + "Europe/Rome", + "Europe/Samara", + "Europe/San_Marino", + "Europe/Sarajevo", + "Europe/Saratov", + "Europe/Simferopol", + "Europe/Skopje", + "Europe/Sofia", + "Europe/Stockholm", + "Europe/Tallinn", + "Europe/Tirane", + "Europe/Tiraspol", + "Europe/Ulyanovsk", + "Europe/Uzhgorod", + "Europe/Vaduz", + "Europe/Vatican", + "Europe/Vienna", + "Europe/Vilnius", + "Europe/Volgograd", + "Europe/Warsaw", + "Europe/Zagreb", + "Europe/Zaporozhye", + "Europe/Zurich", + "Factory", + "GB", + "GB-Eire", + "GMT", + "GMT+0", + "GMT-0", + "GMT0", + "Greenwich", + "HST", + "Hongkong", + "Iceland", + "Indian/Antananarivo", + "Indian/Chagos", + "Indian/Christmas", + "Indian/Cocos", + "Indian/Comoro", + "Indian/Kerguelen", + "Indian/Mahe", + "Indian/Maldives", + "Indian/Mauritius", + "Indian/Mayotte", + "Indian/Reunion", + "Iran", + "Israel", + "Jamaica", + "Japan", + "Kwajalein", + "Libya", + "MET", + "MST", + "MST7MDT", + "Mexico/BajaNorte", + "Mexico/BajaSur", + "Mexico/General", + "NZ", + "NZ-CHAT", + "Navajo", + "PRC", + "PST8PDT", + "Pacific/Apia", + "Pacific/Auckland", + "Pacific/Bougainville", + "Pacific/Chatham", + "Pacific/Chuuk", + "Pacific/Easter", + "Pacific/Efate", + "Pacific/Enderbury", + "Pacific/Fakaofo", + "Pacific/Fiji", + "Pacific/Funafuti", + "Pacific/Galapagos", + "Pacific/Gambier", + "Pacific/Guadalcanal", + "Pacific/Guam", + "Pacific/Honolulu", + "Pacific/Johnston", + "Pacific/Kanton", + "Pacific/Kiritimati", + "Pacific/Kosrae", + "Pacific/Kwajalein", + "Pacific/Majuro", + "Pacific/Marquesas", + "Pacific/Midway", + "Pacific/Nauru", + "Pacific/Niue", + "Pacific/Norfolk", + "Pacific/Noumea", + "Pacific/Pago_Pago", + "Pacific/Palau", + "Pacific/Pitcairn", + "Pacific/Pohnpei", + "Pacific/Ponape", + "Pacific/Port_Moresby", + "Pacific/Rarotonga", + "Pacific/Saipan", + "Pacific/Samoa", + "Pacific/Tahiti", + "Pacific/Tarawa", + "Pacific/Tongatapu", + "Pacific/Truk", + "Pacific/Wake", + "Pacific/Wallis", + "Pacific/Yap", + "Poland", + "Portugal", + "ROC", + "ROK", + "Singapore", + "Turkey", + "UCT", + "US/Alaska", + "US/Aleutian", + "US/Arizona", + "US/Central", + "US/East-Indiana", + "US/Eastern", + "US/Hawaii", + "US/Indiana-Starke", + "US/Michigan", + "US/Mountain", + "US/Pacific", + "US/Pacific-New", + "US/Samoa", + "UTC", + "Universal", + "W-SU", + "WET", + "Zulu", + ]) + .optional(), + }) + .optional(), + report_type: z.string(), + }) + + const postReportingReportRunsResponseBodyValidator = + responseValidationFactory([["200", s_reporting_report_run]], s_error) + + // postReportingReportRuns + router.post( + `/v1/reporting/report_runs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postReportingReportRunsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postReportingReportRuns(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postReportingReportRunsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getReportingReportRunsReportRunParamSchema = z.object({ + report_run: z.string().max(5000), + }) + + const getReportingReportRunsReportRunQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getReportingReportRunsReportRunRequestBodySchema = z + .object({}) + .optional() + + const getReportingReportRunsReportRunResponseBodyValidator = + responseValidationFactory([["200", s_reporting_report_run]], s_error) + + // getReportingReportRunsReportRun + router.get( + `/v1/reporting/report_runs/:report_run`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getReportingReportRunsReportRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getReportingReportRunsReportRunQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getReportingReportRunsReportRunRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getReportingReportRunsReportRun(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getReportingReportRunsReportRunResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getReportingReportTypesQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getReportingReportTypesRequestBodySchema = z.object({}).optional() + + const getReportingReportTypesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_reporting_report_type), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getReportingReportTypes + router.get( + `/v1/reporting/report_types`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getReportingReportTypesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getReportingReportTypesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_reporting_report_type[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getReportingReportTypes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getReportingReportTypesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getReportingReportTypesReportTypeParamSchema = z.object({ + report_type: z.string(), + }) + + const getReportingReportTypesReportTypeQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getReportingReportTypesReportTypeRequestBodySchema = z + .object({}) + .optional() + + const getReportingReportTypesReportTypeResponseBodyValidator = + responseValidationFactory([["200", s_reporting_report_type]], s_error) + + // getReportingReportTypesReportType + router.get( + `/v1/reporting/report_types/:report_type`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getReportingReportTypesReportTypeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getReportingReportTypesReportTypeQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getReportingReportTypesReportTypeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getReportingReportTypesReportType(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getReportingReportTypesReportTypeResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getReviewsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getReviewsRequestBodySchema = z.object({}).optional() + + const getReviewsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_review)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getReviews + router.get( + `/v1/reviews`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getReviewsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getReviewsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_review[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getReviews(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getReviewsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getReviewsReviewParamSchema = z.object({ review: z.string().max(5000) }) + + const getReviewsReviewQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getReviewsReviewRequestBodySchema = z.object({}).optional() + + const getReviewsReviewResponseBodyValidator = responseValidationFactory( + [["200", s_review]], + s_error, + ) + + // getReviewsReview + router.get( + `/v1/reviews/:review`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getReviewsReviewParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getReviewsReviewQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getReviewsReviewRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getReviewsReview(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getReviewsReviewResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postReviewsReviewApproveParamSchema = z.object({ + review: z.string().max(5000), + }) + + const postReviewsReviewApproveRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postReviewsReviewApproveResponseBodyValidator = + responseValidationFactory([["200", s_review]], s_error) + + // postReviewsReviewApprove + router.post( + `/v1/reviews/:review/approve`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postReviewsReviewApproveParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postReviewsReviewApproveRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postReviewsReviewApprove(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postReviewsReviewApproveResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSetupAttemptsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + setup_intent: z.string().max(5000), + starting_after: z.string().max(5000).optional(), + }) + + const getSetupAttemptsRequestBodySchema = z.object({}).optional() + + const getSetupAttemptsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_setup_attempt)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/setup_attempts")), + }), + ], + ], + s_error, + ) + + // getSetupAttempts + router.get( + `/v1/setup_attempts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getSetupAttemptsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSetupAttemptsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_setup_attempt[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSetupAttempts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSetupAttemptsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSetupIntentsQuerySchema = z.object({ + attach_to_self: PermissiveBoolean.optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + payment_method: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getSetupIntentsRequestBodySchema = z.object({}).optional() + + const getSetupIntentsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_setup_intent)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/setup_intents")), + }), + ], + ], + s_error, + ) + + // getSetupIntents + router.get( + `/v1/setup_intents`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getSetupIntentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSetupIntentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_setup_intent[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSetupIntents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSetupIntentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSetupIntentsRequestBodySchema = z + .object({ + attach_to_self: PermissiveBoolean.optional(), + automatic_payment_methods: z + .object({ + allow_redirects: z.enum(["always", "never"]).optional(), + enabled: PermissiveBoolean, + }) + .optional(), + confirm: PermissiveBoolean.optional(), + confirmation_token: z.string().max(5000).optional(), + customer: z.string().max(5000).optional(), + description: z.string().max(1000).optional(), + expand: z.array(z.string().max(5000)).optional(), + flow_directions: z.array(z.enum(["inbound", "outbound"])).optional(), + mandate_data: z + .union([ + z.object({ + customer_acceptance: z.object({ + accepted_at: z.coerce.number().optional(), + offline: z.object({}).optional(), + online: z + .object({ + ip_address: z.string(), + user_agent: z.string().max(5000), + }) + .optional(), + type: z.enum(["offline", "online"]), + }), + }), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.string().optional(), + payment_method: z.string().max(5000).optional(), + payment_method_configuration: z.string().max(100).optional(), + payment_method_data: z + .object({ + acss_debit: z + .object({ + account_number: z.string().max(5000), + institution_number: z.string().max(5000), + transit_number: z.string().max(5000), + }) + .optional(), + affirm: z.object({}).optional(), + afterpay_clearpay: z.object({}).optional(), + alipay: z.object({}).optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + alma: z.object({}).optional(), + amazon_pay: z.object({}).optional(), + au_becs_debit: z + .object({ + account_number: z.string().max(5000), + bsb_number: z.string().max(5000), + }) + .optional(), + bacs_debit: z + .object({ + account_number: z.string().max(5000).optional(), + sort_code: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z.object({}).optional(), + billie: z.object({}).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + blik: z.object({}).optional(), + boleto: z.object({ tax_id: z.string().max(5000) }).optional(), + cashapp: z.object({}).optional(), + customer_balance: z.object({}).optional(), + eps: z + .object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .optional(), + }) + .optional(), + fpx: z + .object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + }) + .optional(), + giropay: z.object({}).optional(), + grabpay: z.object({}).optional(), + ideal: z + .object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .optional(), + }) + .optional(), + interac_present: z.object({}).optional(), + kakao_pay: z.object({}).optional(), + klarna: z + .object({ + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + }) + .optional(), + konbini: z.object({}).optional(), + kr_card: z.object({}).optional(), + link: z.object({}).optional(), + metadata: z.record(z.string()).optional(), + mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), + naver_pay: z + .object({ funding: z.enum(["card", "points"]).optional() }) + .optional(), + nz_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000), + bank_code: z.string().max(5000), + branch_code: z.string().max(5000), + reference: z.string().max(128).optional(), + suffix: z.string().max(5000), + }) + .optional(), + oxxo: z.object({}).optional(), + p24: z + .object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z.object({}).optional(), + paynow: z.object({}).optional(), + paypal: z.object({}).optional(), + pix: z.object({}).optional(), + promptpay: z.object({}).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + revolut_pay: z.object({}).optional(), + samsung_pay: z.object({}).optional(), + satispay: z.object({}).optional(), + sepa_debit: z.object({ iban: z.string().max(5000) }).optional(), + sofort: z + .object({ country: z.enum(["AT", "BE", "DE", "ES", "IT", "NL"]) }) + .optional(), + swish: z.object({}).optional(), + twint: z.object({}).optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + wechat_pay: z.object({}).optional(), + zip: z.object({}).optional(), + }) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .object({ + currency: z.enum(["cad", "usd"]).optional(), + mandate_options: z + .object({ + custom_mandate_url: z + .union([z.string(), z.enum([""])]) + .optional(), + default_for: z + .array(z.enum(["invoice", "subscription"])) + .optional(), + interval_description: z.string().max(500).optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .optional(), + transaction_type: z.enum(["business", "personal"]).optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + .optional(), + amazon_pay: z.object({}).optional(), + bacs_debit: z + .object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + card: z + .object({ + mandate_options: z + .object({ + amount: z.coerce.number(), + amount_type: z.enum(["fixed", "maximum"]), + currency: z.string(), + description: z.string().max(200).optional(), + end_date: z.coerce.number().optional(), + interval: z.enum([ + "day", + "month", + "sporadic", + "week", + "year", + ]), + interval_count: z.coerce.number().optional(), + reference: z.string().max(80), + start_date: z.coerce.number(), + supported_types: z.array(z.enum(["india"])).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + three_d_secure: z + .object({ + ares_trans_status: z + .enum(["A", "C", "I", "N", "R", "U", "Y"]) + .optional(), + cryptogram: z.string().max(5000).optional(), + electronic_commerce_indicator: z + .enum(["01", "02", "05", "06", "07"]) + .optional(), + network_options: z + .object({ + cartes_bancaires: z + .object({ + cb_avalgo: z.enum(["0", "1", "2", "3", "4", "A"]), + cb_exemption: z.string().max(4).optional(), + cb_score: z.coerce.number().optional(), + }) + .optional(), + }) + .optional(), + requestor_challenge_indicator: z.string().max(2).optional(), + transaction_id: z.string().max(5000).optional(), + version: z.enum(["1.0.2", "2.1.0", "2.2.0"]).optional(), + }) + .optional(), + }) + .optional(), + card_present: z.object({}).optional(), + link: z.object({}).optional(), + paypal: z + .object({ billing_agreement_id: z.string().max(5000).optional() }) + .optional(), + sepa_debit: z + .object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + us_bank_account: z + .object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + return_url: z.string().max(5000).optional(), + }) + .optional(), + mandate_options: z + .object({ collection_method: z.enum(["", "paper"]).optional() }) + .optional(), + networks: z + .object({ + requested: z + .array(z.enum(["ach", "us_domestic_wire"])) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + .optional(), + }) + .optional(), + payment_method_types: z.array(z.string().max(5000)).optional(), + return_url: z.string().optional(), + single_use: z + .object({ amount: z.coerce.number(), currency: z.string() }) + .optional(), + usage: z.enum(["off_session", "on_session"]).optional(), + use_stripe_sdk: PermissiveBoolean.optional(), + }) + .optional() + + const postSetupIntentsResponseBodyValidator = responseValidationFactory( + [["200", s_setup_intent]], + s_error, + ) + + // postSetupIntents + router.post( + `/v1/setup_intents`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postSetupIntentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSetupIntents(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSetupIntentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSetupIntentsIntentParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const getSetupIntentsIntentQuerySchema = z.object({ + client_secret: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getSetupIntentsIntentRequestBodySchema = z.object({}).optional() + + const getSetupIntentsIntentResponseBodyValidator = responseValidationFactory( + [["200", s_setup_intent]], + s_error, + ) + + // getSetupIntentsIntent + router.get( + `/v1/setup_intents/:intent`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSetupIntentsIntentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSetupIntentsIntentQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSetupIntentsIntentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSetupIntentsIntent(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSetupIntentsIntentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSetupIntentsIntentParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postSetupIntentsIntentRequestBodySchema = z + .object({ + attach_to_self: PermissiveBoolean.optional(), + customer: z.string().max(5000).optional(), + description: z.string().max(1000).optional(), + expand: z.array(z.string().max(5000)).optional(), + flow_directions: z.array(z.enum(["inbound", "outbound"])).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + payment_method: z.string().max(5000).optional(), + payment_method_configuration: z.string().max(100).optional(), + payment_method_data: z + .object({ + acss_debit: z + .object({ + account_number: z.string().max(5000), + institution_number: z.string().max(5000), + transit_number: z.string().max(5000), + }) + .optional(), + affirm: z.object({}).optional(), + afterpay_clearpay: z.object({}).optional(), + alipay: z.object({}).optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + alma: z.object({}).optional(), + amazon_pay: z.object({}).optional(), + au_becs_debit: z + .object({ + account_number: z.string().max(5000), + bsb_number: z.string().max(5000), + }) + .optional(), + bacs_debit: z + .object({ + account_number: z.string().max(5000).optional(), + sort_code: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z.object({}).optional(), + billie: z.object({}).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + blik: z.object({}).optional(), + boleto: z.object({ tax_id: z.string().max(5000) }).optional(), + cashapp: z.object({}).optional(), + customer_balance: z.object({}).optional(), + eps: z + .object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .optional(), + }) + .optional(), + fpx: z + .object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + }) + .optional(), + giropay: z.object({}).optional(), + grabpay: z.object({}).optional(), + ideal: z + .object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .optional(), + }) + .optional(), + interac_present: z.object({}).optional(), + kakao_pay: z.object({}).optional(), + klarna: z + .object({ + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + }) + .optional(), + konbini: z.object({}).optional(), + kr_card: z.object({}).optional(), + link: z.object({}).optional(), + metadata: z.record(z.string()).optional(), + mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), + naver_pay: z + .object({ funding: z.enum(["card", "points"]).optional() }) + .optional(), + nz_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000), + bank_code: z.string().max(5000), + branch_code: z.string().max(5000), + reference: z.string().max(128).optional(), + suffix: z.string().max(5000), + }) + .optional(), + oxxo: z.object({}).optional(), + p24: z + .object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z.object({}).optional(), + paynow: z.object({}).optional(), + paypal: z.object({}).optional(), + pix: z.object({}).optional(), + promptpay: z.object({}).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + revolut_pay: z.object({}).optional(), + samsung_pay: z.object({}).optional(), + satispay: z.object({}).optional(), + sepa_debit: z.object({ iban: z.string().max(5000) }).optional(), + sofort: z + .object({ country: z.enum(["AT", "BE", "DE", "ES", "IT", "NL"]) }) + .optional(), + swish: z.object({}).optional(), + twint: z.object({}).optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + wechat_pay: z.object({}).optional(), + zip: z.object({}).optional(), + }) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .object({ + currency: z.enum(["cad", "usd"]).optional(), + mandate_options: z + .object({ + custom_mandate_url: z + .union([z.string(), z.enum([""])]) + .optional(), + default_for: z + .array(z.enum(["invoice", "subscription"])) + .optional(), + interval_description: z.string().max(500).optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .optional(), + transaction_type: z.enum(["business", "personal"]).optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + .optional(), + amazon_pay: z.object({}).optional(), + bacs_debit: z + .object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + card: z + .object({ + mandate_options: z + .object({ + amount: z.coerce.number(), + amount_type: z.enum(["fixed", "maximum"]), + currency: z.string(), + description: z.string().max(200).optional(), + end_date: z.coerce.number().optional(), + interval: z.enum([ + "day", + "month", + "sporadic", + "week", + "year", + ]), + interval_count: z.coerce.number().optional(), + reference: z.string().max(80), + start_date: z.coerce.number(), + supported_types: z.array(z.enum(["india"])).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + three_d_secure: z + .object({ + ares_trans_status: z + .enum(["A", "C", "I", "N", "R", "U", "Y"]) + .optional(), + cryptogram: z.string().max(5000).optional(), + electronic_commerce_indicator: z + .enum(["01", "02", "05", "06", "07"]) + .optional(), + network_options: z + .object({ + cartes_bancaires: z + .object({ + cb_avalgo: z.enum(["0", "1", "2", "3", "4", "A"]), + cb_exemption: z.string().max(4).optional(), + cb_score: z.coerce.number().optional(), + }) + .optional(), + }) + .optional(), + requestor_challenge_indicator: z.string().max(2).optional(), + transaction_id: z.string().max(5000).optional(), + version: z.enum(["1.0.2", "2.1.0", "2.2.0"]).optional(), + }) + .optional(), + }) + .optional(), + card_present: z.object({}).optional(), + link: z.object({}).optional(), + paypal: z + .object({ billing_agreement_id: z.string().max(5000).optional() }) + .optional(), + sepa_debit: z + .object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + us_bank_account: z + .object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + return_url: z.string().max(5000).optional(), + }) + .optional(), + mandate_options: z + .object({ collection_method: z.enum(["", "paper"]).optional() }) + .optional(), + networks: z + .object({ + requested: z + .array(z.enum(["ach", "us_domestic_wire"])) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + .optional(), + }) + .optional(), + payment_method_types: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postSetupIntentsIntentResponseBodyValidator = responseValidationFactory( + [["200", s_setup_intent]], + s_error, + ) + + // postSetupIntentsIntent + router.post( + `/v1/setup_intents/:intent`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSetupIntentsIntentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSetupIntentsIntentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSetupIntentsIntent(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSetupIntentsIntentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSetupIntentsIntentCancelParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postSetupIntentsIntentCancelRequestBodySchema = z + .object({ + cancellation_reason: z + .enum(["abandoned", "duplicate", "requested_by_customer"]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postSetupIntentsIntentCancelResponseBodyValidator = + responseValidationFactory([["200", s_setup_intent]], s_error) + + // postSetupIntentsIntentCancel + router.post( + `/v1/setup_intents/:intent/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSetupIntentsIntentCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSetupIntentsIntentCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSetupIntentsIntentCancel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postSetupIntentsIntentCancelResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSetupIntentsIntentConfirmParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postSetupIntentsIntentConfirmRequestBodySchema = z + .object({ + client_secret: z.string().max(5000).optional(), + confirmation_token: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + mandate_data: z + .union([ + z.object({ + customer_acceptance: z.object({ + accepted_at: z.coerce.number().optional(), + offline: z.object({}).optional(), + online: z + .object({ + ip_address: z.string(), + user_agent: z.string().max(5000), + }) + .optional(), + type: z.enum(["offline", "online"]), + }), + }), + z.enum([""]), + z.object({ + customer_acceptance: z.object({ + online: z.object({ + ip_address: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }), + type: z.enum(["online"]), + }), + }), + ]) + .optional(), + payment_method: z.string().max(5000).optional(), + payment_method_data: z + .object({ + acss_debit: z + .object({ + account_number: z.string().max(5000), + institution_number: z.string().max(5000), + transit_number: z.string().max(5000), + }) + .optional(), + affirm: z.object({}).optional(), + afterpay_clearpay: z.object({}).optional(), + alipay: z.object({}).optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + alma: z.object({}).optional(), + amazon_pay: z.object({}).optional(), + au_becs_debit: z + .object({ + account_number: z.string().max(5000), + bsb_number: z.string().max(5000), + }) + .optional(), + bacs_debit: z + .object({ + account_number: z.string().max(5000).optional(), + sort_code: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z.object({}).optional(), + billie: z.object({}).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + blik: z.object({}).optional(), + boleto: z.object({ tax_id: z.string().max(5000) }).optional(), + cashapp: z.object({}).optional(), + customer_balance: z.object({}).optional(), + eps: z + .object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .optional(), + }) + .optional(), + fpx: z + .object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + }) + .optional(), + giropay: z.object({}).optional(), + grabpay: z.object({}).optional(), + ideal: z + .object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .optional(), + }) + .optional(), + interac_present: z.object({}).optional(), + kakao_pay: z.object({}).optional(), + klarna: z + .object({ + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + }) + .optional(), + konbini: z.object({}).optional(), + kr_card: z.object({}).optional(), + link: z.object({}).optional(), + metadata: z.record(z.string()).optional(), + mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), + naver_pay: z + .object({ funding: z.enum(["card", "points"]).optional() }) + .optional(), + nz_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000), + bank_code: z.string().max(5000), + branch_code: z.string().max(5000), + reference: z.string().max(128).optional(), + suffix: z.string().max(5000), + }) + .optional(), + oxxo: z.object({}).optional(), + p24: z + .object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z.object({}).optional(), + paynow: z.object({}).optional(), + paypal: z.object({}).optional(), + pix: z.object({}).optional(), + promptpay: z.object({}).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + revolut_pay: z.object({}).optional(), + samsung_pay: z.object({}).optional(), + satispay: z.object({}).optional(), + sepa_debit: z.object({ iban: z.string().max(5000) }).optional(), + sofort: z + .object({ country: z.enum(["AT", "BE", "DE", "ES", "IT", "NL"]) }) + .optional(), + swish: z.object({}).optional(), + twint: z.object({}).optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + wechat_pay: z.object({}).optional(), + zip: z.object({}).optional(), + }) + .optional(), + payment_method_options: z + .object({ + acss_debit: z + .object({ + currency: z.enum(["cad", "usd"]).optional(), + mandate_options: z + .object({ + custom_mandate_url: z + .union([z.string(), z.enum([""])]) + .optional(), + default_for: z + .array(z.enum(["invoice", "subscription"])) + .optional(), + interval_description: z.string().max(500).optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .optional(), + transaction_type: z.enum(["business", "personal"]).optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + .optional(), + amazon_pay: z.object({}).optional(), + bacs_debit: z + .object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + card: z + .object({ + mandate_options: z + .object({ + amount: z.coerce.number(), + amount_type: z.enum(["fixed", "maximum"]), + currency: z.string(), + description: z.string().max(200).optional(), + end_date: z.coerce.number().optional(), + interval: z.enum([ + "day", + "month", + "sporadic", + "week", + "year", + ]), + interval_count: z.coerce.number().optional(), + reference: z.string().max(80), + start_date: z.coerce.number(), + supported_types: z.array(z.enum(["india"])).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + three_d_secure: z + .object({ + ares_trans_status: z + .enum(["A", "C", "I", "N", "R", "U", "Y"]) + .optional(), + cryptogram: z.string().max(5000).optional(), + electronic_commerce_indicator: z + .enum(["01", "02", "05", "06", "07"]) + .optional(), + network_options: z + .object({ + cartes_bancaires: z + .object({ + cb_avalgo: z.enum(["0", "1", "2", "3", "4", "A"]), + cb_exemption: z.string().max(4).optional(), + cb_score: z.coerce.number().optional(), + }) + .optional(), + }) + .optional(), + requestor_challenge_indicator: z.string().max(2).optional(), + transaction_id: z.string().max(5000).optional(), + version: z.enum(["1.0.2", "2.1.0", "2.2.0"]).optional(), + }) + .optional(), + }) + .optional(), + card_present: z.object({}).optional(), + link: z.object({}).optional(), + paypal: z + .object({ billing_agreement_id: z.string().max(5000).optional() }) + .optional(), + sepa_debit: z + .object({ + mandate_options: z + .object({ + reference_prefix: z + .union([z.string().max(12), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + us_bank_account: z + .object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .optional(), + return_url: z.string().max(5000).optional(), + }) + .optional(), + mandate_options: z + .object({ collection_method: z.enum(["", "paper"]).optional() }) + .optional(), + networks: z + .object({ + requested: z + .array(z.enum(["ach", "us_domestic_wire"])) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + .optional(), + }) + .optional(), + return_url: z.string().optional(), + use_stripe_sdk: PermissiveBoolean.optional(), + }) + .optional() + + const postSetupIntentsIntentConfirmResponseBodyValidator = + responseValidationFactory([["200", s_setup_intent]], s_error) + + // postSetupIntentsIntentConfirm + router.post( + `/v1/setup_intents/:intent/confirm`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSetupIntentsIntentConfirmParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSetupIntentsIntentConfirmRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSetupIntentsIntentConfirm(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postSetupIntentsIntentConfirmResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSetupIntentsIntentVerifyMicrodepositsParamSchema = z.object({ + intent: z.string().max(5000), + }) + + const postSetupIntentsIntentVerifyMicrodepositsRequestBodySchema = z + .object({ + amounts: z.array(z.coerce.number()).optional(), + client_secret: z.string().max(5000).optional(), + descriptor_code: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + }) + .optional() + + const postSetupIntentsIntentVerifyMicrodepositsResponseBodyValidator = + responseValidationFactory([["200", s_setup_intent]], s_error) + + // postSetupIntentsIntentVerifyMicrodeposits + router.post( + `/v1/setup_intents/:intent/verify_microdeposits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSetupIntentsIntentVerifyMicrodepositsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSetupIntentsIntentVerifyMicrodepositsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSetupIntentsIntentVerifyMicrodeposits( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postSetupIntentsIntentVerifyMicrodepositsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getShippingRatesQuerySchema = z.object({ + active: PermissiveBoolean.optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + currency: z.string().optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getShippingRatesRequestBodySchema = z.object({}).optional() + + const getShippingRatesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_shipping_rate), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/shipping_rates")), + }), + ], + ], + s_error, + ) + + // getShippingRates + router.get( + `/v1/shipping_rates`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getShippingRatesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getShippingRatesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_shipping_rate[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getShippingRates(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getShippingRatesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postShippingRatesRequestBodySchema = z.object({ + delivery_estimate: z + .object({ + maximum: z + .object({ + unit: z.enum(["business_day", "day", "hour", "month", "week"]), + value: z.coerce.number(), + }) + .optional(), + minimum: z + .object({ + unit: z.enum(["business_day", "day", "hour", "month", "week"]), + value: z.coerce.number(), + }) + .optional(), + }) + .optional(), + display_name: z.string().max(100), + expand: z.array(z.string().max(5000)).optional(), + fixed_amount: z + .object({ + amount: z.coerce.number(), + currency: z.string(), + currency_options: z + .record( + z.object({ + amount: z.coerce.number(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + }), + ) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + tax_behavior: z.enum(["exclusive", "inclusive", "unspecified"]).optional(), + tax_code: z.string().optional(), + type: z.enum(["fixed_amount"]).optional(), + }) + + const postShippingRatesResponseBodyValidator = responseValidationFactory( + [["200", s_shipping_rate]], + s_error, + ) + + // postShippingRates + router.post( + `/v1/shipping_rates`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postShippingRatesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postShippingRates(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postShippingRatesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getShippingRatesShippingRateTokenParamSchema = z.object({ + shipping_rate_token: z.string().max(5000), + }) + + const getShippingRatesShippingRateTokenQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getShippingRatesShippingRateTokenRequestBodySchema = z + .object({}) + .optional() + + const getShippingRatesShippingRateTokenResponseBodyValidator = + responseValidationFactory([["200", s_shipping_rate]], s_error) + + // getShippingRatesShippingRateToken + router.get( + `/v1/shipping_rates/:shipping_rate_token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getShippingRatesShippingRateTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getShippingRatesShippingRateTokenQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getShippingRatesShippingRateTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getShippingRatesShippingRateToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getShippingRatesShippingRateTokenResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postShippingRatesShippingRateTokenParamSchema = z.object({ + shipping_rate_token: z.string().max(5000), + }) + + const postShippingRatesShippingRateTokenRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + fixed_amount: z + .object({ + currency_options: z + .record( + z.object({ + amount: z.coerce.number().optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + }), + ) + .optional(), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + }) + .optional() + + const postShippingRatesShippingRateTokenResponseBodyValidator = + responseValidationFactory([["200", s_shipping_rate]], s_error) + + // postShippingRatesShippingRateToken + router.post( + `/v1/shipping_rates/:shipping_rate_token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postShippingRatesShippingRateTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postShippingRatesShippingRateTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postShippingRatesShippingRateToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postShippingRatesShippingRateTokenResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSigmaSavedQueriesIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postSigmaSavedQueriesIdRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + name: z.string().max(5000).optional(), + sql: z.string().max(100000).optional(), + }) + .optional() + + const postSigmaSavedQueriesIdResponseBodyValidator = + responseValidationFactory([["200", s_sigma_sigma_api_query]], s_error) + + // postSigmaSavedQueriesId + router.post( + `/v1/sigma/saved_queries/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSigmaSavedQueriesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSigmaSavedQueriesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSigmaSavedQueriesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSigmaSavedQueriesIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSigmaScheduledQueryRunsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getSigmaScheduledQueryRunsRequestBodySchema = z.object({}).optional() + + const getSigmaScheduledQueryRunsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_scheduled_query_run)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/sigma/scheduled_query_runs")), + }), + ], + ], + s_error, + ) + + // getSigmaScheduledQueryRuns + router.get( + `/v1/sigma/scheduled_query_runs`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getSigmaScheduledQueryRunsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSigmaScheduledQueryRunsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_scheduled_query_run[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSigmaScheduledQueryRuns(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getSigmaScheduledQueryRunsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSigmaScheduledQueryRunsScheduledQueryRunParamSchema = z.object({ + scheduled_query_run: z.string().max(5000), + }) + + const getSigmaScheduledQueryRunsScheduledQueryRunQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getSigmaScheduledQueryRunsScheduledQueryRunRequestBodySchema = z + .object({}) + .optional() + + const getSigmaScheduledQueryRunsScheduledQueryRunResponseBodyValidator = + responseValidationFactory([["200", s_scheduled_query_run]], s_error) + + // getSigmaScheduledQueryRunsScheduledQueryRun + router.get( + `/v1/sigma/scheduled_query_runs/:scheduled_query_run`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSigmaScheduledQueryRunsScheduledQueryRunParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSigmaScheduledQueryRunsScheduledQueryRunQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSigmaScheduledQueryRunsScheduledQueryRunRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSigmaScheduledQueryRunsScheduledQueryRun( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getSigmaScheduledQueryRunsScheduledQueryRunResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSourcesRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + customer: z.string().max(500).optional(), + expand: z.array(z.string().max(5000)).optional(), + flow: z + .enum(["code_verification", "none", "receiver", "redirect"]) + .optional(), + mandate: z + .object({ + acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + offline: z.object({ contact_email: z.string() }).optional(), + online: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + status: z.enum(["accepted", "pending", "refused", "revoked"]), + type: z.enum(["offline", "online"]).optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + amount: z.union([z.coerce.number(), z.enum([""])]).optional(), + currency: z.string().optional(), + interval: z.enum(["one_time", "scheduled", "variable"]).optional(), + notification_method: z + .enum([ + "deprecated_none", + "email", + "manual", + "none", + "stripe_email", + ]) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + original_source: z.string().max(5000).optional(), + owner: z + .object({ + address: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + email: z.string().optional(), + name: z.string().max(5000).optional(), + phone: z.string().max(5000).optional(), + }) + .optional(), + receiver: z + .object({ + refund_attributes_method: z + .enum(["email", "manual", "none"]) + .optional(), + }) + .optional(), + redirect: z.object({ return_url: z.string() }).optional(), + source_order: z + .object({ + items: z + .array( + z.object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + description: z.string().max(1000).optional(), + parent: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + type: z.enum(["discount", "shipping", "sku", "tax"]).optional(), + }), + ) + .optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + carrier: z.string().max(5000).optional(), + name: z.string().max(5000).optional(), + phone: z.string().max(5000).optional(), + tracking_number: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional(), + statement_descriptor: z.string().max(5000).optional(), + token: z.string().max(5000).optional(), + type: z.string().max(5000).optional(), + usage: z.enum(["reusable", "single_use"]).optional(), + }) + .optional() + + const postSourcesResponseBodyValidator = responseValidationFactory( + [["200", s_source]], + s_error, + ) + + // postSources + router.post( + `/v1/sources`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postSourcesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSources(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSourcesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSourcesSourceParamSchema = z.object({ source: z.string().max(5000) }) + + const getSourcesSourceQuerySchema = z.object({ + client_secret: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getSourcesSourceRequestBodySchema = z.object({}).optional() + + const getSourcesSourceResponseBodyValidator = responseValidationFactory( + [["200", s_source]], + s_error, + ) + + // getSourcesSource + router.get( + `/v1/sources/:source`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSourcesSourceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSourcesSourceQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSourcesSourceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSourcesSource(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSourcesSourceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSourcesSourceParamSchema = z.object({ + source: z.string().max(5000), + }) + + const postSourcesSourceRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + expand: z.array(z.string().max(5000)).optional(), + mandate: z + .object({ + acceptance: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + offline: z.object({ contact_email: z.string() }).optional(), + online: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + status: z.enum(["accepted", "pending", "refused", "revoked"]), + type: z.enum(["offline", "online"]).optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + amount: z.union([z.coerce.number(), z.enum([""])]).optional(), + currency: z.string().optional(), + interval: z.enum(["one_time", "scheduled", "variable"]).optional(), + notification_method: z + .enum([ + "deprecated_none", + "email", + "manual", + "none", + "stripe_email", + ]) + .optional(), + }) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + owner: z + .object({ + address: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + email: z.string().optional(), + name: z.string().max(5000).optional(), + phone: z.string().max(5000).optional(), + }) + .optional(), + source_order: z + .object({ + items: z + .array( + z.object({ + amount: z.coerce.number().optional(), + currency: z.string().optional(), + description: z.string().max(1000).optional(), + parent: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + type: z.enum(["discount", "shipping", "sku", "tax"]).optional(), + }), + ) + .optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + carrier: z.string().max(5000).optional(), + name: z.string().max(5000).optional(), + phone: z.string().max(5000).optional(), + tracking_number: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional() + + const postSourcesSourceResponseBodyValidator = responseValidationFactory( + [["200", s_source]], + s_error, + ) + + // postSourcesSource + router.post( + `/v1/sources/:source`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSourcesSourceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSourcesSourceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSourcesSource(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSourcesSourceResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSourcesSourceMandateNotificationsMandateNotificationParamSchema = + z.object({ + mandate_notification: z.string().max(5000), + source: z.string().max(5000), + }) + + const getSourcesSourceMandateNotificationsMandateNotificationQuerySchema = + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getSourcesSourceMandateNotificationsMandateNotificationRequestBodySchema = + z.object({}).optional() + + const getSourcesSourceMandateNotificationsMandateNotificationResponseBodyValidator = + responseValidationFactory([["200", s_source_mandate_notification]], s_error) + + // getSourcesSourceMandateNotificationsMandateNotification + router.get( + `/v1/sources/:source/mandate_notifications/:mandate_notification`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSourcesSourceMandateNotificationsMandateNotificationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSourcesSourceMandateNotificationsMandateNotificationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSourcesSourceMandateNotificationsMandateNotificationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSourcesSourceMandateNotificationsMandateNotification( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getSourcesSourceMandateNotificationsMandateNotificationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSourcesSourceSourceTransactionsParamSchema = z.object({ + source: z.string().max(5000), + }) + + const getSourcesSourceSourceTransactionsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getSourcesSourceSourceTransactionsRequestBodySchema = z + .object({}) + .optional() + + const getSourcesSourceSourceTransactionsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_source_transaction), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getSourcesSourceSourceTransactions + router.get( + `/v1/sources/:source/source_transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSourcesSourceSourceTransactionsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSourcesSourceSourceTransactionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSourcesSourceSourceTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_source_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSourcesSourceSourceTransactions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getSourcesSourceSourceTransactionsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSourcesSourceSourceTransactionsSourceTransactionParamSchema = + z.object({ + source: z.string().max(5000), + source_transaction: z.string().max(5000), + }) + + const getSourcesSourceSourceTransactionsSourceTransactionQuerySchema = + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getSourcesSourceSourceTransactionsSourceTransactionRequestBodySchema = z + .object({}) + .optional() + + const getSourcesSourceSourceTransactionsSourceTransactionResponseBodyValidator = + responseValidationFactory([["200", s_source_transaction]], s_error) + + // getSourcesSourceSourceTransactionsSourceTransaction + router.get( + `/v1/sources/:source/source_transactions/:source_transaction`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSourcesSourceSourceTransactionsSourceTransactionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSourcesSourceSourceTransactionsSourceTransactionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSourcesSourceSourceTransactionsSourceTransactionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSourcesSourceSourceTransactionsSourceTransaction( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getSourcesSourceSourceTransactionsSourceTransactionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSourcesSourceVerifyParamSchema = z.object({ + source: z.string().max(5000), + }) + + const postSourcesSourceVerifyRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + values: z.array(z.string().max(5000)), + }) + + const postSourcesSourceVerifyResponseBodyValidator = + responseValidationFactory([["200", s_source]], s_error) + + // postSourcesSourceVerify + router.post( + `/v1/sources/:source/verify`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSourcesSourceVerifyParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSourcesSourceVerifyRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSourcesSourceVerify(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSourcesSourceVerifyResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSubscriptionItemsQuerySchema = z.object({ + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().optional(), + subscription: z.string().max(5000), + }) + + const getSubscriptionItemsRequestBodySchema = z.object({}).optional() + + const getSubscriptionItemsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_subscription_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/subscription_items")), + }), + ], + ], + s_error, + ) + + // getSubscriptionItems + router.get( + `/v1/subscription_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getSubscriptionItemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSubscriptionItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_subscription_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSubscriptionItems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSubscriptionItemsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionItemsRequestBodySchema = z.object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + payment_behavior: z + .enum([ + "allow_incomplete", + "default_incomplete", + "error_if_incomplete", + "pending_if_incomplete", + ]) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + proration_date: z.coerce.number().optional(), + quantity: z.coerce.number().optional(), + subscription: z.string().max(5000), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }) + + const postSubscriptionItemsResponseBodyValidator = responseValidationFactory( + [["200", s_subscription_item]], + s_error, + ) + + // postSubscriptionItems + router.post( + `/v1/subscription_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postSubscriptionItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptionItems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSubscriptionItemsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteSubscriptionItemsItemParamSchema = z.object({ + item: z.string().max(5000), + }) + + const deleteSubscriptionItemsItemRequestBodySchema = z + .object({ + clear_usage: PermissiveBoolean.optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + proration_date: z.coerce.number().optional(), + }) + .optional() + + const deleteSubscriptionItemsItemResponseBodyValidator = + responseValidationFactory([["200", s_deleted_subscription_item]], s_error) + + // deleteSubscriptionItemsItem + router.delete( + `/v1/subscription_items/:item`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteSubscriptionItemsItemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteSubscriptionItemsItemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteSubscriptionItemsItem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteSubscriptionItemsItemResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSubscriptionItemsItemParamSchema = z.object({ + item: z.string().max(5000), + }) + + const getSubscriptionItemsItemQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getSubscriptionItemsItemRequestBodySchema = z.object({}).optional() + + const getSubscriptionItemsItemResponseBodyValidator = + responseValidationFactory([["200", s_subscription_item]], s_error) + + // getSubscriptionItemsItem + router.get( + `/v1/subscription_items/:item`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSubscriptionItemsItemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSubscriptionItemsItemQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSubscriptionItemsItemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSubscriptionItemsItem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSubscriptionItemsItemResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionItemsItemParamSchema = z.object({ + item: z.string().max(5000), + }) + + const postSubscriptionItemsItemRequestBodySchema = z + .object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + off_session: PermissiveBoolean.optional(), + payment_behavior: z + .enum([ + "allow_incomplete", + "default_incomplete", + "error_if_incomplete", + "pending_if_incomplete", + ]) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + proration_date: z.coerce.number().optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }) + .optional() + + const postSubscriptionItemsItemResponseBodyValidator = + responseValidationFactory([["200", s_subscription_item]], s_error) + + // postSubscriptionItemsItem + router.post( + `/v1/subscription_items/:item`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSubscriptionItemsItemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSubscriptionItemsItemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptionItemsItem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSubscriptionItemsItemResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSubscriptionSchedulesQuerySchema = z.object({ + canceled_at: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + completed_at: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + released_at: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + scheduled: PermissiveBoolean.optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getSubscriptionSchedulesRequestBodySchema = z.object({}).optional() + + const getSubscriptionSchedulesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_subscription_schedule)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/subscription_schedules")), + }), + ], + ], + s_error, + ) + + // getSubscriptionSchedules + router.get( + `/v1/subscription_schedules`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getSubscriptionSchedulesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSubscriptionSchedulesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_subscription_schedule[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSubscriptionSchedules(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSubscriptionSchedulesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionSchedulesRequestBodySchema = z + .object({ + customer: z.string().max(5000).optional(), + default_settings: z + .object({ + application_fee_percent: z.coerce.number().optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_cycle_anchor: z.enum(["automatic", "phase_start"]).optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + default_payment_method: z.string().max(5000).optional(), + description: z.union([z.string().max(500), z.enum([""])]).optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + days_until_due: z.coerce.number().optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + on_behalf_of: z.union([z.string(), z.enum([""])]).optional(), + transfer_data: z + .union([ + z.object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + end_behavior: z.enum(["cancel", "none", "release", "renew"]).optional(), + expand: z.array(z.string().max(5000)).optional(), + from_subscription: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + phases: z + .array( + z.object({ + add_invoice_items: z + .array( + z.object({ + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + application_fee_percent: z.coerce.number().optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_cycle_anchor: z + .enum(["automatic", "phase_start"]) + .optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + currency: z.string().optional(), + default_payment_method: z.string().max(5000).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + description: z + .union([z.string().max(500), z.enum([""])]) + .optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + end_date: z.coerce.number().optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + days_until_due: z.coerce.number().optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + items: z.array( + z.object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), + iterations: z.coerce.number().optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.string().optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + transfer_data: z + .object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }) + .optional(), + trial: PermissiveBoolean.optional(), + trial_end: z.coerce.number().optional(), + }), + ) + .optional(), + start_date: z.union([z.coerce.number(), z.enum(["now"])]).optional(), + }) + .optional() + + const postSubscriptionSchedulesResponseBodyValidator = + responseValidationFactory([["200", s_subscription_schedule]], s_error) + + // postSubscriptionSchedules + router.post( + `/v1/subscription_schedules`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postSubscriptionSchedulesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptionSchedules(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSubscriptionSchedulesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSubscriptionSchedulesScheduleParamSchema = z.object({ + schedule: z.string().max(5000), + }) + + const getSubscriptionSchedulesScheduleQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getSubscriptionSchedulesScheduleRequestBodySchema = z + .object({}) + .optional() + + const getSubscriptionSchedulesScheduleResponseBodyValidator = + responseValidationFactory([["200", s_subscription_schedule]], s_error) + + // getSubscriptionSchedulesSchedule + router.get( + `/v1/subscription_schedules/:schedule`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSubscriptionSchedulesScheduleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSubscriptionSchedulesScheduleQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSubscriptionSchedulesScheduleRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSubscriptionSchedulesSchedule(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getSubscriptionSchedulesScheduleResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionSchedulesScheduleParamSchema = z.object({ + schedule: z.string().max(5000), + }) + + const postSubscriptionSchedulesScheduleRequestBodySchema = z + .object({ + default_settings: z + .object({ + application_fee_percent: z.coerce.number().optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_cycle_anchor: z.enum(["automatic", "phase_start"]).optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + default_payment_method: z.string().max(5000).optional(), + description: z.union([z.string().max(500), z.enum([""])]).optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + days_until_due: z.coerce.number().optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + on_behalf_of: z.union([z.string(), z.enum([""])]).optional(), + transfer_data: z + .union([ + z.object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + end_behavior: z.enum(["cancel", "none", "release", "renew"]).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + phases: z + .array( + z.object({ + add_invoice_items: z + .array( + z.object({ + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + application_fee_percent: z.coerce.number().optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_cycle_anchor: z + .enum(["automatic", "phase_start"]) + .optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + default_payment_method: z.string().max(5000).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + description: z + .union([z.string().max(500), z.enum([""])]) + .optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + end_date: z.union([z.coerce.number(), z.enum(["now"])]).optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + days_until_due: z.coerce.number().optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + items: z.array( + z.object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ), + iterations: z.coerce.number().optional(), + metadata: z.record(z.string()).optional(), + on_behalf_of: z.string().optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + start_date: z + .union([z.coerce.number(), z.enum(["now"])]) + .optional(), + transfer_data: z + .object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }) + .optional(), + trial: PermissiveBoolean.optional(), + trial_end: z.union([z.coerce.number(), z.enum(["now"])]).optional(), + }), + ) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + }) + .optional() + + const postSubscriptionSchedulesScheduleResponseBodyValidator = + responseValidationFactory([["200", s_subscription_schedule]], s_error) + + // postSubscriptionSchedulesSchedule + router.post( + `/v1/subscription_schedules/:schedule`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSubscriptionSchedulesScheduleParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSubscriptionSchedulesScheduleRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptionSchedulesSchedule(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postSubscriptionSchedulesScheduleResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionSchedulesScheduleCancelParamSchema = z.object({ + schedule: z.string().max(5000), + }) + + const postSubscriptionSchedulesScheduleCancelRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + invoice_now: PermissiveBoolean.optional(), + prorate: PermissiveBoolean.optional(), + }) + .optional() + + const postSubscriptionSchedulesScheduleCancelResponseBodyValidator = + responseValidationFactory([["200", s_subscription_schedule]], s_error) + + // postSubscriptionSchedulesScheduleCancel + router.post( + `/v1/subscription_schedules/:schedule/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSubscriptionSchedulesScheduleCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSubscriptionSchedulesScheduleCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptionSchedulesScheduleCancel( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postSubscriptionSchedulesScheduleCancelResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionSchedulesScheduleReleaseParamSchema = z.object({ + schedule: z.string().max(5000), + }) + + const postSubscriptionSchedulesScheduleReleaseRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + preserve_cancel_date: PermissiveBoolean.optional(), + }) + .optional() + + const postSubscriptionSchedulesScheduleReleaseResponseBodyValidator = + responseValidationFactory([["200", s_subscription_schedule]], s_error) + + // postSubscriptionSchedulesScheduleRelease + router.post( + `/v1/subscription_schedules/:schedule/release`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSubscriptionSchedulesScheduleReleaseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSubscriptionSchedulesScheduleReleaseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptionSchedulesScheduleRelease( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postSubscriptionSchedulesScheduleReleaseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSubscriptionsQuerySchema = z.object({ + automatic_tax: z.object({ enabled: PermissiveBoolean }).optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + current_period_end: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + current_period_start: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + price: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + status: z + .enum([ + "active", + "all", + "canceled", + "ended", + "incomplete", + "incomplete_expired", + "past_due", + "paused", + "trialing", + "unpaid", + ]) + .optional(), + test_clock: z.string().max(5000).optional(), + }) + + const getSubscriptionsRequestBodySchema = z.object({}).optional() + + const getSubscriptionsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_subscription)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/subscriptions")), + }), + ], + ], + s_error, + ) + + // getSubscriptions + router.get( + `/v1/subscriptions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getSubscriptionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSubscriptionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_subscription[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSubscriptions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSubscriptionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionsRequestBodySchema = z.object({ + add_invoice_items: z + .array( + z.object({ + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + application_fee_percent: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + backdate_start_date: z.coerce.number().optional(), + billing_cycle_anchor: z.coerce.number().optional(), + billing_cycle_anchor_config: z + .object({ + day_of_month: z.coerce.number(), + hour: z.coerce.number().optional(), + minute: z.coerce.number().optional(), + month: z.coerce.number().optional(), + second: z.coerce.number().optional(), + }) + .optional(), + cancel_at: z.coerce.number().optional(), + cancel_at_period_end: PermissiveBoolean.optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + currency: z.string().optional(), + customer: z.string().max(5000), + days_until_due: z.coerce.number().optional(), + default_payment_method: z.string().max(5000).optional(), + default_source: z.string().max(5000).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + description: z.string().max(500).optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + items: z + .array( + z.object({ + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + metadata: z.record(z.string()).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + off_session: PermissiveBoolean.optional(), + on_behalf_of: z.union([z.string(), z.enum([""])]).optional(), + payment_behavior: z + .enum([ + "allow_incomplete", + "default_incomplete", + "error_if_incomplete", + "pending_if_incomplete", + ]) + .optional(), + payment_settings: z + .object({ + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + transaction_type: z + .enum(["business", "personal"]) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z + .enum(["de", "en", "fr", "nl"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + mandate_options: z + .object({ + amount: z.coerce.number().optional(), + amount_type: z.enum(["fixed", "maximum"]).optional(), + description: z.string().max(200).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + type: z.string().optional(), + }) + .optional(), + funding_type: z.string().optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z.union([z.object({}), z.enum([""])]).optional(), + sepa_debit: z.union([z.object({}), z.enum([""])]).optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array( + z.enum(["balances", "ownership", "transactions"]), + ) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z + .union([ + z.array( + z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "jp_credit_transfer", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "multibanco", + "naver_pay", + "nz_bank_account", + "p24", + "payco", + "paynow", + "paypal", + "promptpay", + "revolut_pay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "swish", + "us_bank_account", + "wechat_pay", + ]), + ), + z.enum([""]), + ]) + .optional(), + save_default_payment_method: z + .enum(["off", "on_subscription"]) + .optional(), + }) + .optional(), + pending_invoice_item_interval: z + .union([ + z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + z.enum([""]), + ]) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + transfer_data: z + .object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }) + .optional(), + trial_end: z.union([z.enum(["now"]), z.coerce.number()]).optional(), + trial_from_plan: PermissiveBoolean.optional(), + trial_period_days: z.coerce.number().optional(), + trial_settings: z + .object({ + end_behavior: z.object({ + missing_payment_method: z.enum(["cancel", "create_invoice", "pause"]), + }), + }) + .optional(), + }) + + const postSubscriptionsResponseBodyValidator = responseValidationFactory( + [["200", s_subscription]], + s_error, + ) + + // postSubscriptions + router.post( + `/v1/subscriptions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postSubscriptionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postSubscriptionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSubscriptionsSearchQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + page: z.string().max(5000).optional(), + query: z.string().max(5000), + }) + + const getSubscriptionsSearchRequestBodySchema = z.object({}).optional() + + const getSubscriptionsSearchResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_subscription)), + has_more: PermissiveBoolean, + next_page: z.string().max(5000).nullable().optional(), + object: z.enum(["search_result"]), + total_count: z.coerce.number().optional(), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getSubscriptionsSearch + router.get( + `/v1/subscriptions/search`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getSubscriptionsSearchQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSubscriptionsSearchRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_subscription[] + has_more: boolean + next_page?: (string | null) | undefined + object: "search_result" + total_count?: number | undefined + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSubscriptionsSearch(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getSubscriptionsSearchResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteSubscriptionsSubscriptionExposedIdParamSchema = z.object({ + subscription_exposed_id: z.string().max(5000), + }) + + const deleteSubscriptionsSubscriptionExposedIdRequestBodySchema = z + .object({ + cancellation_details: z + .object({ + comment: z.union([z.string().max(5000), z.enum([""])]).optional(), + feedback: z + .enum([ + "", + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ]) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice_now: PermissiveBoolean.optional(), + prorate: PermissiveBoolean.optional(), + }) + .optional() + + const deleteSubscriptionsSubscriptionExposedIdResponseBodyValidator = + responseValidationFactory([["200", s_subscription]], s_error) + + // deleteSubscriptionsSubscriptionExposedId + router.delete( + `/v1/subscriptions/:subscription_exposed_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteSubscriptionsSubscriptionExposedIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteSubscriptionsSubscriptionExposedIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteSubscriptionsSubscriptionExposedId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteSubscriptionsSubscriptionExposedIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getSubscriptionsSubscriptionExposedIdParamSchema = z.object({ + subscription_exposed_id: z.string().max(5000), + }) + + const getSubscriptionsSubscriptionExposedIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getSubscriptionsSubscriptionExposedIdRequestBodySchema = z + .object({}) + .optional() + + const getSubscriptionsSubscriptionExposedIdResponseBodyValidator = + responseValidationFactory([["200", s_subscription]], s_error) + + // getSubscriptionsSubscriptionExposedId + router.get( + `/v1/subscriptions/:subscription_exposed_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getSubscriptionsSubscriptionExposedIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getSubscriptionsSubscriptionExposedIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getSubscriptionsSubscriptionExposedIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getSubscriptionsSubscriptionExposedId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getSubscriptionsSubscriptionExposedIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionsSubscriptionExposedIdParamSchema = z.object({ + subscription_exposed_id: z.string().max(5000), + }) + + const postSubscriptionsSubscriptionExposedIdRequestBodySchema = z + .object({ + add_invoice_items: z + .array( + z.object({ + discounts: z + .array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ) + .optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + application_fee_percent: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + automatic_tax: z + .object({ + enabled: PermissiveBoolean, + liability: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + billing_cycle_anchor: z.enum(["now", "unchanged"]).optional(), + cancel_at: z.union([z.coerce.number(), z.enum([""])]).optional(), + cancel_at_period_end: PermissiveBoolean.optional(), + cancellation_details: z + .object({ + comment: z.union([z.string().max(5000), z.enum([""])]).optional(), + feedback: z + .enum([ + "", + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ]) + .optional(), + }) + .optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .optional(), + days_until_due: z.coerce.number().optional(), + default_payment_method: z.string().max(5000).optional(), + default_source: z.union([z.string().max(5000), z.enum([""])]).optional(), + default_tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + description: z.union([z.string().max(500), z.enum([""])]).optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + invoice_settings: z + .object({ + account_tax_ids: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + issuer: z + .object({ + account: z.string().optional(), + type: z.enum(["account", "self"]), + }) + .optional(), + }) + .optional(), + items: z + .array( + z.object({ + clear_usage: PermissiveBoolean.optional(), + deleted: PermissiveBoolean.optional(), + discounts: z + .union([ + z.array( + z.object({ + coupon: z.string().max(5000).optional(), + discount: z.string().max(5000).optional(), + promotion_code: z.string().max(5000).optional(), + }), + ), + z.enum([""]), + ]) + .optional(), + id: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + price: z.string().max(5000).optional(), + price_data: z + .object({ + currency: z.string(), + product: z.string().max(5000), + recurring: z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .optional(), + unit_amount: z.coerce.number().optional(), + unit_amount_decimal: z.string().optional(), + }) + .optional(), + quantity: z.coerce.number().optional(), + tax_rates: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + }), + ) + .optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + off_session: PermissiveBoolean.optional(), + on_behalf_of: z.union([z.string(), z.enum([""])]).optional(), + pause_collection: z + .union([ + z.object({ + behavior: z.enum(["keep_as_draft", "mark_uncollectible", "void"]), + resumes_at: z.coerce.number().optional(), + }), + z.enum([""]), + ]) + .optional(), + payment_behavior: z + .enum([ + "allow_incomplete", + "default_incomplete", + "error_if_incomplete", + "pending_if_incomplete", + ]) + .optional(), + payment_settings: z + .object({ + payment_method_options: z + .object({ + acss_debit: z + .union([ + z.object({ + mandate_options: z + .object({ + transaction_type: z + .enum(["business", "personal"]) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + bancontact: z + .union([ + z.object({ + preferred_language: z + .enum(["de", "en", "fr", "nl"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + card: z + .union([ + z.object({ + mandate_options: z + .object({ + amount: z.coerce.number().optional(), + amount_type: z.enum(["fixed", "maximum"]).optional(), + description: z.string().max(200).optional(), + }) + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + customer_balance: z + .union([ + z.object({ + bank_transfer: z + .object({ + eu_bank_transfer: z + .object({ country: z.string().max(5000) }) + .optional(), + type: z.string().optional(), + }) + .optional(), + funding_type: z.string().optional(), + }), + z.enum([""]), + ]) + .optional(), + konbini: z.union([z.object({}), z.enum([""])]).optional(), + sepa_debit: z.union([z.object({}), z.enum([""])]).optional(), + us_bank_account: z + .union([ + z.object({ + financial_connections: z + .object({ + filters: z + .object({ + account_subcategories: z + .array(z.enum(["checking", "savings"])) + .optional(), + }) + .optional(), + permissions: z + .array( + z.enum([ + "balances", + "ownership", + "payment_method", + "transactions", + ]), + ) + .optional(), + prefetch: z + .array( + z.enum(["balances", "ownership", "transactions"]), + ) + .optional(), + }) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + payment_method_types: z + .union([ + z.array( + z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "jp_credit_transfer", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "multibanco", + "naver_pay", + "nz_bank_account", + "p24", + "payco", + "paynow", + "paypal", + "promptpay", + "revolut_pay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "swish", + "us_bank_account", + "wechat_pay", + ]), + ), + z.enum([""]), + ]) + .optional(), + save_default_payment_method: z + .enum(["off", "on_subscription"]) + .optional(), + }) + .optional(), + pending_invoice_item_interval: z + .union([ + z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number().optional(), + }), + z.enum([""]), + ]) + .optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + proration_date: z.coerce.number().optional(), + transfer_data: z + .union([ + z.object({ + amount_percent: z.coerce.number().optional(), + destination: z.string(), + }), + z.enum([""]), + ]) + .optional(), + trial_end: z.union([z.enum(["now"]), z.coerce.number()]).optional(), + trial_from_plan: PermissiveBoolean.optional(), + trial_settings: z + .object({ + end_behavior: z.object({ + missing_payment_method: z.enum([ + "cancel", + "create_invoice", + "pause", + ]), + }), + }) + .optional(), + }) + .optional() + + const postSubscriptionsSubscriptionExposedIdResponseBodyValidator = + responseValidationFactory([["200", s_subscription]], s_error) + + // postSubscriptionsSubscriptionExposedId + router.post( + `/v1/subscriptions/:subscription_exposed_id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSubscriptionsSubscriptionExposedIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSubscriptionsSubscriptionExposedIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptionsSubscriptionExposedId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postSubscriptionsSubscriptionExposedIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteSubscriptionsSubscriptionExposedIdDiscountParamSchema = z.object({ + subscription_exposed_id: z.string().max(5000), + }) + + const deleteSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema = z + .object({}) + .optional() + + const deleteSubscriptionsSubscriptionExposedIdDiscountResponseBodyValidator = + responseValidationFactory([["200", s_deleted_discount]], s_error) + + // deleteSubscriptionsSubscriptionExposedIdDiscount + router.delete( + `/v1/subscriptions/:subscription_exposed_id/discount`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteSubscriptionsSubscriptionExposedIdDiscountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteSubscriptionsSubscriptionExposedIdDiscount( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteSubscriptionsSubscriptionExposedIdDiscountResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postSubscriptionsSubscriptionResumeParamSchema = z.object({ + subscription: z.string().max(5000), + }) + + const postSubscriptionsSubscriptionResumeRequestBodySchema = z + .object({ + billing_cycle_anchor: z.enum(["now", "unchanged"]).optional(), + expand: z.array(z.string().max(5000)).optional(), + proration_behavior: z + .enum(["always_invoice", "create_prorations", "none"]) + .optional(), + proration_date: z.coerce.number().optional(), + }) + .optional() + + const postSubscriptionsSubscriptionResumeResponseBodyValidator = + responseValidationFactory([["200", s_subscription]], s_error) + + // postSubscriptionsSubscriptionResume + router.post( + `/v1/subscriptions/:subscription/resume`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postSubscriptionsSubscriptionResumeParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postSubscriptionsSubscriptionResumeRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postSubscriptionsSubscriptionResume(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postSubscriptionsSubscriptionResumeResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxCalculationsRequestBodySchema = z.object({ + currency: z.string(), + customer: z.string().max(5000).optional(), + customer_details: z + .object({ + address: z + .object({ + city: z.union([z.string().max(5000), z.enum([""])]).optional(), + country: z.string().max(5000), + line1: z.union([z.string().max(5000), z.enum([""])]).optional(), + line2: z.union([z.string().max(5000), z.enum([""])]).optional(), + postal_code: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + state: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + address_source: z.enum(["billing", "shipping"]).optional(), + ip_address: z.string().optional(), + tax_ids: z + .array( + z.object({ + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string(), + }), + ) + .optional(), + taxability_override: z + .enum(["customer_exempt", "none", "reverse_charge"]) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + line_items: z.array( + z.object({ + amount: z.coerce.number(), + product: z.string().max(5000).optional(), + quantity: z.coerce.number().optional(), + reference: z.string().max(500).optional(), + tax_behavior: z.enum(["exclusive", "inclusive"]).optional(), + tax_code: z.string().optional(), + }), + ), + ship_from_details: z + .object({ + address: z.object({ + city: z.union([z.string().max(5000), z.enum([""])]).optional(), + country: z.string().max(5000), + line1: z.union([z.string().max(5000), z.enum([""])]).optional(), + line2: z.union([z.string().max(5000), z.enum([""])]).optional(), + postal_code: z.union([z.string().max(5000), z.enum([""])]).optional(), + state: z.union([z.string().max(5000), z.enum([""])]).optional(), + }), + }) + .optional(), + shipping_cost: z + .object({ + amount: z.coerce.number().optional(), + shipping_rate: z.string().max(5000).optional(), + tax_behavior: z.enum(["exclusive", "inclusive"]).optional(), + tax_code: z.string().optional(), + }) + .optional(), + tax_date: z.coerce.number().optional(), + }) + + const postTaxCalculationsResponseBodyValidator = responseValidationFactory( + [["200", s_tax_calculation]], + s_error, + ) + + // postTaxCalculations + router.post( + `/v1/tax/calculations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTaxCalculationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxCalculations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTaxCalculationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxCalculationsCalculationParamSchema = z.object({ + calculation: z.string().max(5000), + }) + + const getTaxCalculationsCalculationQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTaxCalculationsCalculationRequestBodySchema = z.object({}).optional() + + const getTaxCalculationsCalculationResponseBodyValidator = + responseValidationFactory([["200", s_tax_calculation]], s_error) + + // getTaxCalculationsCalculation + router.get( + `/v1/tax/calculations/:calculation`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTaxCalculationsCalculationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTaxCalculationsCalculationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxCalculationsCalculationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxCalculationsCalculation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTaxCalculationsCalculationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxCalculationsCalculationLineItemsParamSchema = z.object({ + calculation: z.string().max(5000), + }) + + const getTaxCalculationsCalculationLineItemsQuerySchema = z.object({ + ending_before: z.string().max(500).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(500).optional(), + }) + + const getTaxCalculationsCalculationLineItemsRequestBodySchema = z + .object({}) + .optional() + + const getTaxCalculationsCalculationLineItemsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_tax_calculation_line_item), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/tax/calculations/[^/]+/line_items")), + }), + ], + ], + s_error, + ) + + // getTaxCalculationsCalculationLineItems + router.get( + `/v1/tax/calculations/:calculation/line_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTaxCalculationsCalculationLineItemsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTaxCalculationsCalculationLineItemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxCalculationsCalculationLineItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_tax_calculation_line_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxCalculationsCalculationLineItems( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTaxCalculationsCalculationLineItemsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxRegistrationsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["active", "all", "expired", "scheduled"]).optional(), + }) + + const getTaxRegistrationsRequestBodySchema = z.object({}).optional() + + const getTaxRegistrationsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_tax_registration), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/tax/registrations")), + }), + ], + ], + s_error, + ) + + // getTaxRegistrations + router.get( + `/v1/tax/registrations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTaxRegistrationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxRegistrationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_tax_registration[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxRegistrations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxRegistrationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxRegistrationsRequestBodySchema = z.object({ + active_from: z.union([z.enum(["now"]), z.coerce.number()]), + country: z.string().max(5000), + country_options: z.object({ + ae: z.object({ type: z.enum(["standard"]) }).optional(), + al: z.object({ type: z.enum(["standard"]) }).optional(), + am: z.object({ type: z.enum(["simplified"]) }).optional(), + ao: z.object({ type: z.enum(["standard"]) }).optional(), + at: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + au: z.object({ type: z.enum(["standard"]) }).optional(), + ba: z.object({ type: z.enum(["standard"]) }).optional(), + bb: z.object({ type: z.enum(["standard"]) }).optional(), + be: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + bg: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + bh: z.object({ type: z.enum(["standard"]) }).optional(), + bs: z.object({ type: z.enum(["standard"]) }).optional(), + by: z.object({ type: z.enum(["simplified"]) }).optional(), + ca: z + .object({ + province_standard: z + .object({ province: z.string().max(5000) }) + .optional(), + type: z.enum(["province_standard", "simplified", "standard"]), + }) + .optional(), + cd: z.object({ type: z.enum(["standard"]) }).optional(), + ch: z.object({ type: z.enum(["standard"]) }).optional(), + cl: z.object({ type: z.enum(["simplified"]) }).optional(), + co: z.object({ type: z.enum(["simplified"]) }).optional(), + cr: z.object({ type: z.enum(["simplified"]) }).optional(), + cy: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + cz: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + de: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + dk: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + ec: z.object({ type: z.enum(["simplified"]) }).optional(), + ee: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + eg: z.object({ type: z.enum(["simplified"]) }).optional(), + es: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + fi: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + fr: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + gb: z.object({ type: z.enum(["standard"]) }).optional(), + ge: z.object({ type: z.enum(["simplified"]) }).optional(), + gn: z.object({ type: z.enum(["standard"]) }).optional(), + gr: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + hr: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + hu: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + id: z.object({ type: z.enum(["simplified"]) }).optional(), + ie: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + is: z.object({ type: z.enum(["standard"]) }).optional(), + it: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + jp: z.object({ type: z.enum(["standard"]) }).optional(), + ke: z.object({ type: z.enum(["simplified"]) }).optional(), + kh: z.object({ type: z.enum(["simplified"]) }).optional(), + kr: z.object({ type: z.enum(["simplified"]) }).optional(), + kz: z.object({ type: z.enum(["simplified"]) }).optional(), + lt: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + lu: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + lv: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + ma: z.object({ type: z.enum(["simplified"]) }).optional(), + md: z.object({ type: z.enum(["simplified"]) }).optional(), + me: z.object({ type: z.enum(["standard"]) }).optional(), + mk: z.object({ type: z.enum(["standard"]) }).optional(), + mr: z.object({ type: z.enum(["standard"]) }).optional(), + mt: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + mx: z.object({ type: z.enum(["simplified"]) }).optional(), + my: z.object({ type: z.enum(["simplified"]) }).optional(), + ng: z.object({ type: z.enum(["simplified"]) }).optional(), + nl: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + no: z.object({ type: z.enum(["standard"]) }).optional(), + np: z.object({ type: z.enum(["simplified"]) }).optional(), + nz: z.object({ type: z.enum(["standard"]) }).optional(), + om: z.object({ type: z.enum(["standard"]) }).optional(), + pe: z.object({ type: z.enum(["simplified"]) }).optional(), + pl: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + pt: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + ro: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + rs: z.object({ type: z.enum(["standard"]) }).optional(), + ru: z.object({ type: z.enum(["simplified"]) }).optional(), + sa: z.object({ type: z.enum(["simplified"]) }).optional(), + se: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + sg: z.object({ type: z.enum(["standard"]) }).optional(), + si: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + sk: z + .object({ + standard: z + .object({ + place_of_supply_scheme: z.enum(["small_seller", "standard"]), + }) + .optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + .optional(), + sn: z.object({ type: z.enum(["simplified"]) }).optional(), + sr: z.object({ type: z.enum(["standard"]) }).optional(), + th: z.object({ type: z.enum(["simplified"]) }).optional(), + tj: z.object({ type: z.enum(["simplified"]) }).optional(), + tr: z.object({ type: z.enum(["simplified"]) }).optional(), + tz: z.object({ type: z.enum(["simplified"]) }).optional(), + ug: z.object({ type: z.enum(["simplified"]) }).optional(), + us: z + .object({ + local_amusement_tax: z + .object({ jurisdiction: z.string().max(5000) }) + .optional(), + local_lease_tax: z + .object({ jurisdiction: z.string().max(5000) }) + .optional(), + state: z.string().max(5000), + state_sales_tax: z + .object({ + elections: z.array( + z.object({ + jurisdiction: z.string().max(5000).optional(), + type: z.enum([ + "local_use_tax", + "simplified_sellers_use_tax", + "single_local_use_tax", + ]), + }), + ), + }) + .optional(), + type: z.enum([ + "local_amusement_tax", + "local_lease_tax", + "state_communications_tax", + "state_retail_delivery_fee", + "state_sales_tax", + ]), + }) + .optional(), + uy: z.object({ type: z.enum(["standard"]) }).optional(), + uz: z.object({ type: z.enum(["simplified"]) }).optional(), + vn: z.object({ type: z.enum(["simplified"]) }).optional(), + za: z.object({ type: z.enum(["standard"]) }).optional(), + zm: z.object({ type: z.enum(["simplified"]) }).optional(), + zw: z.object({ type: z.enum(["standard"]) }).optional(), + }), + expand: z.array(z.string().max(5000)).optional(), + expires_at: z.coerce.number().optional(), + }) + + const postTaxRegistrationsResponseBodyValidator = responseValidationFactory( + [["200", s_tax_registration]], + s_error, + ) + + // postTaxRegistrations + router.post( + `/v1/tax/registrations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTaxRegistrationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxRegistrations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTaxRegistrationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxRegistrationsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getTaxRegistrationsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTaxRegistrationsIdRequestBodySchema = z.object({}).optional() + + const getTaxRegistrationsIdResponseBodyValidator = responseValidationFactory( + [["200", s_tax_registration]], + s_error, + ) + + // getTaxRegistrationsId + router.get( + `/v1/tax/registrations/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTaxRegistrationsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTaxRegistrationsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxRegistrationsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxRegistrationsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxRegistrationsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxRegistrationsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTaxRegistrationsIdRequestBodySchema = z + .object({ + active_from: z.union([z.enum(["now"]), z.coerce.number()]).optional(), + expand: z.array(z.string().max(5000)).optional(), + expires_at: z + .union([z.enum(["now"]), z.coerce.number(), z.enum([""])]) + .optional(), + }) + .optional() + + const postTaxRegistrationsIdResponseBodyValidator = responseValidationFactory( + [["200", s_tax_registration]], + s_error, + ) + + // postTaxRegistrationsId + router.post( + `/v1/tax/registrations/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTaxRegistrationsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTaxRegistrationsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxRegistrationsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTaxRegistrationsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxSettingsQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTaxSettingsRequestBodySchema = z.object({}).optional() + + const getTaxSettingsResponseBodyValidator = responseValidationFactory( + [["200", s_tax_settings]], + s_error, + ) + + // getTaxSettings + router.get( + `/v1/tax/settings`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTaxSettingsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxSettingsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxSettings(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxSettingsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxSettingsRequestBodySchema = z + .object({ + defaults: z + .object({ + tax_behavior: z + .enum(["exclusive", "inclusive", "inferred_by_currency"]) + .optional(), + tax_code: z.string().optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + head_office: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + }) + .optional(), + }) + .optional() + + const postTaxSettingsResponseBodyValidator = responseValidationFactory( + [["200", s_tax_settings]], + s_error, + ) + + // postTaxSettings + router.post( + `/v1/tax/settings`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTaxSettingsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxSettings(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTaxSettingsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxTransactionsCreateFromCalculationRequestBodySchema = z.object({ + calculation: z.string().max(5000), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + posted_at: z.coerce.number().optional(), + reference: z.string().max(500), + }) + + const postTaxTransactionsCreateFromCalculationResponseBodyValidator = + responseValidationFactory([["200", s_tax_transaction]], s_error) + + // postTaxTransactionsCreateFromCalculation + router.post( + `/v1/tax/transactions/create_from_calculation`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTaxTransactionsCreateFromCalculationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxTransactionsCreateFromCalculation( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTaxTransactionsCreateFromCalculationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxTransactionsCreateReversalRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + flat_amount: z.coerce.number().optional(), + line_items: z + .array( + z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + metadata: z.record(z.string()).optional(), + original_line_item: z.string().max(5000), + quantity: z.coerce.number().optional(), + reference: z.string().max(500), + }), + ) + .optional(), + metadata: z.record(z.string()).optional(), + mode: z.enum(["full", "partial"]), + original_transaction: z.string().max(5000), + reference: z.string().max(500), + shipping_cost: z + .object({ amount: z.coerce.number(), amount_tax: z.coerce.number() }) + .optional(), + }) + + const postTaxTransactionsCreateReversalResponseBodyValidator = + responseValidationFactory([["200", s_tax_transaction]], s_error) + + // postTaxTransactionsCreateReversal + router.post( + `/v1/tax/transactions/create_reversal`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTaxTransactionsCreateReversalRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxTransactionsCreateReversal(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTaxTransactionsCreateReversalResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxTransactionsTransactionParamSchema = z.object({ + transaction: z.string().max(5000), + }) + + const getTaxTransactionsTransactionQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTaxTransactionsTransactionRequestBodySchema = z.object({}).optional() + + const getTaxTransactionsTransactionResponseBodyValidator = + responseValidationFactory([["200", s_tax_transaction]], s_error) + + // getTaxTransactionsTransaction + router.get( + `/v1/tax/transactions/:transaction`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTaxTransactionsTransactionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTaxTransactionsTransactionQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxTransactionsTransactionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxTransactionsTransaction(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTaxTransactionsTransactionResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxTransactionsTransactionLineItemsParamSchema = z.object({ + transaction: z.string().max(5000), + }) + + const getTaxTransactionsTransactionLineItemsQuerySchema = z.object({ + ending_before: z.string().max(500).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(500).optional(), + }) + + const getTaxTransactionsTransactionLineItemsRequestBodySchema = z + .object({}) + .optional() + + const getTaxTransactionsTransactionLineItemsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_tax_transaction_line_item), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/tax/transactions/[^/]+/line_items")), + }), + ], + ], + s_error, + ) + + // getTaxTransactionsTransactionLineItems + router.get( + `/v1/tax/transactions/:transaction/line_items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTaxTransactionsTransactionLineItemsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTaxTransactionsTransactionLineItemsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxTransactionsTransactionLineItemsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_tax_transaction_line_item[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxTransactionsTransactionLineItems( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTaxTransactionsTransactionLineItemsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxCodesQuerySchema = z.object({ + ending_before: z.string().optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().optional(), + }) + + const getTaxCodesRequestBodySchema = z.object({}).optional() + + const getTaxCodesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_tax_code), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTaxCodes + router.get( + `/v1/tax_codes`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTaxCodesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxCodesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_tax_code[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxCodes(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxCodesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxCodesIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getTaxCodesIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTaxCodesIdRequestBodySchema = z.object({}).optional() + + const getTaxCodesIdResponseBodyValidator = responseValidationFactory( + [["200", s_tax_code]], + s_error, + ) + + // getTaxCodesId + router.get( + `/v1/tax_codes/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTaxCodesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTaxCodesIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxCodesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxCodesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxCodesIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxIdsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + owner: z + .object({ + account: z.string().optional(), + customer: z.string().max(5000).optional(), + type: z.enum(["account", "application", "customer", "self"]), + }) + .optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getTaxIdsRequestBodySchema = z.object({}).optional() + + const getTaxIdsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_tax_id)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTaxIds + router.get( + `/v1/tax_ids`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTaxIdsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxIdsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_tax_id[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxIds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxIdsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxIdsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + owner: z + .object({ + account: z.string().optional(), + customer: z.string().max(5000).optional(), + type: z.enum(["account", "application", "customer", "self"]), + }) + .optional(), + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string(), + }) + + const postTaxIdsResponseBodyValidator = responseValidationFactory( + [["200", s_tax_id]], + s_error, + ) + + // postTaxIds + router.post( + `/v1/tax_ids`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTaxIdsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxIds(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTaxIdsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteTaxIdsIdParamSchema = z.object({ id: z.string().max(5000) }) + + const deleteTaxIdsIdRequestBodySchema = z.object({}).optional() + + const deleteTaxIdsIdResponseBodyValidator = responseValidationFactory( + [["200", s_deleted_tax_id]], + s_error, + ) + + // deleteTaxIdsId + router.delete( + `/v1/tax_ids/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteTaxIdsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteTaxIdsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteTaxIdsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteTaxIdsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxIdsIdParamSchema = z.object({ id: z.string().max(5000) }) + + const getTaxIdsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTaxIdsIdRequestBodySchema = z.object({}).optional() + + const getTaxIdsIdResponseBodyValidator = responseValidationFactory( + [["200", s_tax_id]], + s_error, + ) + + // getTaxIdsId + router.get( + `/v1/tax_ids/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTaxIdsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTaxIdsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxIdsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxIdsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxIdsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxRatesQuerySchema = z.object({ + active: PermissiveBoolean.optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + inclusive: PermissiveBoolean.optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getTaxRatesRequestBodySchema = z.object({}).optional() + + const getTaxRatesResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_tax_rate), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/tax_rates")), + }), + ], + ], + s_error, + ) + + // getTaxRates + router.get( + `/v1/tax_rates`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTaxRatesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxRatesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_tax_rate[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxRates(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxRatesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxRatesRequestBodySchema = z.object({ + active: PermissiveBoolean.optional(), + country: z.string().max(5000).optional(), + description: z.string().max(5000).optional(), + display_name: z.string().max(50), + expand: z.array(z.string().max(5000)).optional(), + inclusive: PermissiveBoolean, + jurisdiction: z.string().max(50).optional(), + metadata: z.record(z.string()).optional(), + percentage: z.coerce.number(), + state: z.string().max(5000).optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "retail_delivery_fee", + "rst", + "sales_tax", + "service_tax", + "vat", + ]) + .optional(), + }) + + const postTaxRatesResponseBodyValidator = responseValidationFactory( + [["200", s_tax_rate]], + s_error, + ) + + // postTaxRates + router.post( + `/v1/tax_rates`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTaxRatesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxRates(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTaxRatesResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTaxRatesTaxRateParamSchema = z.object({ + tax_rate: z.string().max(5000), + }) + + const getTaxRatesTaxRateQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTaxRatesTaxRateRequestBodySchema = z.object({}).optional() + + const getTaxRatesTaxRateResponseBodyValidator = responseValidationFactory( + [["200", s_tax_rate]], + s_error, + ) + + // getTaxRatesTaxRate + router.get( + `/v1/tax_rates/:tax_rate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTaxRatesTaxRateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTaxRatesTaxRateQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTaxRatesTaxRateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTaxRatesTaxRate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTaxRatesTaxRateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTaxRatesTaxRateParamSchema = z.object({ + tax_rate: z.string().max(5000), + }) + + const postTaxRatesTaxRateRequestBodySchema = z + .object({ + active: PermissiveBoolean.optional(), + country: z.string().max(5000).optional(), + description: z.string().max(5000).optional(), + display_name: z.string().max(50).optional(), + expand: z.array(z.string().max(5000)).optional(), + jurisdiction: z.string().max(50).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + state: z.string().max(5000).optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "retail_delivery_fee", + "rst", + "sales_tax", + "service_tax", + "vat", + ]) + .optional(), + }) + .optional() + + const postTaxRatesTaxRateResponseBodyValidator = responseValidationFactory( + [["200", s_tax_rate]], + s_error, + ) + + // postTaxRatesTaxRate + router.post( + `/v1/tax_rates/:tax_rate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTaxRatesTaxRateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTaxRatesTaxRateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTaxRatesTaxRate(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTaxRatesTaxRateResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTerminalConfigurationsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + is_account_default: PermissiveBoolean.optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getTerminalConfigurationsRequestBodySchema = z.object({}).optional() + + const getTerminalConfigurationsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_terminal_configuration)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/terminal/configurations")), + }), + ], + ], + s_error, + ) + + // getTerminalConfigurations + router.get( + `/v1/terminal/configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTerminalConfigurationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTerminalConfigurationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_terminal_configuration[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTerminalConfigurations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTerminalConfigurationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalConfigurationsRequestBodySchema = z + .object({ + bbpos_wisepos_e: z + .object({ + splashscreen: z.union([z.string(), z.enum([""])]).optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + name: z.string().max(100).optional(), + offline: z + .union([z.object({ enabled: PermissiveBoolean }), z.enum([""])]) + .optional(), + reboot_window: z + .object({ end_hour: z.coerce.number(), start_hour: z.coerce.number() }) + .optional(), + stripe_s700: z + .object({ + splashscreen: z.union([z.string(), z.enum([""])]).optional(), + }) + .optional(), + tipping: z + .union([ + z.object({ + aud: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + cad: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + chf: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + czk: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + dkk: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + eur: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + gbp: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + hkd: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + jpy: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + myr: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + nok: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + nzd: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + pln: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + sek: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + sgd: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + usd: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + verifone_p400: z + .object({ + splashscreen: z.union([z.string(), z.enum([""])]).optional(), + }) + .optional(), + wifi: z + .union([ + z.object({ + enterprise_eap_peap: z + .object({ + ca_certificate_file: z.string().optional(), + password: z.string().max(5000), + ssid: z.string().max(5000), + username: z.string().max(5000), + }) + .optional(), + enterprise_eap_tls: z + .object({ + ca_certificate_file: z.string().optional(), + client_certificate_file: z.string(), + private_key_file: z.string(), + private_key_file_password: z.string().max(5000).optional(), + ssid: z.string().max(5000), + }) + .optional(), + personal_psk: z + .object({ + password: z.string().max(63), + ssid: z.string().max(5000), + }) + .optional(), + type: z.enum([ + "enterprise_eap_peap", + "enterprise_eap_tls", + "personal_psk", + ]), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional() + + const postTerminalConfigurationsResponseBodyValidator = + responseValidationFactory([["200", s_terminal_configuration]], s_error) + + // postTerminalConfigurations + router.post( + `/v1/terminal/configurations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTerminalConfigurationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalConfigurations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalConfigurationsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteTerminalConfigurationsConfigurationParamSchema = z.object({ + configuration: z.string().max(5000), + }) + + const deleteTerminalConfigurationsConfigurationRequestBodySchema = z + .object({}) + .optional() + + const deleteTerminalConfigurationsConfigurationResponseBodyValidator = + responseValidationFactory( + [["200", s_deleted_terminal_configuration]], + s_error, + ) + + // deleteTerminalConfigurationsConfiguration + router.delete( + `/v1/terminal/configurations/:configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteTerminalConfigurationsConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteTerminalConfigurationsConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteTerminalConfigurationsConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteTerminalConfigurationsConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTerminalConfigurationsConfigurationParamSchema = z.object({ + configuration: z.string().max(5000), + }) + + const getTerminalConfigurationsConfigurationQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTerminalConfigurationsConfigurationRequestBodySchema = z + .object({}) + .optional() + + const getTerminalConfigurationsConfigurationResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([ + z.lazy(() => s_terminal_configuration), + s_deleted_terminal_configuration, + ]), + ], + ], + s_error, + ) + + // getTerminalConfigurationsConfiguration + router.get( + `/v1/terminal/configurations/:configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTerminalConfigurationsConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTerminalConfigurationsConfigurationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTerminalConfigurationsConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_terminal_configuration | t_deleted_terminal_configuration + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTerminalConfigurationsConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTerminalConfigurationsConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalConfigurationsConfigurationParamSchema = z.object({ + configuration: z.string().max(5000), + }) + + const postTerminalConfigurationsConfigurationRequestBodySchema = z + .object({ + bbpos_wisepos_e: z + .union([ + z.object({ + splashscreen: z.union([z.string(), z.enum([""])]).optional(), + }), + z.enum([""]), + ]) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + name: z.string().max(100).optional(), + offline: z + .union([z.object({ enabled: PermissiveBoolean }), z.enum([""])]) + .optional(), + reboot_window: z + .union([ + z.object({ + end_hour: z.coerce.number(), + start_hour: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + stripe_s700: z + .union([ + z.object({ + splashscreen: z.union([z.string(), z.enum([""])]).optional(), + }), + z.enum([""]), + ]) + .optional(), + tipping: z + .union([ + z.object({ + aud: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + cad: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + chf: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + czk: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + dkk: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + eur: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + gbp: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + hkd: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + jpy: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + myr: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + nok: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + nzd: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + pln: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + sek: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + sgd: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + usd: z + .object({ + fixed_amounts: z.array(z.coerce.number()).optional(), + percentages: z.array(z.coerce.number()).optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + .optional(), + }), + z.enum([""]), + ]) + .optional(), + verifone_p400: z + .union([ + z.object({ + splashscreen: z.union([z.string(), z.enum([""])]).optional(), + }), + z.enum([""]), + ]) + .optional(), + wifi: z + .union([ + z.object({ + enterprise_eap_peap: z + .object({ + ca_certificate_file: z.string().optional(), + password: z.string().max(5000), + ssid: z.string().max(5000), + username: z.string().max(5000), + }) + .optional(), + enterprise_eap_tls: z + .object({ + ca_certificate_file: z.string().optional(), + client_certificate_file: z.string(), + private_key_file: z.string(), + private_key_file_password: z.string().max(5000).optional(), + ssid: z.string().max(5000), + }) + .optional(), + personal_psk: z + .object({ + password: z.string().max(63), + ssid: z.string().max(5000), + }) + .optional(), + type: z.enum([ + "enterprise_eap_peap", + "enterprise_eap_tls", + "personal_psk", + ]), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional() + + const postTerminalConfigurationsConfigurationResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([ + z.lazy(() => s_terminal_configuration), + s_deleted_terminal_configuration, + ]), + ], + ], + s_error, + ) + + // postTerminalConfigurationsConfiguration + router.post( + `/v1/terminal/configurations/:configuration`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTerminalConfigurationsConfigurationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTerminalConfigurationsConfigurationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_terminal_configuration | t_deleted_terminal_configuration + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalConfigurationsConfiguration( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalConfigurationsConfigurationResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalConnectionTokensRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + location: z.string().max(5000).optional(), + }) + .optional() + + const postTerminalConnectionTokensResponseBodyValidator = + responseValidationFactory([["200", s_terminal_connection_token]], s_error) + + // postTerminalConnectionTokens + router.post( + `/v1/terminal/connection_tokens`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTerminalConnectionTokensRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalConnectionTokens(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalConnectionTokensResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTerminalLocationsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getTerminalLocationsRequestBodySchema = z.object({}).optional() + + const getTerminalLocationsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_terminal_location), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/terminal/locations")), + }), + ], + ], + s_error, + ) + + // getTerminalLocations + router.get( + `/v1/terminal/locations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTerminalLocationsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTerminalLocationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_terminal_location[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTerminalLocations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTerminalLocationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalLocationsRequestBodySchema = z.object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + configuration_overrides: z.string().max(500).optional(), + display_name: z.string().max(1000), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + + const postTerminalLocationsResponseBodyValidator = responseValidationFactory( + [["200", s_terminal_location]], + s_error, + ) + + // postTerminalLocations + router.post( + `/v1/terminal/locations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTerminalLocationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalLocations(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTerminalLocationsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteTerminalLocationsLocationParamSchema = z.object({ + location: z.string().max(5000), + }) + + const deleteTerminalLocationsLocationRequestBodySchema = z + .object({}) + .optional() + + const deleteTerminalLocationsLocationResponseBodyValidator = + responseValidationFactory([["200", s_deleted_terminal_location]], s_error) + + // deleteTerminalLocationsLocation + router.delete( + `/v1/terminal/locations/:location`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteTerminalLocationsLocationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteTerminalLocationsLocationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteTerminalLocationsLocation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteTerminalLocationsLocationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTerminalLocationsLocationParamSchema = z.object({ + location: z.string().max(5000), + }) + + const getTerminalLocationsLocationQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTerminalLocationsLocationRequestBodySchema = z.object({}).optional() + + const getTerminalLocationsLocationResponseBodyValidator = + responseValidationFactory( + [["200", z.union([s_terminal_location, s_deleted_terminal_location])]], + s_error, + ) + + // getTerminalLocationsLocation + router.get( + `/v1/terminal/locations/:location`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTerminalLocationsLocationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTerminalLocationsLocationQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTerminalLocationsLocationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_terminal_location | t_deleted_terminal_location + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTerminalLocationsLocation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTerminalLocationsLocationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalLocationsLocationParamSchema = z.object({ + location: z.string().max(5000), + }) + + const postTerminalLocationsLocationRequestBodySchema = z + .object({ + address: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + configuration_overrides: z + .union([z.string().max(1000), z.enum([""])]) + .optional(), + display_name: z.string().max(1000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postTerminalLocationsLocationResponseBodyValidator = + responseValidationFactory( + [["200", z.union([s_terminal_location, s_deleted_terminal_location])]], + s_error, + ) + + // postTerminalLocationsLocation + router.post( + `/v1/terminal/locations/:location`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTerminalLocationsLocationParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTerminalLocationsLocationRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_terminal_location | t_deleted_terminal_location + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalLocationsLocation(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalLocationsLocationResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTerminalReadersQuerySchema = z.object({ + device_type: z + .enum([ + "bbpos_chipper2x", + "bbpos_wisepad3", + "bbpos_wisepos_e", + "mobile_phone_reader", + "simulated_wisepos_e", + "stripe_m2", + "stripe_s700", + "verifone_P400", + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + location: z.string().max(5000).optional(), + serial_number: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["offline", "online"]).optional(), + }) + + const getTerminalReadersRequestBodySchema = z.object({}).optional() + + const getTerminalReadersResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_terminal_reader)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTerminalReaders + router.get( + `/v1/terminal/readers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTerminalReadersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTerminalReadersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_terminal_reader[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTerminalReaders(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTerminalReadersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalReadersRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + label: z.string().max(5000).optional(), + location: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + registration_code: z.string().max(5000), + }) + + const postTerminalReadersResponseBodyValidator = responseValidationFactory( + [["200", s_terminal_reader]], + s_error, + ) + + // postTerminalReaders + router.post( + `/v1/terminal/readers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTerminalReadersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalReaders(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTerminalReadersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteTerminalReadersReaderParamSchema = z.object({ + reader: z.string().max(5000), + }) + + const deleteTerminalReadersReaderRequestBodySchema = z.object({}).optional() + + const deleteTerminalReadersReaderResponseBodyValidator = + responseValidationFactory([["200", s_deleted_terminal_reader]], s_error) + + // deleteTerminalReadersReader + router.delete( + `/v1/terminal/readers/:reader`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteTerminalReadersReaderParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteTerminalReadersReaderRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteTerminalReadersReader(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteTerminalReadersReaderResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTerminalReadersReaderParamSchema = z.object({ + reader: z.string().max(5000), + }) + + const getTerminalReadersReaderQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTerminalReadersReaderRequestBodySchema = z.object({}).optional() + + const getTerminalReadersReaderResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([z.lazy(() => s_terminal_reader), s_deleted_terminal_reader]), + ], + ], + s_error, + ) + + // getTerminalReadersReader + router.get( + `/v1/terminal/readers/:reader`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTerminalReadersReaderParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTerminalReadersReaderQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTerminalReadersReaderRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_terminal_reader | t_deleted_terminal_reader + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTerminalReadersReader(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTerminalReadersReaderResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalReadersReaderParamSchema = z.object({ + reader: z.string().max(5000), + }) + + const postTerminalReadersReaderRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + label: z.union([z.string().max(5000), z.enum([""])]).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postTerminalReadersReaderResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.union([z.lazy(() => s_terminal_reader), s_deleted_terminal_reader]), + ], + ], + s_error, + ) + + // postTerminalReadersReader + router.post( + `/v1/terminal/readers/:reader`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTerminalReadersReaderParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTerminalReadersReaderRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse< + t_terminal_reader | t_deleted_terminal_reader + >(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalReadersReader(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTerminalReadersReaderResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalReadersReaderCancelActionParamSchema = z.object({ + reader: z.string().max(5000), + }) + + const postTerminalReadersReaderCancelActionRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTerminalReadersReaderCancelActionResponseBodyValidator = + responseValidationFactory([["200", s_terminal_reader]], s_error) + + // postTerminalReadersReaderCancelAction + router.post( + `/v1/terminal/readers/:reader/cancel_action`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTerminalReadersReaderCancelActionParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTerminalReadersReaderCancelActionRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalReadersReaderCancelAction( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalReadersReaderCancelActionResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalReadersReaderProcessPaymentIntentParamSchema = z.object({ + reader: z.string().max(5000), + }) + + const postTerminalReadersReaderProcessPaymentIntentRequestBodySchema = + z.object({ + expand: z.array(z.string().max(5000)).optional(), + payment_intent: z.string().max(5000), + process_config: z + .object({ + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + enable_customer_cancellation: PermissiveBoolean.optional(), + skip_tipping: PermissiveBoolean.optional(), + tipping: z + .object({ amount_eligible: z.coerce.number().optional() }) + .optional(), + }) + .optional(), + }) + + const postTerminalReadersReaderProcessPaymentIntentResponseBodyValidator = + responseValidationFactory([["200", s_terminal_reader]], s_error) + + // postTerminalReadersReaderProcessPaymentIntent + router.post( + `/v1/terminal/readers/:reader/process_payment_intent`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTerminalReadersReaderProcessPaymentIntentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTerminalReadersReaderProcessPaymentIntentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalReadersReaderProcessPaymentIntent( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalReadersReaderProcessPaymentIntentResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalReadersReaderProcessSetupIntentParamSchema = z.object({ + reader: z.string().max(5000), + }) + + const postTerminalReadersReaderProcessSetupIntentRequestBodySchema = z.object( + { + allow_redisplay: z.enum(["always", "limited", "unspecified"]), + expand: z.array(z.string().max(5000)).optional(), + process_config: z + .object({ enable_customer_cancellation: PermissiveBoolean.optional() }) + .optional(), + setup_intent: z.string().max(5000), + }, + ) + + const postTerminalReadersReaderProcessSetupIntentResponseBodyValidator = + responseValidationFactory([["200", s_terminal_reader]], s_error) + + // postTerminalReadersReaderProcessSetupIntent + router.post( + `/v1/terminal/readers/:reader/process_setup_intent`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTerminalReadersReaderProcessSetupIntentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTerminalReadersReaderProcessSetupIntentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalReadersReaderProcessSetupIntent( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalReadersReaderProcessSetupIntentResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalReadersReaderRefundPaymentParamSchema = z.object({ + reader: z.string().max(5000), + }) + + const postTerminalReadersReaderRefundPaymentRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + charge: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + payment_intent: z.string().max(5000).optional(), + refund_application_fee: PermissiveBoolean.optional(), + refund_payment_config: z + .object({ enable_customer_cancellation: PermissiveBoolean.optional() }) + .optional(), + reverse_transfer: PermissiveBoolean.optional(), + }) + .optional() + + const postTerminalReadersReaderRefundPaymentResponseBodyValidator = + responseValidationFactory([["200", s_terminal_reader]], s_error) + + // postTerminalReadersReaderRefundPayment + router.post( + `/v1/terminal/readers/:reader/refund_payment`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTerminalReadersReaderRefundPaymentParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTerminalReadersReaderRefundPaymentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalReadersReaderRefundPayment( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalReadersReaderRefundPaymentResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTerminalReadersReaderSetReaderDisplayParamSchema = z.object({ + reader: z.string().max(5000), + }) + + const postTerminalReadersReaderSetReaderDisplayRequestBodySchema = z.object({ + cart: z + .object({ + currency: z.string(), + line_items: z.array( + z.object({ + amount: z.coerce.number(), + description: z.string().max(5000), + quantity: z.coerce.number(), + }), + ), + tax: z.coerce.number().optional(), + total: z.coerce.number(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + type: z.enum(["cart"]), + }) + + const postTerminalReadersReaderSetReaderDisplayResponseBodyValidator = + responseValidationFactory([["200", s_terminal_reader]], s_error) + + // postTerminalReadersReaderSetReaderDisplay + router.post( + `/v1/terminal/readers/:reader/set_reader_display`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTerminalReadersReaderSetReaderDisplayParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTerminalReadersReaderSetReaderDisplayRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTerminalReadersReaderSetReaderDisplay( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTerminalReadersReaderSetReaderDisplayResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersConfirmationTokensRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + payment_method: z.string().max(5000).optional(), + payment_method_data: z + .object({ + acss_debit: z + .object({ + account_number: z.string().max(5000), + institution_number: z.string().max(5000), + transit_number: z.string().max(5000), + }) + .optional(), + affirm: z.object({}).optional(), + afterpay_clearpay: z.object({}).optional(), + alipay: z.object({}).optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .optional(), + alma: z.object({}).optional(), + amazon_pay: z.object({}).optional(), + au_becs_debit: z + .object({ + account_number: z.string().max(5000), + bsb_number: z.string().max(5000), + }) + .optional(), + bacs_debit: z + .object({ + account_number: z.string().max(5000).optional(), + sort_code: z.string().max(5000).optional(), + }) + .optional(), + bancontact: z.object({}).optional(), + billie: z.object({}).optional(), + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + blik: z.object({}).optional(), + boleto: z.object({ tax_id: z.string().max(5000) }).optional(), + cashapp: z.object({}).optional(), + customer_balance: z.object({}).optional(), + eps: z + .object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .optional(), + }) + .optional(), + fpx: z + .object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + }) + .optional(), + giropay: z.object({}).optional(), + grabpay: z.object({}).optional(), + ideal: z + .object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .optional(), + }) + .optional(), + interac_present: z.object({}).optional(), + kakao_pay: z.object({}).optional(), + klarna: z + .object({ + dob: z + .object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }) + .optional(), + }) + .optional(), + konbini: z.object({}).optional(), + kr_card: z.object({}).optional(), + link: z.object({}).optional(), + metadata: z.record(z.string()).optional(), + mobilepay: z.object({}).optional(), + multibanco: z.object({}).optional(), + naver_pay: z + .object({ funding: z.enum(["card", "points"]).optional() }) + .optional(), + nz_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000), + bank_code: z.string().max(5000), + branch_code: z.string().max(5000), + reference: z.string().max(128).optional(), + suffix: z.string().max(5000), + }) + .optional(), + oxxo: z.object({}).optional(), + p24: z + .object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .optional(), + }) + .optional(), + pay_by_bank: z.object({}).optional(), + payco: z.object({}).optional(), + paynow: z.object({}).optional(), + paypal: z.object({}).optional(), + pix: z.object({}).optional(), + promptpay: z.object({}).optional(), + radar_options: z + .object({ session: z.string().max(5000).optional() }) + .optional(), + revolut_pay: z.object({}).optional(), + samsung_pay: z.object({}).optional(), + satispay: z.object({}).optional(), + sepa_debit: z.object({ iban: z.string().max(5000) }).optional(), + sofort: z + .object({ country: z.enum(["AT", "BE", "DE", "ES", "IT", "NL"]) }) + .optional(), + swish: z.object({}).optional(), + twint: z.object({}).optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + wechat_pay: z.object({}).optional(), + zip: z.object({}).optional(), + }) + .optional(), + return_url: z.string().optional(), + setup_future_usage: z.enum(["off_session", "on_session"]).optional(), + shipping: z + .object({ + address: z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + name: z.string().max(5000), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + }) + .optional() + + const postTestHelpersConfirmationTokensResponseBodyValidator = + responseValidationFactory([["200", s_confirmation_token]], s_error) + + // postTestHelpersConfirmationTokens + router.post( + `/v1/test_helpers/confirmation_tokens`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTestHelpersConfirmationTokensRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersConfirmationTokens(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersConfirmationTokensResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersCustomersCustomerFundCashBalanceParamSchema = z.object({ + customer: z.string().max(5000), + }) + + const postTestHelpersCustomersCustomerFundCashBalanceRequestBodySchema = + z.object({ + amount: z.coerce.number(), + currency: z.string(), + expand: z.array(z.string().max(5000)).optional(), + reference: z.string().max(5000).optional(), + }) + + const postTestHelpersCustomersCustomerFundCashBalanceResponseBodyValidator = + responseValidationFactory( + [["200", s_customer_cash_balance_transaction]], + s_error, + ) + + // postTestHelpersCustomersCustomerFundCashBalance + router.post( + `/v1/test_helpers/customers/:customer/fund_cash_balance`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersCustomersCustomerFundCashBalanceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersCustomersCustomerFundCashBalanceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersCustomersCustomerFundCashBalance( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersCustomersCustomerFundCashBalanceResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingAuthorizationsRequestBodySchema = z.object({ + amount: z.coerce.number().optional(), + amount_details: z + .object({ + atm_fee: z.coerce.number().optional(), + cashback_amount: z.coerce.number().optional(), + }) + .optional(), + authorization_method: z + .enum(["chip", "contactless", "keyed_in", "online", "swipe"]) + .optional(), + card: z.string().max(5000), + currency: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + fleet: z + .object({ + cardholder_prompt_data: z + .object({ + driver_id: z.string().max(5000).optional(), + odometer: z.coerce.number().optional(), + unspecified_id: z.string().max(5000).optional(), + user_id: z.string().max(5000).optional(), + vehicle_number: z.string().max(5000).optional(), + }) + .optional(), + purchase_type: z + .enum([ + "fuel_and_non_fuel_purchase", + "fuel_purchase", + "non_fuel_purchase", + ]) + .optional(), + reported_breakdown: z + .object({ + fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + non_fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + tax: z + .object({ + local_amount_decimal: z.string().optional(), + national_amount_decimal: z.string().optional(), + }) + .optional(), + }) + .optional(), + service_type: z + .enum(["full_service", "non_fuel_transaction", "self_service"]) + .optional(), + }) + .optional(), + fuel: z + .object({ + industry_product_code: z.string().max(5000).optional(), + quantity_decimal: z.string().optional(), + type: z + .enum([ + "diesel", + "other", + "unleaded_plus", + "unleaded_regular", + "unleaded_super", + ]) + .optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .optional(), + unit_cost_decimal: z.string().optional(), + }) + .optional(), + is_amount_controllable: PermissiveBoolean.optional(), + merchant_amount: z.coerce.number().optional(), + merchant_currency: z.string().optional(), + merchant_data: z + .object({ + category: z + .enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]) + .optional(), + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + name: z.string().max(5000).optional(), + network_id: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + terminal_id: z.string().max(5000).optional(), + url: z.string().max(5000).optional(), + }) + .optional(), + network_data: z + .object({ acquiring_institution_id: z.string().max(5000).optional() }) + .optional(), + verification_data: z + .object({ + address_line1_check: z + .enum(["match", "mismatch", "not_provided"]) + .optional(), + address_postal_code_check: z + .enum(["match", "mismatch", "not_provided"]) + .optional(), + authentication_exemption: z + .object({ + claimed_by: z.enum(["acquirer", "issuer"]), + type: z.enum([ + "low_value_transaction", + "transaction_risk_analysis", + "unknown", + ]), + }) + .optional(), + cvc_check: z.enum(["match", "mismatch", "not_provided"]).optional(), + expiry_check: z.enum(["match", "mismatch", "not_provided"]).optional(), + three_d_secure: z + .object({ + result: z.enum([ + "attempt_acknowledged", + "authenticated", + "failed", + "required", + ]), + }) + .optional(), + }) + .optional(), + wallet: z.enum(["apple_pay", "google_pay", "samsung_pay"]).optional(), + }) + + const postTestHelpersIssuingAuthorizationsResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postTestHelpersIssuingAuthorizations + router.post( + `/v1/test_helpers/issuing/authorizations`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingAuthorizationsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingAuthorizations( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingAuthorizationsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingAuthorizationsAuthorizationCaptureParamSchema = + z.object({ authorization: z.string().max(5000) }) + + const postTestHelpersIssuingAuthorizationsAuthorizationCaptureRequestBodySchema = + z + .object({ + capture_amount: z.coerce.number().optional(), + close_authorization: PermissiveBoolean.optional(), + expand: z.array(z.string().max(5000)).optional(), + purchase_details: z + .object({ + fleet: z + .object({ + cardholder_prompt_data: z + .object({ + driver_id: z.string().max(5000).optional(), + odometer: z.coerce.number().optional(), + unspecified_id: z.string().max(5000).optional(), + user_id: z.string().max(5000).optional(), + vehicle_number: z.string().max(5000).optional(), + }) + .optional(), + purchase_type: z + .enum([ + "fuel_and_non_fuel_purchase", + "fuel_purchase", + "non_fuel_purchase", + ]) + .optional(), + reported_breakdown: z + .object({ + fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + non_fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + tax: z + .object({ + local_amount_decimal: z.string().optional(), + national_amount_decimal: z.string().optional(), + }) + .optional(), + }) + .optional(), + service_type: z + .enum([ + "full_service", + "non_fuel_transaction", + "self_service", + ]) + .optional(), + }) + .optional(), + flight: z + .object({ + departure_at: z.coerce.number().optional(), + passenger_name: z.string().max(5000).optional(), + refundable: PermissiveBoolean.optional(), + segments: z + .array( + z.object({ + arrival_airport_code: z.string().max(3).optional(), + carrier: z.string().max(5000).optional(), + departure_airport_code: z.string().max(3).optional(), + flight_number: z.string().max(5000).optional(), + service_class: z.string().max(5000).optional(), + stopover_allowed: PermissiveBoolean.optional(), + }), + ) + .optional(), + travel_agency: z.string().max(5000).optional(), + }) + .optional(), + fuel: z + .object({ + industry_product_code: z.string().max(5000).optional(), + quantity_decimal: z.string().optional(), + type: z + .enum([ + "diesel", + "other", + "unleaded_plus", + "unleaded_regular", + "unleaded_super", + ]) + .optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .optional(), + unit_cost_decimal: z.string().optional(), + }) + .optional(), + lodging: z + .object({ + check_in_at: z.coerce.number().optional(), + nights: z.coerce.number().optional(), + }) + .optional(), + receipt: z + .array( + z.object({ + description: z.string().max(26).optional(), + quantity: z.string().optional(), + total: z.coerce.number().optional(), + unit_cost: z.coerce.number().optional(), + }), + ) + .optional(), + reference: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional() + + const postTestHelpersIssuingAuthorizationsAuthorizationCaptureResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postTestHelpersIssuingAuthorizationsAuthorizationCapture + router.post( + `/v1/test_helpers/issuing/authorizations/:authorization/capture`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationCaptureParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationCaptureRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingAuthorizationsAuthorizationCapture( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingAuthorizationsAuthorizationCaptureResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingAuthorizationsAuthorizationExpireParamSchema = + z.object({ authorization: z.string().max(5000) }) + + const postTestHelpersIssuingAuthorizationsAuthorizationExpireRequestBodySchema = + z.object({ expand: z.array(z.string().max(5000)).optional() }).optional() + + const postTestHelpersIssuingAuthorizationsAuthorizationExpireResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postTestHelpersIssuingAuthorizationsAuthorizationExpire + router.post( + `/v1/test_helpers/issuing/authorizations/:authorization/expire`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationExpireParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationExpireRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingAuthorizationsAuthorizationExpire( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingAuthorizationsAuthorizationExpireResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema = + z.object({ authorization: z.string().max(5000) }) + + const postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountRequestBodySchema = + z.object({ + expand: z.array(z.string().max(5000)).optional(), + final_amount: z.coerce.number(), + fleet: z + .object({ + cardholder_prompt_data: z + .object({ + driver_id: z.string().max(5000).optional(), + odometer: z.coerce.number().optional(), + unspecified_id: z.string().max(5000).optional(), + user_id: z.string().max(5000).optional(), + vehicle_number: z.string().max(5000).optional(), + }) + .optional(), + purchase_type: z + .enum([ + "fuel_and_non_fuel_purchase", + "fuel_purchase", + "non_fuel_purchase", + ]) + .optional(), + reported_breakdown: z + .object({ + fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + non_fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + tax: z + .object({ + local_amount_decimal: z.string().optional(), + national_amount_decimal: z.string().optional(), + }) + .optional(), + }) + .optional(), + service_type: z + .enum(["full_service", "non_fuel_transaction", "self_service"]) + .optional(), + }) + .optional(), + fuel: z + .object({ + industry_product_code: z.string().max(5000).optional(), + quantity_decimal: z.string().optional(), + type: z + .enum([ + "diesel", + "other", + "unleaded_plus", + "unleaded_regular", + "unleaded_super", + ]) + .optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .optional(), + unit_cost_decimal: z.string().optional(), + }) + .optional(), + }) + + const postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmount + router.post( + `/v1/test_helpers/issuing/authorizations/:authorization/finalize_amount`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmount( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondParamSchema = + z.object({ authorization: z.string().max(5000) }) + + const postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondRequestBodySchema = + z.object({ + confirmed: PermissiveBoolean, + expand: z.array(z.string().max(5000)).optional(), + }) + + const postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespond + router.post( + `/v1/test_helpers/issuing/authorizations/:authorization/fraud_challenges/respond`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespond( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingAuthorizationsAuthorizationIncrementParamSchema = + z.object({ authorization: z.string().max(5000) }) + + const postTestHelpersIssuingAuthorizationsAuthorizationIncrementRequestBodySchema = + z.object({ + expand: z.array(z.string().max(5000)).optional(), + increment_amount: z.coerce.number(), + is_amount_controllable: PermissiveBoolean.optional(), + }) + + const postTestHelpersIssuingAuthorizationsAuthorizationIncrementResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postTestHelpersIssuingAuthorizationsAuthorizationIncrement + router.post( + `/v1/test_helpers/issuing/authorizations/:authorization/increment`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationIncrementParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationIncrementRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingAuthorizationsAuthorizationIncrement( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingAuthorizationsAuthorizationIncrementResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingAuthorizationsAuthorizationReverseParamSchema = + z.object({ authorization: z.string().max(5000) }) + + const postTestHelpersIssuingAuthorizationsAuthorizationReverseRequestBodySchema = + z + .object({ + expand: z.array(z.string().max(5000)).optional(), + reverse_amount: z.coerce.number().optional(), + }) + .optional() + + const postTestHelpersIssuingAuthorizationsAuthorizationReverseResponseBodyValidator = + responseValidationFactory([["200", s_issuing_authorization]], s_error) + + // postTestHelpersIssuingAuthorizationsAuthorizationReverse + router.post( + `/v1/test_helpers/issuing/authorizations/:authorization/reverse`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationReverseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingAuthorizationsAuthorizationReverseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingAuthorizationsAuthorizationReverse( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingAuthorizationsAuthorizationReverseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingCardsCardShippingDeliverParamSchema = z.object({ + card: z.string().max(5000), + }) + + const postTestHelpersIssuingCardsCardShippingDeliverRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersIssuingCardsCardShippingDeliverResponseBodyValidator = + responseValidationFactory([["200", s_issuing_card]], s_error) + + // postTestHelpersIssuingCardsCardShippingDeliver + router.post( + `/v1/test_helpers/issuing/cards/:card/shipping/deliver`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingCardsCardShippingDeliverParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingCardsCardShippingDeliverRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingCardsCardShippingDeliver( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingCardsCardShippingDeliverResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingCardsCardShippingFailParamSchema = z.object({ + card: z.string().max(5000), + }) + + const postTestHelpersIssuingCardsCardShippingFailRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersIssuingCardsCardShippingFailResponseBodyValidator = + responseValidationFactory([["200", s_issuing_card]], s_error) + + // postTestHelpersIssuingCardsCardShippingFail + router.post( + `/v1/test_helpers/issuing/cards/:card/shipping/fail`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingCardsCardShippingFailParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingCardsCardShippingFailRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingCardsCardShippingFail( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingCardsCardShippingFailResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingCardsCardShippingReturnParamSchema = z.object({ + card: z.string().max(5000), + }) + + const postTestHelpersIssuingCardsCardShippingReturnRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersIssuingCardsCardShippingReturnResponseBodyValidator = + responseValidationFactory([["200", s_issuing_card]], s_error) + + // postTestHelpersIssuingCardsCardShippingReturn + router.post( + `/v1/test_helpers/issuing/cards/:card/shipping/return`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingCardsCardShippingReturnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingCardsCardShippingReturnRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingCardsCardShippingReturn( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingCardsCardShippingReturnResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingCardsCardShippingShipParamSchema = z.object({ + card: z.string().max(5000), + }) + + const postTestHelpersIssuingCardsCardShippingShipRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersIssuingCardsCardShippingShipResponseBodyValidator = + responseValidationFactory([["200", s_issuing_card]], s_error) + + // postTestHelpersIssuingCardsCardShippingShip + router.post( + `/v1/test_helpers/issuing/cards/:card/shipping/ship`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingCardsCardShippingShipParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingCardsCardShippingShipRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingCardsCardShippingShip( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingCardsCardShippingShipResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingCardsCardShippingSubmitParamSchema = z.object({ + card: z.string().max(5000), + }) + + const postTestHelpersIssuingCardsCardShippingSubmitRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersIssuingCardsCardShippingSubmitResponseBodyValidator = + responseValidationFactory([["200", s_issuing_card]], s_error) + + // postTestHelpersIssuingCardsCardShippingSubmit + router.post( + `/v1/test_helpers/issuing/cards/:card/shipping/submit`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingCardsCardShippingSubmitParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingCardsCardShippingSubmitRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingCardsCardShippingSubmit( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingCardsCardShippingSubmitResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateParamSchema = + z.object({ personalization_design: z.string().max(5000) }) + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateRequestBodySchema = + z.object({ expand: z.array(z.string().max(5000)).optional() }).optional() + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateResponseBodyValidator = + responseValidationFactory( + [["200", s_issuing_personalization_design]], + s_error, + ) + + // postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate + router.post( + `/v1/test_helpers/issuing/personalization_designs/:personalization_design/activate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivate( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateParamSchema = + z.object({ personalization_design: z.string().max(5000) }) + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateRequestBodySchema = + z.object({ expand: z.array(z.string().max(5000)).optional() }).optional() + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateResponseBodyValidator = + responseValidationFactory( + [["200", s_issuing_personalization_design]], + s_error, + ) + + // postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate + router.post( + `/v1/test_helpers/issuing/personalization_designs/:personalization_design/deactivate`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivate( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectParamSchema = + z.object({ personalization_design: z.string().max(5000) }) + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectRequestBodySchema = + z.object({ + expand: z.array(z.string().max(5000)).optional(), + rejection_reasons: z.object({ + card_logo: z + .array( + z.enum([ + "geographic_location", + "inappropriate", + "network_name", + "non_binary_image", + "non_fiat_currency", + "other", + "other_entity", + "promotional_material", + ]), + ) + .optional(), + carrier_text: z + .array( + z.enum([ + "geographic_location", + "inappropriate", + "network_name", + "non_fiat_currency", + "other", + "other_entity", + "promotional_material", + ]), + ) + .optional(), + }), + }) + + const postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectResponseBodyValidator = + responseValidationFactory( + [["200", s_issuing_personalization_design]], + s_error, + ) + + // postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject + router.post( + `/v1/test_helpers/issuing/personalization_designs/:personalization_design/reject`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignReject( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingSettlementsRequestBodySchema = z.object({ + bin: z.string().max(5000), + clearing_date: z.coerce.number(), + currency: z.string(), + expand: z.array(z.string().max(5000)).optional(), + interchange_fees_amount: z.coerce.number().optional(), + net_total_amount: z.coerce.number(), + network: z.enum(["maestro", "visa"]).optional(), + network_settlement_identifier: z.string().max(5000).optional(), + transaction_amount: z.coerce.number().optional(), + transaction_count: z.coerce.number().optional(), + }) + + const postTestHelpersIssuingSettlementsResponseBodyValidator = + responseValidationFactory([["200", s_issuing_settlement]], s_error) + + // postTestHelpersIssuingSettlements + router.post( + `/v1/test_helpers/issuing/settlements`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingSettlementsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingSettlements(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingSettlementsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingSettlementsSettlementCompleteParamSchema = + z.object({ settlement: z.string().max(5000) }) + + const postTestHelpersIssuingSettlementsSettlementCompleteRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersIssuingSettlementsSettlementCompleteResponseBodyValidator = + responseValidationFactory([["200", s_issuing_settlement]], s_error) + + // postTestHelpersIssuingSettlementsSettlementComplete + router.post( + `/v1/test_helpers/issuing/settlements/:settlement/complete`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingSettlementsSettlementCompleteParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingSettlementsSettlementCompleteRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingSettlementsSettlementComplete( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingSettlementsSettlementCompleteResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingTransactionsCreateForceCaptureRequestBodySchema = + z.object({ + amount: z.coerce.number(), + card: z.string().max(5000), + currency: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + merchant_data: z + .object({ + category: z + .enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]) + .optional(), + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + name: z.string().max(5000).optional(), + network_id: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + terminal_id: z.string().max(5000).optional(), + url: z.string().max(5000).optional(), + }) + .optional(), + purchase_details: z + .object({ + fleet: z + .object({ + cardholder_prompt_data: z + .object({ + driver_id: z.string().max(5000).optional(), + odometer: z.coerce.number().optional(), + unspecified_id: z.string().max(5000).optional(), + user_id: z.string().max(5000).optional(), + vehicle_number: z.string().max(5000).optional(), + }) + .optional(), + purchase_type: z + .enum([ + "fuel_and_non_fuel_purchase", + "fuel_purchase", + "non_fuel_purchase", + ]) + .optional(), + reported_breakdown: z + .object({ + fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + non_fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + tax: z + .object({ + local_amount_decimal: z.string().optional(), + national_amount_decimal: z.string().optional(), + }) + .optional(), + }) + .optional(), + service_type: z + .enum(["full_service", "non_fuel_transaction", "self_service"]) + .optional(), + }) + .optional(), + flight: z + .object({ + departure_at: z.coerce.number().optional(), + passenger_name: z.string().max(5000).optional(), + refundable: PermissiveBoolean.optional(), + segments: z + .array( + z.object({ + arrival_airport_code: z.string().max(3).optional(), + carrier: z.string().max(5000).optional(), + departure_airport_code: z.string().max(3).optional(), + flight_number: z.string().max(5000).optional(), + service_class: z.string().max(5000).optional(), + stopover_allowed: PermissiveBoolean.optional(), + }), + ) + .optional(), + travel_agency: z.string().max(5000).optional(), + }) + .optional(), + fuel: z + .object({ + industry_product_code: z.string().max(5000).optional(), + quantity_decimal: z.string().optional(), + type: z + .enum([ + "diesel", + "other", + "unleaded_plus", + "unleaded_regular", + "unleaded_super", + ]) + .optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .optional(), + unit_cost_decimal: z.string().optional(), + }) + .optional(), + lodging: z + .object({ + check_in_at: z.coerce.number().optional(), + nights: z.coerce.number().optional(), + }) + .optional(), + receipt: z + .array( + z.object({ + description: z.string().max(26).optional(), + quantity: z.string().optional(), + total: z.coerce.number().optional(), + unit_cost: z.coerce.number().optional(), + }), + ) + .optional(), + reference: z.string().max(5000).optional(), + }) + .optional(), + }) + + const postTestHelpersIssuingTransactionsCreateForceCaptureResponseBodyValidator = + responseValidationFactory([["200", s_issuing_transaction]], s_error) + + // postTestHelpersIssuingTransactionsCreateForceCapture + router.post( + `/v1/test_helpers/issuing/transactions/create_force_capture`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingTransactionsCreateForceCaptureRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingTransactionsCreateForceCapture( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingTransactionsCreateForceCaptureResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingTransactionsCreateUnlinkedRefundRequestBodySchema = + z.object({ + amount: z.coerce.number(), + card: z.string().max(5000), + currency: z.string().optional(), + expand: z.array(z.string().max(5000)).optional(), + merchant_data: z + .object({ + category: z + .enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]) + .optional(), + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + name: z.string().max(5000).optional(), + network_id: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + terminal_id: z.string().max(5000).optional(), + url: z.string().max(5000).optional(), + }) + .optional(), + purchase_details: z + .object({ + fleet: z + .object({ + cardholder_prompt_data: z + .object({ + driver_id: z.string().max(5000).optional(), + odometer: z.coerce.number().optional(), + unspecified_id: z.string().max(5000).optional(), + user_id: z.string().max(5000).optional(), + vehicle_number: z.string().max(5000).optional(), + }) + .optional(), + purchase_type: z + .enum([ + "fuel_and_non_fuel_purchase", + "fuel_purchase", + "non_fuel_purchase", + ]) + .optional(), + reported_breakdown: z + .object({ + fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + non_fuel: z + .object({ gross_amount_decimal: z.string().optional() }) + .optional(), + tax: z + .object({ + local_amount_decimal: z.string().optional(), + national_amount_decimal: z.string().optional(), + }) + .optional(), + }) + .optional(), + service_type: z + .enum(["full_service", "non_fuel_transaction", "self_service"]) + .optional(), + }) + .optional(), + flight: z + .object({ + departure_at: z.coerce.number().optional(), + passenger_name: z.string().max(5000).optional(), + refundable: PermissiveBoolean.optional(), + segments: z + .array( + z.object({ + arrival_airport_code: z.string().max(3).optional(), + carrier: z.string().max(5000).optional(), + departure_airport_code: z.string().max(3).optional(), + flight_number: z.string().max(5000).optional(), + service_class: z.string().max(5000).optional(), + stopover_allowed: PermissiveBoolean.optional(), + }), + ) + .optional(), + travel_agency: z.string().max(5000).optional(), + }) + .optional(), + fuel: z + .object({ + industry_product_code: z.string().max(5000).optional(), + quantity_decimal: z.string().optional(), + type: z + .enum([ + "diesel", + "other", + "unleaded_plus", + "unleaded_regular", + "unleaded_super", + ]) + .optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .optional(), + unit_cost_decimal: z.string().optional(), + }) + .optional(), + lodging: z + .object({ + check_in_at: z.coerce.number().optional(), + nights: z.coerce.number().optional(), + }) + .optional(), + receipt: z + .array( + z.object({ + description: z.string().max(26).optional(), + quantity: z.string().optional(), + total: z.coerce.number().optional(), + unit_cost: z.coerce.number().optional(), + }), + ) + .optional(), + reference: z.string().max(5000).optional(), + }) + .optional(), + }) + + const postTestHelpersIssuingTransactionsCreateUnlinkedRefundResponseBodyValidator = + responseValidationFactory([["200", s_issuing_transaction]], s_error) + + // postTestHelpersIssuingTransactionsCreateUnlinkedRefund + router.post( + `/v1/test_helpers/issuing/transactions/create_unlinked_refund`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingTransactionsCreateUnlinkedRefundRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingTransactionsCreateUnlinkedRefund( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingTransactionsCreateUnlinkedRefundResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersIssuingTransactionsTransactionRefundParamSchema = + z.object({ transaction: z.string().max(5000) }) + + const postTestHelpersIssuingTransactionsTransactionRefundRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + refund_amount: z.coerce.number().optional(), + }) + .optional() + + const postTestHelpersIssuingTransactionsTransactionRefundResponseBodyValidator = + responseValidationFactory([["200", s_issuing_transaction]], s_error) + + // postTestHelpersIssuingTransactionsTransactionRefund + router.post( + `/v1/test_helpers/issuing/transactions/:transaction/refund`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersIssuingTransactionsTransactionRefundParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersIssuingTransactionsTransactionRefundRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersIssuingTransactionsTransactionRefund( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersIssuingTransactionsTransactionRefundResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersRefundsRefundExpireParamSchema = z.object({ + refund: z.string(), + }) + + const postTestHelpersRefundsRefundExpireRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersRefundsRefundExpireResponseBodyValidator = + responseValidationFactory([["200", s_refund]], s_error) + + // postTestHelpersRefundsRefundExpire + router.post( + `/v1/test_helpers/refunds/:refund/expire`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersRefundsRefundExpireParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersRefundsRefundExpireRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersRefundsRefundExpire(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersRefundsRefundExpireResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTerminalReadersReaderPresentPaymentMethodParamSchema = + z.object({ reader: z.string().max(5000) }) + + const postTestHelpersTerminalReadersReaderPresentPaymentMethodRequestBodySchema = + z + .object({ + amount_tip: z.coerce.number().optional(), + card_present: z + .object({ number: z.string().max(5000).optional() }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + interac_present: z + .object({ number: z.string().max(5000).optional() }) + .optional(), + type: z.enum(["card_present", "interac_present"]).optional(), + }) + .optional() + + const postTestHelpersTerminalReadersReaderPresentPaymentMethodResponseBodyValidator = + responseValidationFactory([["200", s_terminal_reader]], s_error) + + // postTestHelpersTerminalReadersReaderPresentPaymentMethod + router.post( + `/v1/test_helpers/terminal/readers/:reader/present_payment_method`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTerminalReadersReaderPresentPaymentMethodParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTerminalReadersReaderPresentPaymentMethodRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTerminalReadersReaderPresentPaymentMethod( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTerminalReadersReaderPresentPaymentMethodResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTestHelpersTestClocksQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getTestHelpersTestClocksRequestBodySchema = z.object({}).optional() + + const getTestHelpersTestClocksResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_test_helpers_test_clock), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/test_helpers/test_clocks")), + }), + ], + ], + s_error, + ) + + // getTestHelpersTestClocks + router.get( + `/v1/test_helpers/test_clocks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTestHelpersTestClocksQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTestHelpersTestClocksRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_test_helpers_test_clock[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTestHelpersTestClocks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTestHelpersTestClocksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTestClocksRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + frozen_time: z.coerce.number(), + name: z.string().max(300).optional(), + }) + + const postTestHelpersTestClocksResponseBodyValidator = + responseValidationFactory([["200", s_test_helpers_test_clock]], s_error) + + // postTestHelpersTestClocks + router.post( + `/v1/test_helpers/test_clocks`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTestHelpersTestClocksRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTestClocks(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTestHelpersTestClocksResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteTestHelpersTestClocksTestClockParamSchema = z.object({ + test_clock: z.string().max(5000), + }) + + const deleteTestHelpersTestClocksTestClockRequestBodySchema = z + .object({}) + .optional() + + const deleteTestHelpersTestClocksTestClockResponseBodyValidator = + responseValidationFactory( + [["200", s_deleted_test_helpers_test_clock]], + s_error, + ) + + // deleteTestHelpersTestClocksTestClock + router.delete( + `/v1/test_helpers/test_clocks/:test_clock`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteTestHelpersTestClocksTestClockParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteTestHelpersTestClocksTestClockRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteTestHelpersTestClocksTestClock( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteTestHelpersTestClocksTestClockResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTestHelpersTestClocksTestClockParamSchema = z.object({ + test_clock: z.string().max(5000), + }) + + const getTestHelpersTestClocksTestClockQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTestHelpersTestClocksTestClockRequestBodySchema = z + .object({}) + .optional() + + const getTestHelpersTestClocksTestClockResponseBodyValidator = + responseValidationFactory([["200", s_test_helpers_test_clock]], s_error) + + // getTestHelpersTestClocksTestClock + router.get( + `/v1/test_helpers/test_clocks/:test_clock`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTestHelpersTestClocksTestClockParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTestHelpersTestClocksTestClockQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTestHelpersTestClocksTestClockRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTestHelpersTestClocksTestClock(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTestHelpersTestClocksTestClockResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTestClocksTestClockAdvanceParamSchema = z.object({ + test_clock: z.string().max(5000), + }) + + const postTestHelpersTestClocksTestClockAdvanceRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + frozen_time: z.coerce.number(), + }) + + const postTestHelpersTestClocksTestClockAdvanceResponseBodyValidator = + responseValidationFactory([["200", s_test_helpers_test_clock]], s_error) + + // postTestHelpersTestClocksTestClockAdvance + router.post( + `/v1/test_helpers/test_clocks/:test_clock/advance`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTestClocksTestClockAdvanceParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTestClocksTestClockAdvanceRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTestClocksTestClockAdvance( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTestClocksTestClockAdvanceResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryInboundTransfersIdFailParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTestHelpersTreasuryInboundTransfersIdFailRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + failure_details: z + .object({ + code: z + .enum([ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "debit_not_authorized", + "incorrect_account_holder_address", + "incorrect_account_holder_name", + "incorrect_account_holder_tax_id", + "insufficient_funds", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ]) + .optional(), + }) + .optional(), + }) + .optional() + + const postTestHelpersTreasuryInboundTransfersIdFailResponseBodyValidator = + responseValidationFactory([["200", s_treasury_inbound_transfer]], s_error) + + // postTestHelpersTreasuryInboundTransfersIdFail + router.post( + `/v1/test_helpers/treasury/inbound_transfers/:id/fail`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryInboundTransfersIdFailParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryInboundTransfersIdFailRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryInboundTransfersIdFail( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryInboundTransfersIdFailResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryInboundTransfersIdReturnParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTestHelpersTreasuryInboundTransfersIdReturnRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersTreasuryInboundTransfersIdReturnResponseBodyValidator = + responseValidationFactory([["200", s_treasury_inbound_transfer]], s_error) + + // postTestHelpersTreasuryInboundTransfersIdReturn + router.post( + `/v1/test_helpers/treasury/inbound_transfers/:id/return`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryInboundTransfersIdReturnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryInboundTransfersIdReturnRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryInboundTransfersIdReturn( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryInboundTransfersIdReturnResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryInboundTransfersIdSucceedParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTestHelpersTreasuryInboundTransfersIdSucceedRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersTreasuryInboundTransfersIdSucceedResponseBodyValidator = + responseValidationFactory([["200", s_treasury_inbound_transfer]], s_error) + + // postTestHelpersTreasuryInboundTransfersIdSucceed + router.post( + `/v1/test_helpers/treasury/inbound_transfers/:id/succeed`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryInboundTransfersIdSucceedParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryInboundTransfersIdSucceedRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryInboundTransfersIdSucceed( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryInboundTransfersIdSucceedResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryOutboundPaymentsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTestHelpersTreasuryOutboundPaymentsIdRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + tracking_details: z.object({ + ach: z.object({ trace_id: z.string().max(5000) }).optional(), + type: z.enum(["ach", "us_domestic_wire"]), + us_domestic_wire: z + .object({ + chips: z.string().max(5000).optional(), + imad: z.string().max(5000).optional(), + omad: z.string().max(5000).optional(), + }) + .optional(), + }), + }) + + const postTestHelpersTreasuryOutboundPaymentsIdResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_payment]], s_error) + + // postTestHelpersTreasuryOutboundPaymentsId + router.post( + `/v1/test_helpers/treasury/outbound_payments/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryOutboundPaymentsId( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryOutboundPaymentsIdResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryOutboundPaymentsIdFailParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTestHelpersTreasuryOutboundPaymentsIdFailRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersTreasuryOutboundPaymentsIdFailResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_payment]], s_error) + + // postTestHelpersTreasuryOutboundPaymentsIdFail + router.post( + `/v1/test_helpers/treasury/outbound_payments/:id/fail`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdFailParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdFailRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryOutboundPaymentsIdFail( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryOutboundPaymentsIdFailResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryOutboundPaymentsIdPostParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTestHelpersTreasuryOutboundPaymentsIdPostRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTestHelpersTreasuryOutboundPaymentsIdPostResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_payment]], s_error) + + // postTestHelpersTreasuryOutboundPaymentsIdPost + router.post( + `/v1/test_helpers/treasury/outbound_payments/:id/post`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdPostParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdPostRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryOutboundPaymentsIdPost( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryOutboundPaymentsIdPostResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryOutboundPaymentsIdReturnParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTestHelpersTreasuryOutboundPaymentsIdReturnRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + returned_details: z + .object({ + code: z + .enum([ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "declined", + "incorrect_account_holder_name", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ]) + .optional(), + }) + .optional(), + }) + .optional() + + const postTestHelpersTreasuryOutboundPaymentsIdReturnResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_payment]], s_error) + + // postTestHelpersTreasuryOutboundPaymentsIdReturn + router.post( + `/v1/test_helpers/treasury/outbound_payments/:id/return`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdReturnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundPaymentsIdReturnRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryOutboundPaymentsIdReturn( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryOutboundPaymentsIdReturnResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema = + z.object({ outbound_transfer: z.string().max(5000) }) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferRequestBodySchema = + z.object({ + expand: z.array(z.string().max(5000)).optional(), + tracking_details: z.object({ + ach: z.object({ trace_id: z.string().max(5000) }).optional(), + type: z.enum(["ach", "us_domestic_wire"]), + us_domestic_wire: z + .object({ + chips: z.string().max(5000).optional(), + imad: z.string().max(5000).optional(), + omad: z.string().max(5000).optional(), + }) + .optional(), + }), + }) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_transfer]], s_error) + + // postTestHelpersTreasuryOutboundTransfersOutboundTransfer + router.post( + `/v1/test_helpers/treasury/outbound_transfers/:outbound_transfer`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryOutboundTransfersOutboundTransfer( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryOutboundTransfersOutboundTransferResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferFailParamSchema = + z.object({ outbound_transfer: z.string().max(5000) }) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferFailRequestBodySchema = + z.object({ expand: z.array(z.string().max(5000)).optional() }).optional() + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferFailResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_transfer]], s_error) + + // postTestHelpersTreasuryOutboundTransfersOutboundTransferFail + router.post( + `/v1/test_helpers/treasury/outbound_transfers/:outbound_transfer/fail`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferFailParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferFailRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryOutboundTransfersOutboundTransferFail( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryOutboundTransfersOutboundTransferFailResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferPostParamSchema = + z.object({ outbound_transfer: z.string().max(5000) }) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferPostRequestBodySchema = + z.object({ expand: z.array(z.string().max(5000)).optional() }).optional() + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferPostResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_transfer]], s_error) + + // postTestHelpersTreasuryOutboundTransfersOutboundTransferPost + router.post( + `/v1/test_helpers/treasury/outbound_transfers/:outbound_transfer/post`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferPostParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferPostRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryOutboundTransfersOutboundTransferPost( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryOutboundTransfersOutboundTransferPostResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferReturnParamSchema = + z.object({ outbound_transfer: z.string().max(5000) }) + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferReturnRequestBodySchema = + z + .object({ + expand: z.array(z.string().max(5000)).optional(), + returned_details: z + .object({ + code: z + .enum([ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "declined", + "incorrect_account_holder_name", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ]) + .optional(), + }) + .optional(), + }) + .optional() + + const postTestHelpersTreasuryOutboundTransfersOutboundTransferReturnResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_transfer]], s_error) + + // postTestHelpersTreasuryOutboundTransfersOutboundTransferReturn + router.post( + `/v1/test_helpers/treasury/outbound_transfers/:outbound_transfer/return`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferReturnParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryOutboundTransfersOutboundTransferReturnRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryOutboundTransfersOutboundTransferReturn( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryOutboundTransfersOutboundTransferReturnResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryReceivedCreditsRequestBodySchema = z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + financial_account: z.string(), + initiating_payment_method_details: z + .object({ + type: z.enum(["us_bank_account"]), + us_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional(), + network: z.enum(["ach", "us_domestic_wire"]), + }) + + const postTestHelpersTreasuryReceivedCreditsResponseBodyValidator = + responseValidationFactory([["200", s_treasury_received_credit]], s_error) + + // postTestHelpersTreasuryReceivedCredits + router.post( + `/v1/test_helpers/treasury/received_credits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryReceivedCreditsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryReceivedCredits( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryReceivedCreditsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTestHelpersTreasuryReceivedDebitsRequestBodySchema = z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + financial_account: z.string(), + initiating_payment_method_details: z + .object({ + type: z.enum(["us_bank_account"]), + us_bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_number: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional(), + network: z.enum(["ach"]), + }) + + const postTestHelpersTreasuryReceivedDebitsResponseBodyValidator = + responseValidationFactory([["200", s_treasury_received_debit]], s_error) + + // postTestHelpersTreasuryReceivedDebits + router.post( + `/v1/test_helpers/treasury/received_debits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTestHelpersTreasuryReceivedDebitsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTestHelpersTreasuryReceivedDebits( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTestHelpersTreasuryReceivedDebitsResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTokensRequestBodySchema = z + .object({ + account: z + .object({ + business_type: z + .enum(["company", "government_entity", "individual", "non_profit"]) + .optional(), + company: z + .object({ + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + directors_provided: PermissiveBoolean.optional(), + directorship_declaration: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + executives_provided: PermissiveBoolean.optional(), + export_license_id: z.string().max(5000).optional(), + export_purpose_code: z.string().max(5000).optional(), + name: z.string().max(100).optional(), + name_kana: z.string().max(100).optional(), + name_kanji: z.string().max(100).optional(), + owners_provided: PermissiveBoolean.optional(), + ownership_declaration: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z.string().max(5000).optional(), + }) + .optional(), + ownership_declaration_shown_and_signed: + PermissiveBoolean.optional(), + ownership_exemption_reason: z + .enum([ + "", + "qualified_entity_exceeds_ownership_threshold", + "qualifies_as_financial_institution", + ]) + .optional(), + phone: z.string().max(5000).optional(), + registration_number: z.string().max(5000).optional(), + structure: z + .enum([ + "", + "free_zone_establishment", + "free_zone_llc", + "government_instrumentality", + "governmental_unit", + "incorporated_non_profit", + "incorporated_partnership", + "limited_liability_partnership", + "llc", + "multi_member_llc", + "private_company", + "private_corporation", + "private_partnership", + "public_company", + "public_corporation", + "public_partnership", + "registered_charity", + "single_member_llc", + "sole_establishment", + "sole_proprietorship", + "tax_exempt_government_instrumentality", + "unincorporated_association", + "unincorporated_non_profit", + "unincorporated_partnership", + ]) + .optional(), + tax_id: z.string().max(5000).optional(), + tax_id_registrar: z.string().max(5000).optional(), + vat_id: z.string().max(5000).optional(), + verification: z + .object({ + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + individual: z + .object({ + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + dob: z + .union([ + z.object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + email: z.string().optional(), + first_name: z.string().max(100).optional(), + first_name_kana: z.string().max(5000).optional(), + first_name_kanji: z.string().max(5000).optional(), + full_name_aliases: z + .union([z.array(z.string().max(300)), z.enum([""])]) + .optional(), + gender: z.string().optional(), + id_number: z.string().max(5000).optional(), + id_number_secondary: z.string().max(5000).optional(), + last_name: z.string().max(100).optional(), + last_name_kana: z.string().max(5000).optional(), + last_name_kanji: z.string().max(5000).optional(), + maiden_name: z.string().max(5000).optional(), + metadata: z + .union([z.record(z.string()), z.enum([""])]) + .optional(), + phone: z.string().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + relationship: z + .object({ + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + percent_ownership: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + title: z.string().max(5000).optional(), + }) + .optional(), + ssn_last_4: z.string().max(5000).optional(), + verification: z + .object({ + additional_document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + tos_shown_and_accepted: PermissiveBoolean.optional(), + }) + .optional(), + bank_account: z + .object({ + account_holder_name: z.string().max(5000).optional(), + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000), + account_type: z + .enum(["checking", "futsu", "savings", "toza"]) + .optional(), + country: z.string().max(5000), + currency: z.string().optional(), + payment_method: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + card: z + .union([ + z.object({ + address_city: z.string().max(5000).optional(), + address_country: z.string().max(5000).optional(), + address_line1: z.string().max(5000).optional(), + address_line2: z.string().max(5000).optional(), + address_state: z.string().max(5000).optional(), + address_zip: z.string().max(5000).optional(), + currency: z.string().max(5000).optional(), + cvc: z.string().max(5000).optional(), + exp_month: z.string().max(5000), + exp_year: z.string().max(5000), + name: z.string().max(5000).optional(), + networks: z + .object({ + preferred: z + .enum(["cartes_bancaires", "mastercard", "visa"]) + .optional(), + }) + .optional(), + number: z.string().max(5000), + }), + z.string().max(5000), + ]) + .optional(), + customer: z.string().max(5000).optional(), + cvc_update: z.object({ cvc: z.string().max(5000) }).optional(), + expand: z.array(z.string().max(5000)).optional(), + person: z + .object({ + additional_tos_acceptances: z + .object({ + account: z + .object({ + date: z.coerce.number().optional(), + ip: z.string().optional(), + user_agent: z + .union([z.string().max(5000), z.enum([""])]) + .optional(), + }) + .optional(), + }) + .optional(), + address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + address_kana: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + address_kanji: z + .object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + town: z.string().max(5000).optional(), + }) + .optional(), + dob: z + .union([ + z.object({ + day: z.coerce.number(), + month: z.coerce.number(), + year: z.coerce.number(), + }), + z.enum([""]), + ]) + .optional(), + documents: z + .object({ + company_authorization: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + passport: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + visa: z + .object({ + files: z + .array(z.union([z.string().max(500), z.enum([""])])) + .optional(), + }) + .optional(), + }) + .optional(), + email: z.string().optional(), + first_name: z.string().max(5000).optional(), + first_name_kana: z.string().max(5000).optional(), + first_name_kanji: z.string().max(5000).optional(), + full_name_aliases: z + .union([z.array(z.string().max(5000)), z.enum([""])]) + .optional(), + gender: z.string().optional(), + id_number: z.string().max(5000).optional(), + id_number_secondary: z.string().max(5000).optional(), + last_name: z.string().max(5000).optional(), + last_name_kana: z.string().max(5000).optional(), + last_name_kanji: z.string().max(5000).optional(), + maiden_name: z.string().max(5000).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + nationality: z.string().max(5000).optional(), + phone: z.string().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: z + .object({ + city: z.string().max(100).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(200).optional(), + line2: z.string().max(200).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }) + .optional(), + relationship: z + .object({ + authorizer: PermissiveBoolean.optional(), + director: PermissiveBoolean.optional(), + executive: PermissiveBoolean.optional(), + legal_guardian: PermissiveBoolean.optional(), + owner: PermissiveBoolean.optional(), + percent_ownership: z + .union([z.coerce.number(), z.enum([""])]) + .optional(), + representative: PermissiveBoolean.optional(), + title: z.string().max(5000).optional(), + }) + .optional(), + ssn_last_4: z.string().optional(), + verification: z + .object({ + additional_document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + document: z + .object({ + back: z.string().max(500).optional(), + front: z.string().max(500).optional(), + }) + .optional(), + }) + .optional(), + }) + .optional(), + pii: z.object({ id_number: z.string().max(5000).optional() }).optional(), + }) + .optional() + + const postTokensResponseBodyValidator = responseValidationFactory( + [["200", s_token]], + s_error, + ) + + // postTokens + router.post( + `/v1/tokens`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTokensRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTokens(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTokensResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTokensTokenParamSchema = z.object({ token: z.string().max(5000) }) + + const getTokensTokenQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTokensTokenRequestBodySchema = z.object({}).optional() + + const getTokensTokenResponseBodyValidator = responseValidationFactory( + [["200", s_token]], + s_error, + ) + + // getTokensToken + router.get( + `/v1/tokens/:token`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTokensTokenParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTokensTokenQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTokensTokenRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTokensToken(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTokensTokenResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTopupsQuerySchema = z.object({ + amount: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["canceled", "failed", "pending", "succeeded"]).optional(), + }) + + const getTopupsRequestBodySchema = z.object({}).optional() + + const getTopupsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_topup)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/topups")), + }), + ], + ], + s_error, + ) + + // getTopups + router.get( + `/v1/topups`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTopupsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTopupsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_topup[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTopups(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTopupsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTopupsRequestBodySchema = z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + source: z.string().max(5000).optional(), + statement_descriptor: z.string().max(15).optional(), + transfer_group: z.string().optional(), + }) + + const postTopupsResponseBodyValidator = responseValidationFactory( + [["200", s_topup]], + s_error, + ) + + // postTopups + router.post( + `/v1/topups`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTopupsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTopups(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTopupsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTopupsTopupParamSchema = z.object({ topup: z.string().max(5000) }) + + const getTopupsTopupQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTopupsTopupRequestBodySchema = z.object({}).optional() + + const getTopupsTopupResponseBodyValidator = responseValidationFactory( + [["200", s_topup]], + s_error, + ) + + // getTopupsTopup + router.get( + `/v1/topups/:topup`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTopupsTopupParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTopupsTopupQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTopupsTopupRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTopupsTopup(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTopupsTopupResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTopupsTopupParamSchema = z.object({ topup: z.string().max(5000) }) + + const postTopupsTopupRequestBodySchema = z + .object({ + description: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postTopupsTopupResponseBodyValidator = responseValidationFactory( + [["200", s_topup]], + s_error, + ) + + // postTopupsTopup + router.post( + `/v1/topups/:topup`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTopupsTopupParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTopupsTopupRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTopupsTopup(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTopupsTopupResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTopupsTopupCancelParamSchema = z.object({ + topup: z.string().max(5000), + }) + + const postTopupsTopupCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTopupsTopupCancelResponseBodyValidator = responseValidationFactory( + [["200", s_topup]], + s_error, + ) + + // postTopupsTopupCancel + router.post( + `/v1/topups/:topup/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTopupsTopupCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTopupsTopupCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTopupsTopupCancel(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTopupsTopupCancelResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTransfersQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + destination: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + transfer_group: z.string().max(5000).optional(), + }) + + const getTransfersRequestBodySchema = z.object({}).optional() + + const getTransfersResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_transfer)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/transfers")), + }), + ], + ], + s_error, + ) + + // getTransfers + router.get( + `/v1/transfers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTransfersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTransfersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_transfer[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTransfers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTransfersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTransfersRequestBodySchema = z.object({ + amount: z.coerce.number().optional(), + currency: z.string(), + description: z.string().max(5000).optional(), + destination: z.string(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + source_transaction: z.string().optional(), + source_type: z.enum(["bank_account", "card", "fpx"]).optional(), + transfer_group: z.string().optional(), + }) + + const postTransfersResponseBodyValidator = responseValidationFactory( + [["200", s_transfer]], + s_error, + ) + + // postTransfers + router.post( + `/v1/transfers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTransfersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTransfers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTransfersResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTransfersIdReversalsParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getTransfersIdReversalsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getTransfersIdReversalsRequestBodySchema = z.object({}).optional() + + const getTransfersIdReversalsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_transfer_reversal)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTransfersIdReversals + router.get( + `/v1/transfers/:id/reversals`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTransfersIdReversalsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTransfersIdReversalsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTransfersIdReversalsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_transfer_reversal[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTransfersIdReversals(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTransfersIdReversalsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTransfersIdReversalsParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTransfersIdReversalsRequestBodySchema = z + .object({ + amount: z.coerce.number().optional(), + description: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + refund_application_fee: PermissiveBoolean.optional(), + }) + .optional() + + const postTransfersIdReversalsResponseBodyValidator = + responseValidationFactory([["200", s_transfer_reversal]], s_error) + + // postTransfersIdReversals + router.post( + `/v1/transfers/:id/reversals`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTransfersIdReversalsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTransfersIdReversalsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTransfersIdReversals(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTransfersIdReversalsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTransfersTransferParamSchema = z.object({ + transfer: z.string().max(5000), + }) + + const getTransfersTransferQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTransfersTransferRequestBodySchema = z.object({}).optional() + + const getTransfersTransferResponseBodyValidator = responseValidationFactory( + [["200", s_transfer]], + s_error, + ) + + // getTransfersTransfer + router.get( + `/v1/transfers/:transfer`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTransfersTransferParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTransfersTransferQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTransfersTransferRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTransfersTransfer(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTransfersTransferResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTransfersTransferParamSchema = z.object({ + transfer: z.string().max(5000), + }) + + const postTransfersTransferRequestBodySchema = z + .object({ + description: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postTransfersTransferResponseBodyValidator = responseValidationFactory( + [["200", s_transfer]], + s_error, + ) + + // postTransfersTransfer + router.post( + `/v1/transfers/:transfer`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTransfersTransferParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTransfersTransferRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTransfersTransfer(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postTransfersTransferResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTransfersTransferReversalsIdParamSchema = z.object({ + id: z.string().max(5000), + transfer: z.string().max(5000), + }) + + const getTransfersTransferReversalsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTransfersTransferReversalsIdRequestBodySchema = z + .object({}) + .optional() + + const getTransfersTransferReversalsIdResponseBodyValidator = + responseValidationFactory([["200", s_transfer_reversal]], s_error) + + // getTransfersTransferReversalsId + router.get( + `/v1/transfers/:transfer/reversals/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTransfersTransferReversalsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTransfersTransferReversalsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTransfersTransferReversalsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTransfersTransferReversalsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTransfersTransferReversalsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTransfersTransferReversalsIdParamSchema = z.object({ + id: z.string().max(5000), + transfer: z.string().max(5000), + }) + + const postTransfersTransferReversalsIdRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + }) + .optional() + + const postTransfersTransferReversalsIdResponseBodyValidator = + responseValidationFactory([["200", s_transfer_reversal]], s_error) + + // postTransfersTransferReversalsId + router.post( + `/v1/transfers/:transfer/reversals/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTransfersTransferReversalsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTransfersTransferReversalsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTransfersTransferReversalsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTransfersTransferReversalsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryCreditReversalsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + received_credit: z.string().max(5000).optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["canceled", "posted", "processing"]).optional(), + }) + + const getTreasuryCreditReversalsRequestBodySchema = z.object({}).optional() + + const getTreasuryCreditReversalsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_credit_reversal)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTreasuryCreditReversals + router.get( + `/v1/treasury/credit_reversals`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryCreditReversalsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryCreditReversalsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_credit_reversal[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryCreditReversals(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryCreditReversalsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryCreditReversalsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + received_credit: z.string().max(5000), + }) + + const postTreasuryCreditReversalsResponseBodyValidator = + responseValidationFactory([["200", s_treasury_credit_reversal]], s_error) + + // postTreasuryCreditReversals + router.post( + `/v1/treasury/credit_reversals`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTreasuryCreditReversalsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryCreditReversals(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryCreditReversalsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryCreditReversalsCreditReversalParamSchema = z.object({ + credit_reversal: z.string().max(5000), + }) + + const getTreasuryCreditReversalsCreditReversalQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryCreditReversalsCreditReversalRequestBodySchema = z + .object({}) + .optional() + + const getTreasuryCreditReversalsCreditReversalResponseBodyValidator = + responseValidationFactory([["200", s_treasury_credit_reversal]], s_error) + + // getTreasuryCreditReversalsCreditReversal + router.get( + `/v1/treasury/credit_reversals/:credit_reversal`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryCreditReversalsCreditReversalParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryCreditReversalsCreditReversalQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryCreditReversalsCreditReversalRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryCreditReversalsCreditReversal( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryCreditReversalsCreditReversalResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryDebitReversalsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + received_debit: z.string().max(5000).optional(), + resolution: z.enum(["lost", "won"]).optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["canceled", "completed", "processing"]).optional(), + }) + + const getTreasuryDebitReversalsRequestBodySchema = z.object({}).optional() + + const getTreasuryDebitReversalsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_debit_reversal)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTreasuryDebitReversals + router.get( + `/v1/treasury/debit_reversals`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryDebitReversalsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryDebitReversalsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_debit_reversal[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryDebitReversals(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTreasuryDebitReversalsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryDebitReversalsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + metadata: z.record(z.string()).optional(), + received_debit: z.string().max(5000), + }) + + const postTreasuryDebitReversalsResponseBodyValidator = + responseValidationFactory([["200", s_treasury_debit_reversal]], s_error) + + // postTreasuryDebitReversals + router.post( + `/v1/treasury/debit_reversals`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTreasuryDebitReversalsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryDebitReversals(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryDebitReversalsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryDebitReversalsDebitReversalParamSchema = z.object({ + debit_reversal: z.string().max(5000), + }) + + const getTreasuryDebitReversalsDebitReversalQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryDebitReversalsDebitReversalRequestBodySchema = z + .object({}) + .optional() + + const getTreasuryDebitReversalsDebitReversalResponseBodyValidator = + responseValidationFactory([["200", s_treasury_debit_reversal]], s_error) + + // getTreasuryDebitReversalsDebitReversal + router.get( + `/v1/treasury/debit_reversals/:debit_reversal`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryDebitReversalsDebitReversalParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryDebitReversalsDebitReversalQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryDebitReversalsDebitReversalRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryDebitReversalsDebitReversal( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryDebitReversalsDebitReversalResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryFinancialAccountsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getTreasuryFinancialAccountsRequestBodySchema = z.object({}).optional() + + const getTreasuryFinancialAccountsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_treasury_financial_account), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/treasury/financial_accounts")), + }), + ], + ], + s_error, + ) + + // getTreasuryFinancialAccounts + router.get( + `/v1/treasury/financial_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryFinancialAccountsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryFinancialAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_financial_account[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryFinancialAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryFinancialAccountsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryFinancialAccountsRequestBodySchema = z.object({ + expand: z.array(z.string().max(5000)).optional(), + features: z + .object({ + card_issuing: z.object({ requested: PermissiveBoolean }).optional(), + deposit_insurance: z + .object({ requested: PermissiveBoolean }) + .optional(), + financial_addresses: z + .object({ + aba: z.object({ requested: PermissiveBoolean }).optional(), + }) + .optional(), + inbound_transfers: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + }) + .optional(), + intra_stripe_flows: z + .object({ requested: PermissiveBoolean }) + .optional(), + outbound_payments: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + us_domestic_wire: z + .object({ requested: PermissiveBoolean }) + .optional(), + }) + .optional(), + outbound_transfers: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + us_domestic_wire: z + .object({ requested: PermissiveBoolean }) + .optional(), + }) + .optional(), + }) + .optional(), + metadata: z.record(z.string()).optional(), + nickname: z.union([z.string().max(5000), z.enum([""])]).optional(), + platform_restrictions: z + .object({ + inbound_flows: z.enum(["restricted", "unrestricted"]).optional(), + outbound_flows: z.enum(["restricted", "unrestricted"]).optional(), + }) + .optional(), + supported_currencies: z.array(z.string().max(5000)), + }) + + const postTreasuryFinancialAccountsResponseBodyValidator = + responseValidationFactory([["200", s_treasury_financial_account]], s_error) + + // postTreasuryFinancialAccounts + router.post( + `/v1/treasury/financial_accounts`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTreasuryFinancialAccountsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryFinancialAccounts(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryFinancialAccountsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryFinancialAccountsFinancialAccountParamSchema = z.object({ + financial_account: z.string().max(5000), + }) + + const getTreasuryFinancialAccountsFinancialAccountQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryFinancialAccountsFinancialAccountRequestBodySchema = z + .object({}) + .optional() + + const getTreasuryFinancialAccountsFinancialAccountResponseBodyValidator = + responseValidationFactory([["200", s_treasury_financial_account]], s_error) + + // getTreasuryFinancialAccountsFinancialAccount + router.get( + `/v1/treasury/financial_accounts/:financial_account`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryFinancialAccountsFinancialAccountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryFinancialAccountsFinancialAccountQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryFinancialAccountsFinancialAccountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryFinancialAccountsFinancialAccount( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryFinancialAccountsFinancialAccountResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryFinancialAccountsFinancialAccountParamSchema = z.object({ + financial_account: z.string().max(5000), + }) + + const postTreasuryFinancialAccountsFinancialAccountRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + features: z + .object({ + card_issuing: z.object({ requested: PermissiveBoolean }).optional(), + deposit_insurance: z + .object({ requested: PermissiveBoolean }) + .optional(), + financial_addresses: z + .object({ + aba: z.object({ requested: PermissiveBoolean }).optional(), + }) + .optional(), + inbound_transfers: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + }) + .optional(), + intra_stripe_flows: z + .object({ requested: PermissiveBoolean }) + .optional(), + outbound_payments: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + us_domestic_wire: z + .object({ requested: PermissiveBoolean }) + .optional(), + }) + .optional(), + outbound_transfers: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + us_domestic_wire: z + .object({ requested: PermissiveBoolean }) + .optional(), + }) + .optional(), + }) + .optional(), + forwarding_settings: z + .object({ + financial_account: z.string().optional(), + payment_method: z.string().max(5000).optional(), + type: z.enum(["financial_account", "payment_method"]), + }) + .optional(), + metadata: z.record(z.string()).optional(), + nickname: z.union([z.string().max(5000), z.enum([""])]).optional(), + platform_restrictions: z + .object({ + inbound_flows: z.enum(["restricted", "unrestricted"]).optional(), + outbound_flows: z.enum(["restricted", "unrestricted"]).optional(), + }) + .optional(), + }) + .optional() + + const postTreasuryFinancialAccountsFinancialAccountResponseBodyValidator = + responseValidationFactory([["200", s_treasury_financial_account]], s_error) + + // postTreasuryFinancialAccountsFinancialAccount + router.post( + `/v1/treasury/financial_accounts/:financial_account`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTreasuryFinancialAccountsFinancialAccountParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTreasuryFinancialAccountsFinancialAccountRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryFinancialAccountsFinancialAccount( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryFinancialAccountsFinancialAccountResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryFinancialAccountsFinancialAccountCloseParamSchema = + z.object({ financial_account: z.string().max(5000) }) + + const postTreasuryFinancialAccountsFinancialAccountCloseRequestBodySchema = z + .object({ + expand: z.array(z.string().max(5000)).optional(), + forwarding_settings: z + .object({ + financial_account: z.string().optional(), + payment_method: z.string().max(5000).optional(), + type: z.enum(["financial_account", "payment_method"]), + }) + .optional(), + }) + .optional() + + const postTreasuryFinancialAccountsFinancialAccountCloseResponseBodyValidator = + responseValidationFactory([["200", s_treasury_financial_account]], s_error) + + // postTreasuryFinancialAccountsFinancialAccountClose + router.post( + `/v1/treasury/financial_accounts/:financial_account/close`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTreasuryFinancialAccountsFinancialAccountCloseParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTreasuryFinancialAccountsFinancialAccountCloseRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryFinancialAccountsFinancialAccountClose( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryFinancialAccountsFinancialAccountCloseResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema = + z.object({ financial_account: z.string().max(5000) }) + + const getTreasuryFinancialAccountsFinancialAccountFeaturesQuerySchema = + z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema = + z.object({}).optional() + + const getTreasuryFinancialAccountsFinancialAccountFeaturesResponseBodyValidator = + responseValidationFactory( + [["200", s_treasury_financial_account_features]], + s_error, + ) + + // getTreasuryFinancialAccountsFinancialAccountFeatures + router.get( + `/v1/treasury/financial_accounts/:financial_account/features`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryFinancialAccountsFinancialAccountFeaturesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryFinancialAccountsFinancialAccountFeatures( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryFinancialAccountsFinancialAccountFeaturesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema = + z.object({ financial_account: z.string().max(5000) }) + + const postTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema = + z + .object({ + card_issuing: z.object({ requested: PermissiveBoolean }).optional(), + deposit_insurance: z + .object({ requested: PermissiveBoolean }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + financial_addresses: z + .object({ + aba: z.object({ requested: PermissiveBoolean }).optional(), + }) + .optional(), + inbound_transfers: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + }) + .optional(), + intra_stripe_flows: z + .object({ requested: PermissiveBoolean }) + .optional(), + outbound_payments: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + us_domestic_wire: z + .object({ requested: PermissiveBoolean }) + .optional(), + }) + .optional(), + outbound_transfers: z + .object({ + ach: z.object({ requested: PermissiveBoolean }).optional(), + us_domestic_wire: z + .object({ requested: PermissiveBoolean }) + .optional(), + }) + .optional(), + }) + .optional() + + const postTreasuryFinancialAccountsFinancialAccountFeaturesResponseBodyValidator = + responseValidationFactory( + [["200", s_treasury_financial_account_features]], + s_error, + ) + + // postTreasuryFinancialAccountsFinancialAccountFeatures + router.post( + `/v1/treasury/financial_accounts/:financial_account/features`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse( + 200, + ) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryFinancialAccountsFinancialAccountFeatures( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryFinancialAccountsFinancialAccountFeaturesResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryInboundTransfersQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z + .enum(["canceled", "failed", "processing", "succeeded"]) + .optional(), + }) + + const getTreasuryInboundTransfersRequestBodySchema = z.object({}).optional() + + const getTreasuryInboundTransfersResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_inbound_transfer)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTreasuryInboundTransfers + router.get( + `/v1/treasury/inbound_transfers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryInboundTransfersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryInboundTransfersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_inbound_transfer[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryInboundTransfers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryInboundTransfersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryInboundTransfersRequestBodySchema = z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).optional(), + expand: z.array(z.string().max(5000)).optional(), + financial_account: z.string(), + metadata: z.record(z.string()).optional(), + origin_payment_method: z.string().max(5000), + statement_descriptor: z.string().max(10).optional(), + }) + + const postTreasuryInboundTransfersResponseBodyValidator = + responseValidationFactory([["200", s_treasury_inbound_transfer]], s_error) + + // postTreasuryInboundTransfers + router.post( + `/v1/treasury/inbound_transfers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTreasuryInboundTransfersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryInboundTransfers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryInboundTransfersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryInboundTransfersIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getTreasuryInboundTransfersIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryInboundTransfersIdRequestBodySchema = z.object({}).optional() + + const getTreasuryInboundTransfersIdResponseBodyValidator = + responseValidationFactory([["200", s_treasury_inbound_transfer]], s_error) + + // getTreasuryInboundTransfersId + router.get( + `/v1/treasury/inbound_transfers/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryInboundTransfersIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryInboundTransfersIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryInboundTransfersIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryInboundTransfersId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryInboundTransfersIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryInboundTransfersInboundTransferCancelParamSchema = z.object( + { inbound_transfer: z.string().max(5000) }, + ) + + const postTreasuryInboundTransfersInboundTransferCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTreasuryInboundTransfersInboundTransferCancelResponseBodyValidator = + responseValidationFactory([["200", s_treasury_inbound_transfer]], s_error) + + // postTreasuryInboundTransfersInboundTransferCancel + router.post( + `/v1/treasury/inbound_transfers/:inbound_transfer/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTreasuryInboundTransfersInboundTransferCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTreasuryInboundTransfersInboundTransferCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryInboundTransfersInboundTransferCancel( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryInboundTransfersInboundTransferCancelResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryOutboundPaymentsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + customer: z.string().max(5000).optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z + .enum(["canceled", "failed", "posted", "processing", "returned"]) + .optional(), + }) + + const getTreasuryOutboundPaymentsRequestBodySchema = z.object({}).optional() + + const getTreasuryOutboundPaymentsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_outbound_payment)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/treasury/outbound_payments")), + }), + ], + ], + s_error, + ) + + // getTreasuryOutboundPayments + router.get( + `/v1/treasury/outbound_payments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryOutboundPaymentsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryOutboundPaymentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_outbound_payment[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryOutboundPayments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryOutboundPaymentsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryOutboundPaymentsRequestBodySchema = z.object({ + amount: z.coerce.number(), + currency: z.string(), + customer: z.string().max(5000).optional(), + description: z.string().max(5000).optional(), + destination_payment_method: z.string().max(5000).optional(), + destination_payment_method_data: z + .object({ + billing_details: z + .object({ + address: z + .union([ + z.object({ + city: z.string().max(5000).optional(), + country: z.string().max(5000).optional(), + line1: z.string().max(5000).optional(), + line2: z.string().max(5000).optional(), + postal_code: z.string().max(5000).optional(), + state: z.string().max(5000).optional(), + }), + z.enum([""]), + ]) + .optional(), + email: z.union([z.string(), z.enum([""])]).optional(), + name: z.union([z.string().max(5000), z.enum([""])]).optional(), + phone: z.union([z.string().max(5000), z.enum([""])]).optional(), + }) + .optional(), + financial_account: z.string().optional(), + metadata: z.record(z.string()).optional(), + type: z.enum(["financial_account", "us_bank_account"]), + us_bank_account: z + .object({ + account_holder_type: z.enum(["company", "individual"]).optional(), + account_number: z.string().max(5000).optional(), + account_type: z.enum(["checking", "savings"]).optional(), + financial_connections_account: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), + }) + .optional(), + }) + .optional(), + destination_payment_method_options: z + .object({ + us_bank_account: z + .union([ + z.object({ + network: z.enum(["ach", "us_domestic_wire"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + end_user_details: z + .object({ ip_address: z.string().optional(), present: PermissiveBoolean }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + financial_account: z.string(), + metadata: z.record(z.string()).optional(), + statement_descriptor: z.string().max(5000).optional(), + }) + + const postTreasuryOutboundPaymentsResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_payment]], s_error) + + // postTreasuryOutboundPayments + router.post( + `/v1/treasury/outbound_payments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTreasuryOutboundPaymentsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryOutboundPayments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryOutboundPaymentsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryOutboundPaymentsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getTreasuryOutboundPaymentsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryOutboundPaymentsIdRequestBodySchema = z.object({}).optional() + + const getTreasuryOutboundPaymentsIdResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_payment]], s_error) + + // getTreasuryOutboundPaymentsId + router.get( + `/v1/treasury/outbound_payments/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryOutboundPaymentsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryOutboundPaymentsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryOutboundPaymentsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryOutboundPaymentsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryOutboundPaymentsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryOutboundPaymentsIdCancelParamSchema = z.object({ + id: z.string().max(5000), + }) + + const postTreasuryOutboundPaymentsIdCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTreasuryOutboundPaymentsIdCancelResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_payment]], s_error) + + // postTreasuryOutboundPaymentsIdCancel + router.post( + `/v1/treasury/outbound_payments/:id/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTreasuryOutboundPaymentsIdCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTreasuryOutboundPaymentsIdCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryOutboundPaymentsIdCancel( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryOutboundPaymentsIdCancelResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryOutboundTransfersQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z + .enum(["canceled", "failed", "posted", "processing", "returned"]) + .optional(), + }) + + const getTreasuryOutboundTransfersRequestBodySchema = z.object({}).optional() + + const getTreasuryOutboundTransfersResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_outbound_transfer)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTreasuryOutboundTransfers + router.get( + `/v1/treasury/outbound_transfers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryOutboundTransfersQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryOutboundTransfersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_outbound_transfer[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryOutboundTransfers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryOutboundTransfersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryOutboundTransfersRequestBodySchema = z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).optional(), + destination_payment_method: z.string().max(5000).optional(), + destination_payment_method_data: z + .object({ + financial_account: z.string().optional(), + type: z.enum(["financial_account"]), + }) + .optional(), + destination_payment_method_options: z + .object({ + us_bank_account: z + .union([ + z.object({ + network: z.enum(["ach", "us_domestic_wire"]).optional(), + }), + z.enum([""]), + ]) + .optional(), + }) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + financial_account: z.string(), + metadata: z.record(z.string()).optional(), + statement_descriptor: z.string().max(5000).optional(), + }) + + const postTreasuryOutboundTransfersResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_transfer]], s_error) + + // postTreasuryOutboundTransfers + router.post( + `/v1/treasury/outbound_transfers`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postTreasuryOutboundTransfersRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryOutboundTransfers(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryOutboundTransfersResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryOutboundTransfersOutboundTransferParamSchema = z.object({ + outbound_transfer: z.string().max(5000), + }) + + const getTreasuryOutboundTransfersOutboundTransferQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryOutboundTransfersOutboundTransferRequestBodySchema = z + .object({}) + .optional() + + const getTreasuryOutboundTransfersOutboundTransferResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_transfer]], s_error) + + // getTreasuryOutboundTransfersOutboundTransfer + router.get( + `/v1/treasury/outbound_transfers/:outbound_transfer`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryOutboundTransfersOutboundTransferParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryOutboundTransfersOutboundTransferQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryOutboundTransfersOutboundTransferRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryOutboundTransfersOutboundTransfer( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryOutboundTransfersOutboundTransferResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postTreasuryOutboundTransfersOutboundTransferCancelParamSchema = + z.object({ outbound_transfer: z.string().max(5000) }) + + const postTreasuryOutboundTransfersOutboundTransferCancelRequestBodySchema = z + .object({ expand: z.array(z.string().max(5000)).optional() }) + .optional() + + const postTreasuryOutboundTransfersOutboundTransferCancelResponseBodyValidator = + responseValidationFactory([["200", s_treasury_outbound_transfer]], s_error) + + // postTreasuryOutboundTransfersOutboundTransferCancel + router.post( + `/v1/treasury/outbound_transfers/:outbound_transfer/cancel`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postTreasuryOutboundTransfersOutboundTransferCancelParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postTreasuryOutboundTransfersOutboundTransferCancelRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postTreasuryOutboundTransfersOutboundTransferCancel( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postTreasuryOutboundTransfersOutboundTransferCancelResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryReceivedCreditsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + linked_flows: z + .object({ + source_flow_type: z.enum([ + "credit_reversal", + "other", + "outbound_payment", + "outbound_transfer", + "payout", + ]), + }) + .optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["failed", "succeeded"]).optional(), + }) + + const getTreasuryReceivedCreditsRequestBodySchema = z.object({}).optional() + + const getTreasuryReceivedCreditsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_received_credit)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTreasuryReceivedCredits + router.get( + `/v1/treasury/received_credits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryReceivedCreditsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryReceivedCreditsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_received_credit[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryReceivedCredits(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryReceivedCreditsResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryReceivedCreditsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getTreasuryReceivedCreditsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryReceivedCreditsIdRequestBodySchema = z.object({}).optional() + + const getTreasuryReceivedCreditsIdResponseBodyValidator = + responseValidationFactory([["200", s_treasury_received_credit]], s_error) + + // getTreasuryReceivedCreditsId + router.get( + `/v1/treasury/received_credits/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryReceivedCreditsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryReceivedCreditsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryReceivedCreditsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryReceivedCreditsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryReceivedCreditsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryReceivedDebitsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["failed", "succeeded"]).optional(), + }) + + const getTreasuryReceivedDebitsRequestBodySchema = z.object({}).optional() + + const getTreasuryReceivedDebitsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_received_debit)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTreasuryReceivedDebits + router.get( + `/v1/treasury/received_debits`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryReceivedDebitsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryReceivedDebitsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_received_debit[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryReceivedDebits(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTreasuryReceivedDebitsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryReceivedDebitsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getTreasuryReceivedDebitsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryReceivedDebitsIdRequestBodySchema = z.object({}).optional() + + const getTreasuryReceivedDebitsIdResponseBodyValidator = + responseValidationFactory([["200", s_treasury_received_debit]], s_error) + + // getTreasuryReceivedDebitsId + router.get( + `/v1/treasury/received_debits/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryReceivedDebitsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryReceivedDebitsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryReceivedDebitsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryReceivedDebitsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryReceivedDebitsIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryTransactionEntriesQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + effective_at: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + order_by: z.enum(["created", "effective_at"]).optional(), + starting_after: z.string().max(5000).optional(), + transaction: z.string().max(5000).optional(), + }) + + const getTreasuryTransactionEntriesRequestBodySchema = z.object({}).optional() + + const getTreasuryTransactionEntriesResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_transaction_entry)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/treasury/transaction_entries")), + }), + ], + ], + s_error, + ) + + // getTreasuryTransactionEntries + router.get( + `/v1/treasury/transaction_entries`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryTransactionEntriesQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryTransactionEntriesRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_transaction_entry[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryTransactionEntries(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryTransactionEntriesResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryTransactionEntriesIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getTreasuryTransactionEntriesIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryTransactionEntriesIdRequestBodySchema = z + .object({}) + .optional() + + const getTreasuryTransactionEntriesIdResponseBodyValidator = + responseValidationFactory([["200", s_treasury_transaction_entry]], s_error) + + // getTreasuryTransactionEntriesId + router.get( + `/v1/treasury/transaction_entries/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryTransactionEntriesIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryTransactionEntriesIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryTransactionEntriesIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryTransactionEntriesId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getTreasuryTransactionEntriesIdResponseBodyValidator(status, body), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryTransactionsQuerySchema = z.object({ + created: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + financial_account: z.string(), + limit: z.coerce.number().optional(), + order_by: z.enum(["created", "posted_at"]).optional(), + starting_after: z.string().max(5000).optional(), + status: z.enum(["open", "posted", "void"]).optional(), + status_transitions: z + .object({ + posted_at: z + .union([ + z.object({ + gt: z.coerce.number().optional(), + gte: z.coerce.number().optional(), + lt: z.coerce.number().optional(), + lte: z.coerce.number().optional(), + }), + z.coerce.number(), + ]) + .optional(), + }) + .optional(), + }) + + const getTreasuryTransactionsRequestBodySchema = z.object({}).optional() + + const getTreasuryTransactionsResponseBodyValidator = + responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(z.lazy(() => s_treasury_transaction)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + ], + ], + s_error, + ) + + // getTreasuryTransactions + router.get( + `/v1/treasury/transactions`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTreasuryTransactionsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryTransactionsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_treasury_transaction[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryTransactions(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTreasuryTransactionsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTreasuryTransactionsIdParamSchema = z.object({ + id: z.string().max(5000), + }) + + const getTreasuryTransactionsIdQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getTreasuryTransactionsIdRequestBodySchema = z.object({}).optional() + + const getTreasuryTransactionsIdResponseBodyValidator = + responseValidationFactory([["200", s_treasury_transaction]], s_error) + + // getTreasuryTransactionsId + router.get( + `/v1/treasury/transactions/:id`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTreasuryTransactionsIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getTreasuryTransactionsIdQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getTreasuryTransactionsIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTreasuryTransactionsId(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTreasuryTransactionsIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getWebhookEndpointsQuerySchema = z.object({ + ending_before: z.string().max(5000).optional(), + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + limit: z.coerce.number().optional(), + starting_after: z.string().max(5000).optional(), + }) + + const getWebhookEndpointsRequestBodySchema = z.object({}).optional() + + const getWebhookEndpointsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + data: z.array(s_webhook_endpoint), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/webhook_endpoints")), + }), + ], + ], + s_error, + ) + + // getWebhookEndpoints + router.get( + `/v1/webhook_endpoints`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getWebhookEndpointsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getWebhookEndpointsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + data: t_webhook_endpoint[] + has_more: boolean + object: "list" + url: string + }>(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getWebhookEndpoints(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getWebhookEndpointsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postWebhookEndpointsRequestBodySchema = z.object({ + api_version: z + .enum([ + "2011-01-01", + "2011-06-21", + "2011-06-28", + "2011-08-01", + "2011-09-15", + "2011-11-17", + "2012-02-23", + "2012-03-25", + "2012-06-18", + "2012-06-28", + "2012-07-09", + "2012-09-24", + "2012-10-26", + "2012-11-07", + "2013-02-11", + "2013-02-13", + "2013-07-05", + "2013-08-12", + "2013-08-13", + "2013-10-29", + "2013-12-03", + "2014-01-31", + "2014-03-13", + "2014-03-28", + "2014-05-19", + "2014-06-13", + "2014-06-17", + "2014-07-22", + "2014-07-26", + "2014-08-04", + "2014-08-20", + "2014-09-08", + "2014-10-07", + "2014-11-05", + "2014-11-20", + "2014-12-08", + "2014-12-17", + "2014-12-22", + "2015-01-11", + "2015-01-26", + "2015-02-10", + "2015-02-16", + "2015-02-18", + "2015-03-24", + "2015-04-07", + "2015-06-15", + "2015-07-07", + "2015-07-13", + "2015-07-28", + "2015-08-07", + "2015-08-19", + "2015-09-03", + "2015-09-08", + "2015-09-23", + "2015-10-01", + "2015-10-12", + "2015-10-16", + "2016-02-03", + "2016-02-19", + "2016-02-22", + "2016-02-23", + "2016-02-29", + "2016-03-07", + "2016-06-15", + "2016-07-06", + "2016-10-19", + "2017-01-27", + "2017-02-14", + "2017-04-06", + "2017-05-25", + "2017-06-05", + "2017-08-15", + "2017-12-14", + "2018-01-23", + "2018-02-05", + "2018-02-06", + "2018-02-28", + "2018-05-21", + "2018-07-27", + "2018-08-23", + "2018-09-06", + "2018-09-24", + "2018-10-31", + "2018-11-08", + "2019-02-11", + "2019-02-19", + "2019-03-14", + "2019-05-16", + "2019-08-14", + "2019-09-09", + "2019-10-08", + "2019-10-17", + "2019-11-05", + "2019-12-03", + "2020-03-02", + "2020-08-27", + "2022-08-01", + "2022-11-15", + "2023-08-16", + "2023-10-16", + "2024-04-10", + "2024-06-20", + "2024-09-30.acacia", + "2024-10-28.acacia", + "2024-11-20.acacia", + "2024-12-18.acacia", + "2025-01-27.acacia", + "2025-02-24.acacia", + "2025-03-01.dashboard", + "2025-03-31.basil", + ]) + .optional(), + connect: PermissiveBoolean.optional(), + description: z.union([z.string().max(5000), z.enum([""])]).optional(), + enabled_events: z.array( + z.enum([ + "*", + "account.application.authorized", + "account.application.deauthorized", + "account.external_account.created", + "account.external_account.deleted", + "account.external_account.updated", + "account.updated", + "application_fee.created", + "application_fee.refund.updated", + "application_fee.refunded", + "balance.available", + "billing.alert.triggered", + "billing_portal.configuration.created", + "billing_portal.configuration.updated", + "billing_portal.session.created", + "capability.updated", + "cash_balance.funds_available", + "charge.captured", + "charge.dispute.closed", + "charge.dispute.created", + "charge.dispute.funds_reinstated", + "charge.dispute.funds_withdrawn", + "charge.dispute.updated", + "charge.expired", + "charge.failed", + "charge.pending", + "charge.refund.updated", + "charge.refunded", + "charge.succeeded", + "charge.updated", + "checkout.session.async_payment_failed", + "checkout.session.async_payment_succeeded", + "checkout.session.completed", + "checkout.session.expired", + "climate.order.canceled", + "climate.order.created", + "climate.order.delayed", + "climate.order.delivered", + "climate.order.product_substituted", + "climate.product.created", + "climate.product.pricing_updated", + "coupon.created", + "coupon.deleted", + "coupon.updated", + "credit_note.created", + "credit_note.updated", + "credit_note.voided", + "customer.created", + "customer.deleted", + "customer.discount.created", + "customer.discount.deleted", + "customer.discount.updated", + "customer.source.created", + "customer.source.deleted", + "customer.source.expiring", + "customer.source.updated", + "customer.subscription.created", + "customer.subscription.deleted", + "customer.subscription.paused", + "customer.subscription.pending_update_applied", + "customer.subscription.pending_update_expired", + "customer.subscription.resumed", + "customer.subscription.trial_will_end", + "customer.subscription.updated", + "customer.tax_id.created", + "customer.tax_id.deleted", + "customer.tax_id.updated", + "customer.updated", + "customer_cash_balance_transaction.created", + "entitlements.active_entitlement_summary.updated", + "file.created", + "financial_connections.account.created", + "financial_connections.account.deactivated", + "financial_connections.account.disconnected", + "financial_connections.account.reactivated", + "financial_connections.account.refreshed_balance", + "financial_connections.account.refreshed_ownership", + "financial_connections.account.refreshed_transactions", + "identity.verification_session.canceled", + "identity.verification_session.created", + "identity.verification_session.processing", + "identity.verification_session.redacted", + "identity.verification_session.requires_input", + "identity.verification_session.verified", + "invoice.created", + "invoice.deleted", + "invoice.finalization_failed", + "invoice.finalized", + "invoice.marked_uncollectible", + "invoice.overdue", + "invoice.overpaid", + "invoice.paid", + "invoice.payment_action_required", + "invoice.payment_failed", + "invoice.payment_succeeded", + "invoice.sent", + "invoice.upcoming", + "invoice.updated", + "invoice.voided", + "invoice.will_be_due", + "invoiceitem.created", + "invoiceitem.deleted", + "issuing_authorization.created", + "issuing_authorization.request", + "issuing_authorization.updated", + "issuing_card.created", + "issuing_card.updated", + "issuing_cardholder.created", + "issuing_cardholder.updated", + "issuing_dispute.closed", + "issuing_dispute.created", + "issuing_dispute.funds_reinstated", + "issuing_dispute.funds_rescinded", + "issuing_dispute.submitted", + "issuing_dispute.updated", + "issuing_personalization_design.activated", + "issuing_personalization_design.deactivated", + "issuing_personalization_design.rejected", + "issuing_personalization_design.updated", + "issuing_token.created", + "issuing_token.updated", + "issuing_transaction.created", + "issuing_transaction.purchase_details_receipt_updated", + "issuing_transaction.updated", + "mandate.updated", + "payment_intent.amount_capturable_updated", + "payment_intent.canceled", + "payment_intent.created", + "payment_intent.partially_funded", + "payment_intent.payment_failed", + "payment_intent.processing", + "payment_intent.requires_action", + "payment_intent.succeeded", + "payment_link.created", + "payment_link.updated", + "payment_method.attached", + "payment_method.automatically_updated", + "payment_method.detached", + "payment_method.updated", + "payout.canceled", + "payout.created", + "payout.failed", + "payout.paid", + "payout.reconciliation_completed", + "payout.updated", + "person.created", + "person.deleted", + "person.updated", + "plan.created", + "plan.deleted", + "plan.updated", + "price.created", + "price.deleted", + "price.updated", + "product.created", + "product.deleted", + "product.updated", + "promotion_code.created", + "promotion_code.updated", + "quote.accepted", + "quote.canceled", + "quote.created", + "quote.finalized", + "radar.early_fraud_warning.created", + "radar.early_fraud_warning.updated", + "refund.created", + "refund.failed", + "refund.updated", + "reporting.report_run.failed", + "reporting.report_run.succeeded", + "reporting.report_type.updated", + "review.closed", + "review.opened", + "setup_intent.canceled", + "setup_intent.created", + "setup_intent.requires_action", + "setup_intent.setup_failed", + "setup_intent.succeeded", + "sigma.scheduled_query_run.created", + "source.canceled", + "source.chargeable", + "source.failed", + "source.mandate_notification", + "source.refund_attributes_required", + "source.transaction.created", + "source.transaction.updated", + "subscription_schedule.aborted", + "subscription_schedule.canceled", + "subscription_schedule.completed", + "subscription_schedule.created", + "subscription_schedule.expiring", + "subscription_schedule.released", + "subscription_schedule.updated", + "tax.settings.updated", + "tax_rate.created", + "tax_rate.updated", + "terminal.reader.action_failed", + "terminal.reader.action_succeeded", + "test_helpers.test_clock.advancing", + "test_helpers.test_clock.created", + "test_helpers.test_clock.deleted", + "test_helpers.test_clock.internal_failure", + "test_helpers.test_clock.ready", + "topup.canceled", + "topup.created", + "topup.failed", + "topup.reversed", + "topup.succeeded", + "transfer.created", + "transfer.reversed", + "transfer.updated", + "treasury.credit_reversal.created", + "treasury.credit_reversal.posted", + "treasury.debit_reversal.completed", + "treasury.debit_reversal.created", + "treasury.debit_reversal.initial_credit_granted", + "treasury.financial_account.closed", + "treasury.financial_account.created", + "treasury.financial_account.features_status_updated", + "treasury.inbound_transfer.canceled", + "treasury.inbound_transfer.created", + "treasury.inbound_transfer.failed", + "treasury.inbound_transfer.succeeded", + "treasury.outbound_payment.canceled", + "treasury.outbound_payment.created", + "treasury.outbound_payment.expected_arrival_date_updated", + "treasury.outbound_payment.failed", + "treasury.outbound_payment.posted", + "treasury.outbound_payment.returned", + "treasury.outbound_payment.tracking_details_updated", + "treasury.outbound_transfer.canceled", + "treasury.outbound_transfer.created", + "treasury.outbound_transfer.expected_arrival_date_updated", + "treasury.outbound_transfer.failed", + "treasury.outbound_transfer.posted", + "treasury.outbound_transfer.returned", + "treasury.outbound_transfer.tracking_details_updated", + "treasury.received_credit.created", + "treasury.received_credit.failed", + "treasury.received_credit.succeeded", + "treasury.received_debit.created", + ]), + ), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + url: z.string(), + }) + + const postWebhookEndpointsResponseBodyValidator = responseValidationFactory( + [["200", s_webhook_endpoint]], + s_error, + ) + + // postWebhookEndpoints + router.post( + `/v1/webhook_endpoints`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + postWebhookEndpointsRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postWebhookEndpoints(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(postWebhookEndpointsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteWebhookEndpointsWebhookEndpointParamSchema = z.object({ + webhook_endpoint: z.string().max(5000), + }) + + const deleteWebhookEndpointsWebhookEndpointRequestBodySchema = z + .object({}) + .optional() + + const deleteWebhookEndpointsWebhookEndpointResponseBodyValidator = + responseValidationFactory([["200", s_deleted_webhook_endpoint]], s_error) + + // deleteWebhookEndpointsWebhookEndpoint + router.delete( + `/v1/webhook_endpoints/:webhook_endpoint`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteWebhookEndpointsWebhookEndpointParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + deleteWebhookEndpointsWebhookEndpointRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteWebhookEndpointsWebhookEndpoint( + input, + responder, + req, + res, + next, + ) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + deleteWebhookEndpointsWebhookEndpointResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getWebhookEndpointsWebhookEndpointParamSchema = z.object({ + webhook_endpoint: z.string().max(5000), + }) + + const getWebhookEndpointsWebhookEndpointQuerySchema = z.object({ + expand: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string().max(5000)), + ) + .optional(), + }) + + const getWebhookEndpointsWebhookEndpointRequestBodySchema = z + .object({}) + .optional() + + const getWebhookEndpointsWebhookEndpointResponseBodyValidator = + responseValidationFactory([["200", s_webhook_endpoint]], s_error) + + // getWebhookEndpointsWebhookEndpoint + router.get( + `/v1/webhook_endpoints/:webhook_endpoint`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getWebhookEndpointsWebhookEndpointParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: parseRequestInput( + getWebhookEndpointsWebhookEndpointQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: parseRequestInput( + getWebhookEndpointsWebhookEndpointRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getWebhookEndpointsWebhookEndpoint(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + getWebhookEndpointsWebhookEndpointResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const postWebhookEndpointsWebhookEndpointParamSchema = z.object({ + webhook_endpoint: z.string().max(5000), + }) + + const postWebhookEndpointsWebhookEndpointRequestBodySchema = z + .object({ + description: z.union([z.string().max(5000), z.enum([""])]).optional(), + disabled: PermissiveBoolean.optional(), + enabled_events: z + .array( + z.enum([ + "*", + "account.application.authorized", + "account.application.deauthorized", + "account.external_account.created", + "account.external_account.deleted", + "account.external_account.updated", + "account.updated", + "application_fee.created", + "application_fee.refund.updated", + "application_fee.refunded", + "balance.available", + "billing.alert.triggered", + "billing_portal.configuration.created", + "billing_portal.configuration.updated", + "billing_portal.session.created", + "capability.updated", + "cash_balance.funds_available", + "charge.captured", + "charge.dispute.closed", + "charge.dispute.created", + "charge.dispute.funds_reinstated", + "charge.dispute.funds_withdrawn", + "charge.dispute.updated", + "charge.expired", + "charge.failed", + "charge.pending", + "charge.refund.updated", + "charge.refunded", + "charge.succeeded", + "charge.updated", + "checkout.session.async_payment_failed", + "checkout.session.async_payment_succeeded", + "checkout.session.completed", + "checkout.session.expired", + "climate.order.canceled", + "climate.order.created", + "climate.order.delayed", + "climate.order.delivered", + "climate.order.product_substituted", + "climate.product.created", + "climate.product.pricing_updated", + "coupon.created", + "coupon.deleted", + "coupon.updated", + "credit_note.created", + "credit_note.updated", + "credit_note.voided", + "customer.created", + "customer.deleted", + "customer.discount.created", + "customer.discount.deleted", + "customer.discount.updated", + "customer.source.created", + "customer.source.deleted", + "customer.source.expiring", + "customer.source.updated", + "customer.subscription.created", + "customer.subscription.deleted", + "customer.subscription.paused", + "customer.subscription.pending_update_applied", + "customer.subscription.pending_update_expired", + "customer.subscription.resumed", + "customer.subscription.trial_will_end", + "customer.subscription.updated", + "customer.tax_id.created", + "customer.tax_id.deleted", + "customer.tax_id.updated", + "customer.updated", + "customer_cash_balance_transaction.created", + "entitlements.active_entitlement_summary.updated", + "file.created", + "financial_connections.account.created", + "financial_connections.account.deactivated", + "financial_connections.account.disconnected", + "financial_connections.account.reactivated", + "financial_connections.account.refreshed_balance", + "financial_connections.account.refreshed_ownership", + "financial_connections.account.refreshed_transactions", + "identity.verification_session.canceled", + "identity.verification_session.created", + "identity.verification_session.processing", + "identity.verification_session.redacted", + "identity.verification_session.requires_input", + "identity.verification_session.verified", + "invoice.created", + "invoice.deleted", + "invoice.finalization_failed", + "invoice.finalized", + "invoice.marked_uncollectible", + "invoice.overdue", + "invoice.overpaid", + "invoice.paid", + "invoice.payment_action_required", + "invoice.payment_failed", + "invoice.payment_succeeded", + "invoice.sent", + "invoice.upcoming", + "invoice.updated", + "invoice.voided", + "invoice.will_be_due", + "invoiceitem.created", + "invoiceitem.deleted", + "issuing_authorization.created", + "issuing_authorization.request", + "issuing_authorization.updated", + "issuing_card.created", + "issuing_card.updated", + "issuing_cardholder.created", + "issuing_cardholder.updated", + "issuing_dispute.closed", + "issuing_dispute.created", + "issuing_dispute.funds_reinstated", + "issuing_dispute.funds_rescinded", + "issuing_dispute.submitted", + "issuing_dispute.updated", + "issuing_personalization_design.activated", + "issuing_personalization_design.deactivated", + "issuing_personalization_design.rejected", + "issuing_personalization_design.updated", + "issuing_token.created", + "issuing_token.updated", + "issuing_transaction.created", + "issuing_transaction.purchase_details_receipt_updated", + "issuing_transaction.updated", + "mandate.updated", + "payment_intent.amount_capturable_updated", + "payment_intent.canceled", + "payment_intent.created", + "payment_intent.partially_funded", + "payment_intent.payment_failed", + "payment_intent.processing", + "payment_intent.requires_action", + "payment_intent.succeeded", + "payment_link.created", + "payment_link.updated", + "payment_method.attached", + "payment_method.automatically_updated", + "payment_method.detached", + "payment_method.updated", + "payout.canceled", + "payout.created", + "payout.failed", + "payout.paid", + "payout.reconciliation_completed", + "payout.updated", + "person.created", + "person.deleted", + "person.updated", + "plan.created", + "plan.deleted", + "plan.updated", + "price.created", + "price.deleted", + "price.updated", + "product.created", + "product.deleted", + "product.updated", + "promotion_code.created", + "promotion_code.updated", + "quote.accepted", + "quote.canceled", + "quote.created", + "quote.finalized", + "radar.early_fraud_warning.created", + "radar.early_fraud_warning.updated", + "refund.created", + "refund.failed", + "refund.updated", + "reporting.report_run.failed", + "reporting.report_run.succeeded", + "reporting.report_type.updated", + "review.closed", + "review.opened", + "setup_intent.canceled", + "setup_intent.created", + "setup_intent.requires_action", + "setup_intent.setup_failed", + "setup_intent.succeeded", + "sigma.scheduled_query_run.created", + "source.canceled", + "source.chargeable", + "source.failed", + "source.mandate_notification", + "source.refund_attributes_required", + "source.transaction.created", + "source.transaction.updated", + "subscription_schedule.aborted", + "subscription_schedule.canceled", + "subscription_schedule.completed", + "subscription_schedule.created", + "subscription_schedule.expiring", + "subscription_schedule.released", + "subscription_schedule.updated", + "tax.settings.updated", + "tax_rate.created", + "tax_rate.updated", + "terminal.reader.action_failed", + "terminal.reader.action_succeeded", + "test_helpers.test_clock.advancing", + "test_helpers.test_clock.created", + "test_helpers.test_clock.deleted", + "test_helpers.test_clock.internal_failure", + "test_helpers.test_clock.ready", + "topup.canceled", + "topup.created", + "topup.failed", + "topup.reversed", + "topup.succeeded", + "transfer.created", + "transfer.reversed", + "transfer.updated", + "treasury.credit_reversal.created", + "treasury.credit_reversal.posted", + "treasury.debit_reversal.completed", + "treasury.debit_reversal.created", + "treasury.debit_reversal.initial_credit_granted", + "treasury.financial_account.closed", + "treasury.financial_account.created", + "treasury.financial_account.features_status_updated", + "treasury.inbound_transfer.canceled", + "treasury.inbound_transfer.created", + "treasury.inbound_transfer.failed", + "treasury.inbound_transfer.succeeded", + "treasury.outbound_payment.canceled", + "treasury.outbound_payment.created", + "treasury.outbound_payment.expected_arrival_date_updated", + "treasury.outbound_payment.failed", + "treasury.outbound_payment.posted", + "treasury.outbound_payment.returned", + "treasury.outbound_payment.tracking_details_updated", + "treasury.outbound_transfer.canceled", + "treasury.outbound_transfer.created", + "treasury.outbound_transfer.expected_arrival_date_updated", + "treasury.outbound_transfer.failed", + "treasury.outbound_transfer.posted", + "treasury.outbound_transfer.returned", + "treasury.outbound_transfer.tracking_details_updated", + "treasury.received_credit.created", + "treasury.received_credit.failed", + "treasury.received_credit.succeeded", + "treasury.received_debit.created", + ]), + ) + .optional(), + expand: z.array(z.string().max(5000)).optional(), + metadata: z.union([z.record(z.string()), z.enum([""])]).optional(), + url: z.string().optional(), + }) + .optional() + + const postWebhookEndpointsWebhookEndpointResponseBodyValidator = + responseValidationFactory([["200", s_webhook_endpoint]], s_error) + + // postWebhookEndpointsWebhookEndpoint + router.post( + `/v1/webhook_endpoints/:webhook_endpoint`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + postWebhookEndpointsWebhookEndpointParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + postWebhookEndpointsWebhookEndpointRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .postWebhookEndpointsWebhookEndpoint(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json( + postWebhookEndpointsWebhookEndpointResponseBodyValidator( + status, + body, + ), + ) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export async function bootstrap(config: ServerConfig) { + // Stripe API + return startServer(config) +} diff --git a/integration-tests/typescript-express/src/generated/stripe.yaml/models.ts b/integration-tests/typescript-express/src/generated/stripe.yaml/models.ts new file mode 100644 index 000000000..d6d33eb5d --- /dev/null +++ b/integration-tests/typescript-express/src/generated/stripe.yaml/models.ts @@ -0,0 +1,47554 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type EmptyObject = { [key: string]: never } + +export type t_account = { + business_profile?: (t_account_business_profile | null) | undefined + business_type?: + | ("company" | "government_entity" | "individual" | "non_profit" | null) + | undefined + capabilities?: t_account_capabilities | undefined + charges_enabled?: boolean | undefined + company?: t_legal_entity_company | undefined + controller?: t_account_unification_account_controller | undefined + country?: string | undefined + created?: number | undefined + default_currency?: string | undefined + details_submitted?: boolean | undefined + email?: (string | null) | undefined + external_accounts?: + | { + data: (t_bank_account | t_card)[] + has_more: boolean + object: "list" + url: string + } + | undefined + future_requirements?: t_account_future_requirements | undefined + groups?: (t_account_group_membership | null) | undefined + id: string + individual?: t_person | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + object: "account" + payouts_enabled?: boolean | undefined + requirements?: t_account_requirements | undefined + settings?: (t_account_settings | null) | undefined + tos_acceptance?: t_account_tos_acceptance | undefined + type?: ("custom" | "express" | "none" | "standard") | undefined +} + +export type t_account_annual_revenue = { + amount?: (number | null) | undefined + currency?: (string | null) | undefined + fiscal_year_end?: (string | null) | undefined +} + +export type t_account_bacs_debit_payments_settings = { + display_name?: (string | null) | undefined + service_user_number?: (string | null) | undefined +} + +export type t_account_branding_settings = { + icon?: (string | t_file | null) | undefined + logo?: (string | t_file | null) | undefined + primary_color?: (string | null) | undefined + secondary_color?: (string | null) | undefined +} + +export type t_account_business_profile = { + annual_revenue?: (t_account_annual_revenue | null) | undefined + estimated_worker_count?: (number | null) | undefined + mcc?: (string | null) | undefined + monthly_estimated_revenue?: t_account_monthly_estimated_revenue | undefined + name?: (string | null) | undefined + product_description?: (string | null) | undefined + support_address?: (t_address | null) | undefined + support_email?: (string | null) | undefined + support_phone?: (string | null) | undefined + support_url?: (string | null) | undefined + url?: (string | null) | undefined +} + +export type t_account_capabilities = { + acss_debit_payments?: ("active" | "inactive" | "pending") | undefined + affirm_payments?: ("active" | "inactive" | "pending") | undefined + afterpay_clearpay_payments?: ("active" | "inactive" | "pending") | undefined + alma_payments?: ("active" | "inactive" | "pending") | undefined + amazon_pay_payments?: ("active" | "inactive" | "pending") | undefined + au_becs_debit_payments?: ("active" | "inactive" | "pending") | undefined + bacs_debit_payments?: ("active" | "inactive" | "pending") | undefined + bancontact_payments?: ("active" | "inactive" | "pending") | undefined + bank_transfer_payments?: ("active" | "inactive" | "pending") | undefined + billie_payments?: ("active" | "inactive" | "pending") | undefined + blik_payments?: ("active" | "inactive" | "pending") | undefined + boleto_payments?: ("active" | "inactive" | "pending") | undefined + card_issuing?: ("active" | "inactive" | "pending") | undefined + card_payments?: ("active" | "inactive" | "pending") | undefined + cartes_bancaires_payments?: ("active" | "inactive" | "pending") | undefined + cashapp_payments?: ("active" | "inactive" | "pending") | undefined + eps_payments?: ("active" | "inactive" | "pending") | undefined + fpx_payments?: ("active" | "inactive" | "pending") | undefined + gb_bank_transfer_payments?: ("active" | "inactive" | "pending") | undefined + giropay_payments?: ("active" | "inactive" | "pending") | undefined + grabpay_payments?: ("active" | "inactive" | "pending") | undefined + ideal_payments?: ("active" | "inactive" | "pending") | undefined + india_international_payments?: ("active" | "inactive" | "pending") | undefined + jcb_payments?: ("active" | "inactive" | "pending") | undefined + jp_bank_transfer_payments?: ("active" | "inactive" | "pending") | undefined + kakao_pay_payments?: ("active" | "inactive" | "pending") | undefined + klarna_payments?: ("active" | "inactive" | "pending") | undefined + konbini_payments?: ("active" | "inactive" | "pending") | undefined + kr_card_payments?: ("active" | "inactive" | "pending") | undefined + legacy_payments?: ("active" | "inactive" | "pending") | undefined + link_payments?: ("active" | "inactive" | "pending") | undefined + mobilepay_payments?: ("active" | "inactive" | "pending") | undefined + multibanco_payments?: ("active" | "inactive" | "pending") | undefined + mx_bank_transfer_payments?: ("active" | "inactive" | "pending") | undefined + naver_pay_payments?: ("active" | "inactive" | "pending") | undefined + nz_bank_account_becs_debit_payments?: + | ("active" | "inactive" | "pending") + | undefined + oxxo_payments?: ("active" | "inactive" | "pending") | undefined + p24_payments?: ("active" | "inactive" | "pending") | undefined + pay_by_bank_payments?: ("active" | "inactive" | "pending") | undefined + payco_payments?: ("active" | "inactive" | "pending") | undefined + paynow_payments?: ("active" | "inactive" | "pending") | undefined + promptpay_payments?: ("active" | "inactive" | "pending") | undefined + revolut_pay_payments?: ("active" | "inactive" | "pending") | undefined + samsung_pay_payments?: ("active" | "inactive" | "pending") | undefined + satispay_payments?: ("active" | "inactive" | "pending") | undefined + sepa_bank_transfer_payments?: ("active" | "inactive" | "pending") | undefined + sepa_debit_payments?: ("active" | "inactive" | "pending") | undefined + sofort_payments?: ("active" | "inactive" | "pending") | undefined + swish_payments?: ("active" | "inactive" | "pending") | undefined + tax_reporting_us_1099_k?: ("active" | "inactive" | "pending") | undefined + tax_reporting_us_1099_misc?: ("active" | "inactive" | "pending") | undefined + transfers?: ("active" | "inactive" | "pending") | undefined + treasury?: ("active" | "inactive" | "pending") | undefined + twint_payments?: ("active" | "inactive" | "pending") | undefined + us_bank_account_ach_payments?: ("active" | "inactive" | "pending") | undefined + us_bank_transfer_payments?: ("active" | "inactive" | "pending") | undefined + zip_payments?: ("active" | "inactive" | "pending") | undefined +} + +export type t_account_capability_future_requirements = { + alternatives?: (t_account_requirements_alternative[] | null) | undefined + current_deadline?: (number | null) | undefined + currently_due: string[] + disabled_reason?: + | ( + | "other" + | "paused.inactivity" + | "pending.onboarding" + | "pending.review" + | "platform_disabled" + | "platform_paused" + | "rejected.inactivity" + | "rejected.other" + | "rejected.unsupported_business" + | "requirements.fields_needed" + | null + ) + | undefined + errors: t_account_requirements_error[] + eventually_due: string[] + past_due: string[] + pending_verification: string[] +} + +export type t_account_capability_requirements = { + alternatives?: (t_account_requirements_alternative[] | null) | undefined + current_deadline?: (number | null) | undefined + currently_due: string[] + disabled_reason?: + | ( + | "other" + | "paused.inactivity" + | "pending.onboarding" + | "pending.review" + | "platform_disabled" + | "platform_paused" + | "rejected.inactivity" + | "rejected.other" + | "rejected.unsupported_business" + | "requirements.fields_needed" + | null + ) + | undefined + errors: t_account_requirements_error[] + eventually_due: string[] + past_due: string[] + pending_verification: string[] +} + +export type t_account_card_issuing_settings = { + tos_acceptance?: t_card_issuing_account_terms_of_service | undefined +} + +export type t_account_card_payments_settings = { + decline_on?: t_account_decline_charge_on | undefined + statement_descriptor_prefix?: (string | null) | undefined + statement_descriptor_prefix_kana?: (string | null) | undefined + statement_descriptor_prefix_kanji?: (string | null) | undefined +} + +export type t_account_dashboard_settings = { + display_name?: (string | null) | undefined + timezone?: (string | null) | undefined +} + +export type t_account_decline_charge_on = { + avs_failure: boolean + cvc_failure: boolean +} + +export type t_account_future_requirements = { + alternatives?: (t_account_requirements_alternative[] | null) | undefined + current_deadline?: (number | null) | undefined + currently_due?: (string[] | null) | undefined + disabled_reason?: + | ( + | "action_required.requested_capabilities" + | "listed" + | "other" + | "platform_paused" + | "rejected.fraud" + | "rejected.incomplete_verification" + | "rejected.listed" + | "rejected.other" + | "rejected.platform_fraud" + | "rejected.platform_other" + | "rejected.platform_terms_of_service" + | "rejected.terms_of_service" + | "requirements.past_due" + | "requirements.pending_verification" + | "under_review" + | null + ) + | undefined + errors?: (t_account_requirements_error[] | null) | undefined + eventually_due?: (string[] | null) | undefined + past_due?: (string[] | null) | undefined + pending_verification?: (string[] | null) | undefined +} + +export type t_account_group_membership = { + payments_pricing?: (string | null) | undefined +} + +export type t_account_invoices_settings = { + default_account_tax_ids?: ((string | t_tax_id)[] | null) | undefined + hosted_payment_method_save?: ("always" | "never" | "offer" | null) | undefined +} + +export type t_account_link = { + created: number + expires_at: number + object: "account_link" + url: string +} + +export type t_account_monthly_estimated_revenue = { + amount: number + currency: string +} + +export type t_account_payments_settings = { + statement_descriptor?: (string | null) | undefined + statement_descriptor_kana?: (string | null) | undefined + statement_descriptor_kanji?: (string | null) | undefined +} + +export type t_account_payout_settings = { + debit_negative_balances: boolean + schedule: t_transfer_schedule + statement_descriptor?: (string | null) | undefined +} + +export type t_account_requirements = { + alternatives?: (t_account_requirements_alternative[] | null) | undefined + current_deadline?: (number | null) | undefined + currently_due?: (string[] | null) | undefined + disabled_reason?: + | ( + | "action_required.requested_capabilities" + | "listed" + | "other" + | "platform_paused" + | "rejected.fraud" + | "rejected.incomplete_verification" + | "rejected.listed" + | "rejected.other" + | "rejected.platform_fraud" + | "rejected.platform_other" + | "rejected.platform_terms_of_service" + | "rejected.terms_of_service" + | "requirements.past_due" + | "requirements.pending_verification" + | "under_review" + | null + ) + | undefined + errors?: (t_account_requirements_error[] | null) | undefined + eventually_due?: (string[] | null) | undefined + past_due?: (string[] | null) | undefined + pending_verification?: (string[] | null) | undefined +} + +export type t_account_requirements_alternative = { + alternative_fields_due: string[] + original_fields_due: string[] +} + +export type t_account_requirements_error = { + code: + | "information_missing" + | "invalid_address_city_state_postal_code" + | "invalid_address_highway_contract_box" + | "invalid_address_private_mailbox" + | "invalid_business_profile_name" + | "invalid_business_profile_name_denylisted" + | "invalid_company_name_denylisted" + | "invalid_dob_age_over_maximum" + | "invalid_dob_age_under_18" + | "invalid_dob_age_under_minimum" + | "invalid_product_description_length" + | "invalid_product_description_url_match" + | "invalid_representative_country" + | "invalid_signator" + | "invalid_statement_descriptor_business_mismatch" + | "invalid_statement_descriptor_denylisted" + | "invalid_statement_descriptor_length" + | "invalid_statement_descriptor_prefix_denylisted" + | "invalid_statement_descriptor_prefix_mismatch" + | "invalid_street_address" + | "invalid_tax_id" + | "invalid_tax_id_format" + | "invalid_tos_acceptance" + | "invalid_url_denylisted" + | "invalid_url_format" + | "invalid_url_web_presence_detected" + | "invalid_url_website_business_information_mismatch" + | "invalid_url_website_empty" + | "invalid_url_website_inaccessible" + | "invalid_url_website_inaccessible_geoblocked" + | "invalid_url_website_inaccessible_password_protected" + | "invalid_url_website_incomplete" + | "invalid_url_website_incomplete_cancellation_policy" + | "invalid_url_website_incomplete_customer_service_details" + | "invalid_url_website_incomplete_legal_restrictions" + | "invalid_url_website_incomplete_refund_policy" + | "invalid_url_website_incomplete_return_policy" + | "invalid_url_website_incomplete_terms_and_conditions" + | "invalid_url_website_incomplete_under_construction" + | "invalid_url_website_other" + | "invalid_value_other" + | "verification_directors_mismatch" + | "verification_document_address_mismatch" + | "verification_document_address_missing" + | "verification_document_corrupt" + | "verification_document_country_not_supported" + | "verification_document_directors_mismatch" + | "verification_document_dob_mismatch" + | "verification_document_duplicate_type" + | "verification_document_expired" + | "verification_document_failed_copy" + | "verification_document_failed_greyscale" + | "verification_document_failed_other" + | "verification_document_failed_test_mode" + | "verification_document_fraudulent" + | "verification_document_id_number_mismatch" + | "verification_document_id_number_missing" + | "verification_document_incomplete" + | "verification_document_invalid" + | "verification_document_issue_or_expiry_date_missing" + | "verification_document_manipulated" + | "verification_document_missing_back" + | "verification_document_missing_front" + | "verification_document_name_mismatch" + | "verification_document_name_missing" + | "verification_document_nationality_mismatch" + | "verification_document_not_readable" + | "verification_document_not_signed" + | "verification_document_not_uploaded" + | "verification_document_photo_mismatch" + | "verification_document_too_large" + | "verification_document_type_not_supported" + | "verification_extraneous_directors" + | "verification_failed_address_match" + | "verification_failed_authorizer_authority" + | "verification_failed_business_iec_number" + | "verification_failed_document_match" + | "verification_failed_id_number_match" + | "verification_failed_keyed_identity" + | "verification_failed_keyed_match" + | "verification_failed_name_match" + | "verification_failed_other" + | "verification_failed_representative_authority" + | "verification_failed_residential_address" + | "verification_failed_tax_id_match" + | "verification_failed_tax_id_not_issued" + | "verification_missing_directors" + | "verification_missing_executives" + | "verification_missing_owners" + | "verification_rejected_ownership_exemption_reason" + | "verification_requires_additional_memorandum_of_associations" + | "verification_requires_additional_proof_of_registration" + | "verification_supportability" + reason: string + requirement: string +} + +export type t_account_sepa_debit_payments_settings = { + creditor_id?: string | undefined +} + +export type t_account_session = { + account: string + client_secret: string + components: t_connect_embedded_account_session_create_components + expires_at: number + livemode: boolean + object: "account_session" +} + +export type t_account_settings = { + bacs_debit_payments?: t_account_bacs_debit_payments_settings | undefined + branding: t_account_branding_settings + card_issuing?: t_account_card_issuing_settings | undefined + card_payments: t_account_card_payments_settings + dashboard: t_account_dashboard_settings + invoices?: t_account_invoices_settings | undefined + payments: t_account_payments_settings + payouts?: t_account_payout_settings | undefined + sepa_debit_payments?: t_account_sepa_debit_payments_settings | undefined + treasury?: t_account_treasury_settings | undefined +} + +export type t_account_terms_of_service = { + date?: (number | null) | undefined + ip?: (string | null) | undefined + user_agent?: string | undefined +} + +export type t_account_tos_acceptance = { + date?: (number | null) | undefined + ip?: (string | null) | undefined + service_agreement?: string | undefined + user_agent?: (string | null) | undefined +} + +export type t_account_treasury_settings = { + tos_acceptance?: t_account_terms_of_service | undefined +} + +export type t_account_unification_account_controller = { + fees?: t_account_unification_account_controller_fees | undefined + is_controller?: boolean | undefined + losses?: t_account_unification_account_controller_losses | undefined + requirement_collection?: ("application" | "stripe") | undefined + stripe_dashboard?: + | t_account_unification_account_controller_stripe_dashboard + | undefined + type: "account" | "application" +} + +export type t_account_unification_account_controller_fees = { + payer: + | "account" + | "application" + | "application_custom" + | "application_express" +} + +export type t_account_unification_account_controller_losses = { + payments: "application" | "stripe" +} + +export type t_account_unification_account_controller_stripe_dashboard = { + type: "express" | "full" | "none" +} + +export type t_address = { + city?: (string | null) | undefined + country?: (string | null) | undefined + line1?: (string | null) | undefined + line2?: (string | null) | undefined + postal_code?: (string | null) | undefined + state?: (string | null) | undefined +} + +export type t_amazon_pay_underlying_payment_method_funding_details = { + card?: t_payment_method_details_passthrough_card | undefined + type?: ("card" | null) | undefined +} + +export type t_api_errors = { + advice_code?: string | undefined + charge?: string | undefined + code?: string | undefined + decline_code?: string | undefined + doc_url?: string | undefined + message?: string | undefined + network_advice_code?: string | undefined + network_decline_code?: string | undefined + param?: string | undefined + payment_intent?: t_payment_intent | undefined + payment_method?: t_payment_method | undefined + payment_method_type?: string | undefined + request_log_url?: string | undefined + setup_intent?: t_setup_intent | undefined + source?: (t_bank_account | t_card | t_source) | undefined + type: + | "api_error" + | "card_error" + | "idempotency_error" + | "invalid_request_error" +} + +export type t_apple_pay_domain = { + created: number + domain_name: string + id: string + livemode: boolean + object: "apple_pay_domain" +} + +export type t_application = { + id: string + name?: (string | null) | undefined + object: "application" +} + +export type t_application_fee = { + account: string | t_account + amount: number + amount_refunded: number + application: string | t_application + balance_transaction?: (string | t_balance_transaction | null) | undefined + charge: string | t_charge + created: number + currency: string + fee_source?: (t_platform_earning_fee_source | null) | undefined + id: string + livemode: boolean + object: "application_fee" + originating_transaction?: (string | t_charge | null) | undefined + refunded: boolean + refunds: { + data: t_fee_refund[] + has_more: boolean + object: "list" + url: string + } +} + +export type t_apps_secret = { + created: number + deleted?: boolean | undefined + expires_at?: (number | null) | undefined + id: string + livemode: boolean + name: string + object: "apps.secret" + payload?: (string | null) | undefined + scope: t_secret_service_resource_scope +} + +export type t_automatic_tax = { + disabled_reason?: + | ( + | "finalization_requires_location_inputs" + | "finalization_system_error" + | null + ) + | undefined + enabled: boolean + liability?: (t_connect_account_reference | null) | undefined + status?: + | ("complete" | "failed" | "requires_location_inputs" | null) + | undefined +} + +export type t_balance = { + available: t_balance_amount[] + connect_reserved?: t_balance_amount[] | undefined + instant_available?: t_balance_amount_net[] | undefined + issuing?: t_balance_detail | undefined + livemode: boolean + object: "balance" + pending: t_balance_amount[] +} + +export type t_balance_amount = { + amount: number + currency: string + source_types?: t_balance_amount_by_source_type | undefined +} + +export type t_balance_amount_by_source_type = { + bank_account?: number | undefined + card?: number | undefined + fpx?: number | undefined +} + +export type t_balance_amount_net = { + amount: number + currency: string + net_available?: t_balance_net_available[] | undefined + source_types?: t_balance_amount_by_source_type | undefined +} + +export type t_balance_detail = { + available: t_balance_amount[] +} + +export type t_balance_net_available = { + amount: number + destination: string + source_types?: t_balance_amount_by_source_type | undefined +} + +export type t_balance_transaction = { + amount: number + available_on: number + created: number + currency: string + description?: (string | null) | undefined + exchange_rate?: (number | null) | undefined + fee: number + fee_details: t_fee[] + id: string + net: number + object: "balance_transaction" + reporting_category: string + source?: + | ( + | string + | t_application_fee + | t_charge + | t_connect_collection_transfer + | t_customer_cash_balance_transaction + | t_dispute + | t_fee_refund + | t_issuing_authorization + | t_issuing_dispute + | t_issuing_transaction + | t_payout + | t_refund + | t_reserve_transaction + | t_tax_deducted_at_source + | t_topup + | t_transfer + | t_transfer_reversal + | null + ) + | undefined + status: string + type: + | "adjustment" + | "advance" + | "advance_funding" + | "anticipation_repayment" + | "application_fee" + | "application_fee_refund" + | "charge" + | "climate_order_purchase" + | "climate_order_refund" + | "connect_collection_transfer" + | "contribution" + | "issuing_authorization_hold" + | "issuing_authorization_release" + | "issuing_dispute" + | "issuing_transaction" + | "obligation_outbound" + | "obligation_reversal_inbound" + | "payment" + | "payment_failure_refund" + | "payment_network_reserve_hold" + | "payment_network_reserve_release" + | "payment_refund" + | "payment_reversal" + | "payment_unreconciled" + | "payout" + | "payout_cancel" + | "payout_failure" + | "payout_minimum_balance_hold" + | "payout_minimum_balance_release" + | "refund" + | "refund_failure" + | "reserve_transaction" + | "reserved_funds" + | "stripe_balance_payment_debit" + | "stripe_balance_payment_debit_reversal" + | "stripe_fee" + | "stripe_fx_fee" + | "tax_fee" + | "topup" + | "topup_reversal" + | "transfer" + | "transfer_cancel" + | "transfer_failure" + | "transfer_refund" +} + +export type t_bank_account = { + account?: (string | t_account | null) | undefined + account_holder_name?: (string | null) | undefined + account_holder_type?: (string | null) | undefined + account_type?: (string | null) | undefined + available_payout_methods?: (("instant" | "standard")[] | null) | undefined + bank_name?: (string | null) | undefined + country: string + currency: string + customer?: (string | t_customer | t_deleted_customer | null) | undefined + default_for_currency?: (boolean | null) | undefined + fingerprint?: (string | null) | undefined + future_requirements?: (t_external_account_requirements | null) | undefined + id: string + last4: string + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "bank_account" + requirements?: (t_external_account_requirements | null) | undefined + routing_number?: (string | null) | undefined + status: string +} + +export type t_bank_connections_resource_accountholder = { + account?: (string | t_account) | undefined + customer?: (string | t_customer) | undefined + type: "account" | "customer" +} + +export type t_bank_connections_resource_balance = { + as_of: number + cash?: + | t_bank_connections_resource_balance_api_resource_cash_balance + | undefined + credit?: + | t_bank_connections_resource_balance_api_resource_credit_balance + | undefined + current: { + [key: string]: number | undefined + } + type: "cash" | "credit" +} + +export type t_bank_connections_resource_balance_api_resource_cash_balance = { + available?: + | ({ + [key: string]: number | undefined + } | null) + | undefined +} + +export type t_bank_connections_resource_balance_api_resource_credit_balance = { + used?: + | ({ + [key: string]: number | undefined + } | null) + | undefined +} + +export type t_bank_connections_resource_balance_refresh = { + last_attempted_at: number + next_refresh_available_at?: (number | null) | undefined + status: "failed" | "pending" | "succeeded" +} + +export type t_bank_connections_resource_link_account_session_filters = { + account_subcategories?: + | ( + | ( + | "checking" + | "credit_card" + | "line_of_credit" + | "mortgage" + | "savings" + )[] + | null + ) + | undefined + countries?: (string[] | null) | undefined +} + +export type t_bank_connections_resource_ownership_refresh = { + last_attempted_at: number + next_refresh_available_at?: (number | null) | undefined + status: "failed" | "pending" | "succeeded" +} + +export type t_bank_connections_resource_transaction_refresh = { + id: string + last_attempted_at: number + next_refresh_available_at?: (number | null) | undefined + status: "failed" | "pending" | "succeeded" +} + +export type t_bank_connections_resource_transaction_resource_status_transitions = + { + posted_at?: (number | null) | undefined + void_at?: (number | null) | undefined + } + +export type t_billing_alert = { + alert_type: "usage_threshold" + id: string + livemode: boolean + object: "billing.alert" + status?: ("active" | "archived" | "inactive" | null) | undefined + title: string + usage_threshold?: + | (t_thresholds_resource_usage_threshold_config | null) + | undefined +} + +export type t_billing_credit_balance_summary = { + balances: t_credit_balance[] + customer: string | t_customer | t_deleted_customer + livemode: boolean + object: "billing.credit_balance_summary" +} + +export type t_billing_credit_balance_transaction = { + created: number + credit?: (t_billing_credit_grants_resource_balance_credit | null) | undefined + credit_grant: string | t_billing_credit_grant + debit?: (t_billing_credit_grants_resource_balance_debit | null) | undefined + effective_at: number + id: string + livemode: boolean + object: "billing.credit_balance_transaction" + test_clock?: (string | t_test_helpers_test_clock | null) | undefined + type?: ("credit" | "debit" | null) | undefined +} + +export type t_billing_credit_grant = { + amount: t_billing_credit_grants_resource_amount + applicability_config: t_billing_credit_grants_resource_applicability_config + category: "paid" | "promotional" + created: number + customer: string | t_customer | t_deleted_customer + effective_at?: (number | null) | undefined + expires_at?: (number | null) | undefined + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + name?: (string | null) | undefined + object: "billing.credit_grant" + priority?: (number | null) | undefined + test_clock?: (string | t_test_helpers_test_clock | null) | undefined + updated: number + voided_at?: (number | null) | undefined +} + +export type t_billing_meter = { + created: number + customer_mapping: t_billing_meter_resource_customer_mapping_settings + default_aggregation: t_billing_meter_resource_aggregation_settings + display_name: string + event_name: string + event_time_window?: ("day" | "hour" | null) | undefined + id: string + livemode: boolean + object: "billing.meter" + status: "active" | "inactive" + status_transitions: t_billing_meter_resource_billing_meter_status_transitions + updated: number + value_settings: t_billing_meter_resource_billing_meter_value +} + +export type t_billing_meter_event = { + created: number + event_name: string + identifier: string + livemode: boolean + object: "billing.meter_event" + payload: { + [key: string]: string | undefined + } + timestamp: number +} + +export type t_billing_meter_event_adjustment = { + cancel?: + | (t_billing_meter_resource_billing_meter_event_adjustment_cancel | null) + | undefined + event_name: string + livemode: boolean + object: "billing.meter_event_adjustment" + status: "complete" | "pending" + type: "cancel" +} + +export type t_billing_meter_event_summary = { + aggregated_value: number + end_time: number + id: string + livemode: boolean + meter: string + object: "billing.meter_event_summary" + start_time: number +} + +export type t_billing_bill_resource_invoice_item_parents_invoice_item_parent = { + subscription_details?: + | (t_billing_bill_resource_invoice_item_parents_invoice_item_subscription_parent | null) + | undefined + type: "subscription_details" +} + +export type t_billing_bill_resource_invoice_item_parents_invoice_item_subscription_parent = + { + subscription: string + subscription_item?: string | undefined + } + +export type t_billing_bill_resource_invoicing_lines_common_credited_items = { + invoice: string + invoice_line_items: string[] +} + +export type t_billing_bill_resource_invoicing_lines_common_proration_details = { + credited_items?: + | (t_billing_bill_resource_invoicing_lines_common_credited_items | null) + | undefined +} + +export type t_billing_bill_resource_invoicing_lines_parents_invoice_line_item_invoice_item_parent = + { + invoice_item: string + proration: boolean + proration_details?: + | (t_billing_bill_resource_invoicing_lines_common_proration_details | null) + | undefined + subscription?: (string | null) | undefined + } + +export type t_billing_bill_resource_invoicing_lines_parents_invoice_line_item_parent = + { + invoice_item_details?: + | (t_billing_bill_resource_invoicing_lines_parents_invoice_line_item_invoice_item_parent | null) + | undefined + subscription_item_details?: + | (t_billing_bill_resource_invoicing_lines_parents_invoice_line_item_subscription_item_parent | null) + | undefined + type: "invoice_item_details" | "subscription_item_details" + } + +export type t_billing_bill_resource_invoicing_lines_parents_invoice_line_item_subscription_item_parent = + { + invoice_item?: (string | null) | undefined + proration: boolean + proration_details?: + | (t_billing_bill_resource_invoicing_lines_common_proration_details | null) + | undefined + subscription: string + subscription_item: string + } + +export type t_billing_bill_resource_invoicing_parents_invoice_parent = { + quote_details?: + | (t_billing_bill_resource_invoicing_parents_invoice_quote_parent | null) + | undefined + subscription_details?: + | (t_billing_bill_resource_invoicing_parents_invoice_subscription_parent | null) + | undefined + type: "quote_details" | "subscription_details" +} + +export type t_billing_bill_resource_invoicing_parents_invoice_quote_parent = { + quote: string +} + +export type t_billing_bill_resource_invoicing_parents_invoice_subscription_parent = + { + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + subscription: string | t_subscription + subscription_proration_date?: number | undefined + } + +export type t_billing_bill_resource_invoicing_pricing_pricing = { + price_details?: + | t_billing_bill_resource_invoicing_pricing_pricing_price_details + | undefined + type: "price_details" + unit_amount_decimal?: (string | null) | undefined +} + +export type t_billing_bill_resource_invoicing_pricing_pricing_price_details = { + price: string + product: string +} + +export type t_billing_bill_resource_invoicing_taxes_tax = { + amount: number + tax_behavior: "exclusive" | "inclusive" + tax_rate_details?: + | (t_billing_bill_resource_invoicing_taxes_tax_rate_details | null) + | undefined + taxability_reason: + | "customer_exempt" + | "not_available" + | "not_collecting" + | "not_subject_to_tax" + | "not_supported" + | "portion_product_exempt" + | "portion_reduced_rated" + | "portion_standard_rated" + | "product_exempt" + | "product_exempt_holiday" + | "proportionally_rated" + | "reduced_rated" + | "reverse_charge" + | "standard_rated" + | "taxable_basis_reduced" + | "zero_rated" + taxable_amount?: (number | null) | undefined + type: "tax_rate_details" +} + +export type t_billing_bill_resource_invoicing_taxes_tax_rate_details = { + tax_rate: string +} + +export type t_billing_clocks_resource_status_details_advancing_status_details = + { + target_frozen_time: number + } + +export type t_billing_clocks_resource_status_details_status_details = { + advancing?: + | t_billing_clocks_resource_status_details_advancing_status_details + | undefined +} + +export type t_billing_credit_grants_resource_amount = { + monetary?: + | (t_billing_credit_grants_resource_monetary_amount | null) + | undefined + type: "monetary" +} + +export type t_billing_credit_grants_resource_applicability_config = { + scope: t_billing_credit_grants_resource_scope +} + +export type t_billing_credit_grants_resource_applicable_price = { + id?: (string | null) | undefined +} + +export type t_billing_credit_grants_resource_balance_credit = { + amount: t_billing_credit_grants_resource_amount + credits_application_invoice_voided?: + | (t_billing_credit_grants_resource_balance_credits_application_invoice_voided | null) + | undefined + type: "credits_application_invoice_voided" | "credits_granted" +} + +export type t_billing_credit_grants_resource_balance_credits_application_invoice_voided = + { + invoice: string | t_invoice + invoice_line_item: string + } + +export type t_billing_credit_grants_resource_balance_credits_applied = { + invoice: string | t_invoice + invoice_line_item: string +} + +export type t_billing_credit_grants_resource_balance_debit = { + amount: t_billing_credit_grants_resource_amount + credits_applied?: + | (t_billing_credit_grants_resource_balance_credits_applied | null) + | undefined + type: "credits_applied" | "credits_expired" | "credits_voided" +} + +export type t_billing_credit_grants_resource_monetary_amount = { + currency: string + value: number +} + +export type t_billing_credit_grants_resource_scope = { + price_type?: "metered" | undefined + prices?: t_billing_credit_grants_resource_applicable_price[] | undefined +} + +export type t_billing_details = { + address?: (t_address | null) | undefined + email?: (string | null) | undefined + name?: (string | null) | undefined + phone?: (string | null) | undefined +} + +export type t_billing_meter_resource_aggregation_settings = { + formula: "count" | "last" | "sum" +} + +export type t_billing_meter_resource_billing_meter_event_adjustment_cancel = { + identifier?: (string | null) | undefined +} + +export type t_billing_meter_resource_billing_meter_status_transitions = { + deactivated_at?: (number | null) | undefined +} + +export type t_billing_meter_resource_billing_meter_value = { + event_payload_key: string +} + +export type t_billing_meter_resource_customer_mapping_settings = { + event_payload_key: string + type: "by_id" +} + +export type t_billing_portal_configuration = { + active: boolean + application?: + | (string | t_application | t_deleted_application | null) + | undefined + business_profile: t_portal_business_profile + created: number + default_return_url?: (string | null) | undefined + features: t_portal_features + id: string + is_default: boolean + livemode: boolean + login_page: t_portal_login_page + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "billing_portal.configuration" + updated: number +} + +export type t_billing_portal_session = { + configuration: string | t_billing_portal_configuration + created: number + customer: string + flow?: (t_portal_flows_flow | null) | undefined + id: string + livemode: boolean + locale?: + | ( + | "auto" + | "bg" + | "cs" + | "da" + | "de" + | "el" + | "en" + | "en-AU" + | "en-CA" + | "en-GB" + | "en-IE" + | "en-IN" + | "en-NZ" + | "en-SG" + | "es" + | "es-419" + | "et" + | "fi" + | "fil" + | "fr" + | "fr-CA" + | "hr" + | "hu" + | "id" + | "it" + | "ja" + | "ko" + | "lt" + | "lv" + | "ms" + | "mt" + | "nb" + | "nl" + | "pl" + | "pt" + | "pt-BR" + | "ro" + | "ru" + | "sk" + | "sl" + | "sv" + | "th" + | "tr" + | "vi" + | "zh" + | "zh-HK" + | "zh-TW" + | null + ) + | undefined + object: "billing_portal.session" + on_behalf_of?: (string | null) | undefined + return_url?: (string | null) | undefined + url: string +} + +export type t_cancellation_details = { + comment?: (string | null) | undefined + feedback?: + | ( + | "customer_service" + | "low_quality" + | "missing_features" + | "other" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | null + ) + | undefined + reason?: + | ("cancellation_requested" | "payment_disputed" | "payment_failed" | null) + | undefined +} + +export type t_capability = { + account: string | t_account + future_requirements?: t_account_capability_future_requirements | undefined + id: string + object: "capability" + requested: boolean + requested_at?: (number | null) | undefined + requirements?: t_account_capability_requirements | undefined + status: "active" | "disabled" | "inactive" | "pending" | "unrequested" +} + +export type t_card = { + account?: (string | t_account | null) | undefined + address_city?: (string | null) | undefined + address_country?: (string | null) | undefined + address_line1?: (string | null) | undefined + address_line1_check?: (string | null) | undefined + address_line2?: (string | null) | undefined + address_state?: (string | null) | undefined + address_zip?: (string | null) | undefined + address_zip_check?: (string | null) | undefined + allow_redisplay?: ("always" | "limited" | "unspecified" | null) | undefined + available_payout_methods?: (("instant" | "standard")[] | null) | undefined + brand: string + country?: (string | null) | undefined + currency?: (string | null) | undefined + customer?: (string | t_customer | t_deleted_customer | null) | undefined + cvc_check?: (string | null) | undefined + default_for_currency?: (boolean | null) | undefined + dynamic_last4?: (string | null) | undefined + exp_month: number + exp_year: number + fingerprint?: (string | null) | undefined + funding: string + id: string + iin?: string | undefined + last4: string + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + name?: (string | null) | undefined + networks?: t_token_card_networks | undefined + object: "card" + regulated_status?: ("regulated" | "unregulated" | null) | undefined + status?: (string | null) | undefined + tokenization_method?: (string | null) | undefined +} + +export type t_card_generated_from_payment_method_details = { + card_present?: t_payment_method_details_card_present | undefined + type: string +} + +export type t_card_issuing_account_terms_of_service = { + date?: (number | null) | undefined + ip?: (string | null) | undefined + user_agent?: string | undefined +} + +export type t_card_mandate_payment_method_details = EmptyObject + +export type t_cash_balance = { + available?: + | ({ + [key: string]: number | undefined + } | null) + | undefined + customer: string + livemode: boolean + object: "cash_balance" + settings: t_customer_balance_customer_balance_settings +} + +export type t_charge = { + amount: number + amount_captured: number + amount_refunded: number + application?: (string | t_application | null) | undefined + application_fee?: (string | t_application_fee | null) | undefined + application_fee_amount?: (number | null) | undefined + balance_transaction?: (string | t_balance_transaction | null) | undefined + billing_details: t_billing_details + calculated_statement_descriptor?: (string | null) | undefined + captured: boolean + created: number + currency: string + customer?: (string | t_customer | t_deleted_customer | null) | undefined + description?: (string | null) | undefined + disputed: boolean + failure_balance_transaction?: + | (string | t_balance_transaction | null) + | undefined + failure_code?: (string | null) | undefined + failure_message?: (string | null) | undefined + fraud_details?: (t_charge_fraud_details | null) | undefined + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "charge" + on_behalf_of?: (string | t_account | null) | undefined + outcome?: (t_charge_outcome | null) | undefined + paid: boolean + payment_intent?: (string | t_payment_intent | null) | undefined + payment_method?: (string | null) | undefined + payment_method_details?: (t_payment_method_details | null) | undefined + presentment_details?: + | t_payment_flows_payment_intent_presentment_details + | undefined + radar_options?: t_radar_radar_options | undefined + receipt_email?: (string | null) | undefined + receipt_number?: (string | null) | undefined + receipt_url?: (string | null) | undefined + refunded: boolean + refunds?: + | ({ + data: t_refund[] + has_more: boolean + object: "list" + url: string + } | null) + | undefined + review?: (string | t_review | null) | undefined + shipping?: (t_shipping | null) | undefined + source_transfer?: (string | t_transfer | null) | undefined + statement_descriptor?: (string | null) | undefined + statement_descriptor_suffix?: (string | null) | undefined + status: "failed" | "pending" | "succeeded" + transfer?: (string | t_transfer) | undefined + transfer_data?: (t_charge_transfer_data | null) | undefined + transfer_group?: (string | null) | undefined +} + +export type t_charge_fraud_details = { + stripe_report?: string | undefined + user_report?: string | undefined +} + +export type t_charge_outcome = { + advice_code?: + | ("confirm_card_data" | "do_not_try_again" | "try_again_later" | null) + | undefined + network_advice_code?: (string | null) | undefined + network_decline_code?: (string | null) | undefined + network_status?: (string | null) | undefined + reason?: (string | null) | undefined + risk_level?: string | undefined + risk_score?: number | undefined + rule?: (string | t_rule) | undefined + seller_message?: (string | null) | undefined + type: string +} + +export type t_charge_transfer_data = { + amount?: (number | null) | undefined + destination: string | t_account +} + +export type t_checkout_session = { + adaptive_pricing?: + | (t_payment_pages_checkout_session_adaptive_pricing | null) + | undefined + after_expiration?: + | (t_payment_pages_checkout_session_after_expiration | null) + | undefined + allow_promotion_codes?: (boolean | null) | undefined + amount_subtotal?: (number | null) | undefined + amount_total?: (number | null) | undefined + automatic_tax: t_payment_pages_checkout_session_automatic_tax + billing_address_collection?: ("auto" | "required" | null) | undefined + cancel_url?: (string | null) | undefined + client_reference_id?: (string | null) | undefined + client_secret?: (string | null) | undefined + collected_information?: + | (t_payment_pages_checkout_session_collected_information | null) + | undefined + consent?: (t_payment_pages_checkout_session_consent | null) | undefined + consent_collection?: + | (t_payment_pages_checkout_session_consent_collection | null) + | undefined + created: number + currency?: (string | null) | undefined + currency_conversion?: + | (t_payment_pages_checkout_session_currency_conversion | null) + | undefined + custom_fields: t_payment_pages_checkout_session_custom_fields[] + custom_text: t_payment_pages_checkout_session_custom_text + customer?: (string | t_customer | t_deleted_customer | null) | undefined + customer_creation?: ("always" | "if_required" | null) | undefined + customer_details?: + | (t_payment_pages_checkout_session_customer_details | null) + | undefined + customer_email?: (string | null) | undefined + discounts?: (t_payment_pages_checkout_session_discount[] | null) | undefined + expires_at: number + id: string + invoice?: (string | t_invoice | null) | undefined + invoice_creation?: + | (t_payment_pages_checkout_session_invoice_creation | null) + | undefined + line_items?: + | { + data: t_item[] + has_more: boolean + object: "list" + url: string + } + | undefined + livemode: boolean + locale?: + | ( + | "auto" + | "bg" + | "cs" + | "da" + | "de" + | "el" + | "en" + | "en-GB" + | "es" + | "es-419" + | "et" + | "fi" + | "fil" + | "fr" + | "fr-CA" + | "hr" + | "hu" + | "id" + | "it" + | "ja" + | "ko" + | "lt" + | "lv" + | "ms" + | "mt" + | "nb" + | "nl" + | "pl" + | "pt" + | "pt-BR" + | "ro" + | "ru" + | "sk" + | "sl" + | "sv" + | "th" + | "tr" + | "vi" + | "zh" + | "zh-HK" + | "zh-TW" + | null + ) + | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + mode: "payment" | "setup" | "subscription" + object: "checkout.session" + optional_items?: + | (t_payment_pages_checkout_session_optional_item[] | null) + | undefined + payment_intent?: (string | t_payment_intent | null) | undefined + payment_link?: (string | t_payment_link | null) | undefined + payment_method_collection?: ("always" | "if_required" | null) | undefined + payment_method_configuration_details?: + | (t_payment_method_config_biz_payment_method_configuration_details | null) + | undefined + payment_method_options?: + | (t_checkout_session_payment_method_options | null) + | undefined + payment_method_types: string[] + payment_status: "no_payment_required" | "paid" | "unpaid" + permissions?: + | (t_payment_pages_checkout_session_permissions | null) + | undefined + phone_number_collection?: + | t_payment_pages_checkout_session_phone_number_collection + | undefined + presentment_details?: + | t_payment_flows_payment_intent_presentment_details + | undefined + recovered_from?: (string | null) | undefined + redirect_on_completion?: ("always" | "if_required" | "never") | undefined + return_url?: string | undefined + saved_payment_method_options?: + | (t_payment_pages_checkout_session_saved_payment_method_options | null) + | undefined + setup_intent?: (string | t_setup_intent | null) | undefined + shipping_address_collection?: + | (t_payment_pages_checkout_session_shipping_address_collection | null) + | undefined + shipping_cost?: + | (t_payment_pages_checkout_session_shipping_cost | null) + | undefined + shipping_options: t_payment_pages_checkout_session_shipping_option[] + status?: ("complete" | "expired" | "open" | null) | undefined + submit_type?: + | ("auto" | "book" | "donate" | "pay" | "subscribe" | null) + | undefined + subscription?: (string | t_subscription | null) | undefined + success_url?: (string | null) | undefined + tax_id_collection?: + | t_payment_pages_checkout_session_tax_id_collection + | undefined + total_details?: + | (t_payment_pages_checkout_session_total_details | null) + | undefined + ui_mode?: ("custom" | "embedded" | "hosted" | null) | undefined + url?: (string | null) | undefined +} + +export type t_checkout_acss_debit_mandate_options = { + custom_mandate_url?: string | undefined + default_for?: ("invoice" | "subscription")[] | undefined + interval_description?: (string | null) | undefined + payment_schedule?: ("combined" | "interval" | "sporadic" | null) | undefined + transaction_type?: ("business" | "personal" | null) | undefined +} + +export type t_checkout_acss_debit_payment_method_options = { + currency?: ("cad" | "usd") | undefined + mandate_options?: t_checkout_acss_debit_mandate_options | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_checkout_affirm_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_afterpay_clearpay_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_alipay_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_amazon_pay_payment_method_options = { + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_checkout_au_becs_debit_payment_method_options = { + setup_future_usage?: "none" | undefined + target_date?: string | undefined +} + +export type t_checkout_bacs_debit_payment_method_options = { + mandate_options?: + | t_checkout_payment_method_options_mandate_options_bacs_debit + | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined +} + +export type t_checkout_bancontact_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_boleto_payment_method_options = { + expires_after_days: number + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined +} + +export type t_checkout_card_installments_options = { + enabled?: boolean | undefined +} + +export type t_checkout_card_payment_method_options = { + installments?: t_checkout_card_installments_options | undefined + request_extended_authorization?: ("if_available" | "never") | undefined + request_incremental_authorization?: ("if_available" | "never") | undefined + request_multicapture?: ("if_available" | "never") | undefined + request_overcapture?: ("if_available" | "never") | undefined + request_three_d_secure: "any" | "automatic" | "challenge" + restrictions?: + | t_payment_pages_private_card_payment_method_options_resource_restrictions + | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + statement_descriptor_suffix_kana?: string | undefined + statement_descriptor_suffix_kanji?: string | undefined +} + +export type t_checkout_cashapp_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_customer_balance_bank_transfer_payment_method_options = { + eu_bank_transfer?: + | t_payment_method_options_customer_balance_eu_bank_account + | undefined + requested_address_types?: + | ("aba" | "iban" | "sepa" | "sort_code" | "spei" | "swift" | "zengin")[] + | undefined + type?: + | ( + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" + | null + ) + | undefined +} + +export type t_checkout_customer_balance_payment_method_options = { + bank_transfer?: + | t_checkout_customer_balance_bank_transfer_payment_method_options + | undefined + funding_type?: ("bank_transfer" | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_checkout_eps_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_fpx_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_giropay_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_grab_pay_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_ideal_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_kakao_pay_payment_method_options = { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_checkout_klarna_payment_method_options = { + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined +} + +export type t_checkout_konbini_payment_method_options = { + expires_after_days?: (number | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_checkout_kr_card_payment_method_options = { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_checkout_link_payment_method_options = { + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_checkout_mobilepay_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_multibanco_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_naver_pay_payment_method_options = { + capture_method?: "manual" | undefined +} + +export type t_checkout_oxxo_payment_method_options = { + expires_after_days: number + setup_future_usage?: "none" | undefined +} + +export type t_checkout_p24_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_payco_payment_method_options = { + capture_method?: "manual" | undefined +} + +export type t_checkout_payment_method_options_mandate_options_bacs_debit = { + reference_prefix?: string | undefined +} + +export type t_checkout_payment_method_options_mandate_options_sepa_debit = { + reference_prefix?: string | undefined +} + +export type t_checkout_paynow_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_paypal_payment_method_options = { + capture_method?: "manual" | undefined + preferred_locale?: (string | null) | undefined + reference?: (string | null) | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_checkout_pix_payment_method_options = { + expires_after_seconds?: (number | null) | undefined +} + +export type t_checkout_revolut_pay_payment_method_options = { + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_checkout_samsung_pay_payment_method_options = { + capture_method?: "manual" | undefined +} + +export type t_checkout_sepa_debit_payment_method_options = { + mandate_options?: + | t_checkout_payment_method_options_mandate_options_sepa_debit + | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined +} + +export type t_checkout_session_payment_method_options = { + acss_debit?: t_checkout_acss_debit_payment_method_options | undefined + affirm?: t_checkout_affirm_payment_method_options | undefined + afterpay_clearpay?: + | t_checkout_afterpay_clearpay_payment_method_options + | undefined + alipay?: t_checkout_alipay_payment_method_options | undefined + amazon_pay?: t_checkout_amazon_pay_payment_method_options | undefined + au_becs_debit?: t_checkout_au_becs_debit_payment_method_options | undefined + bacs_debit?: t_checkout_bacs_debit_payment_method_options | undefined + bancontact?: t_checkout_bancontact_payment_method_options | undefined + boleto?: t_checkout_boleto_payment_method_options | undefined + card?: t_checkout_card_payment_method_options | undefined + cashapp?: t_checkout_cashapp_payment_method_options | undefined + customer_balance?: + | t_checkout_customer_balance_payment_method_options + | undefined + eps?: t_checkout_eps_payment_method_options | undefined + fpx?: t_checkout_fpx_payment_method_options | undefined + giropay?: t_checkout_giropay_payment_method_options | undefined + grabpay?: t_checkout_grab_pay_payment_method_options | undefined + ideal?: t_checkout_ideal_payment_method_options | undefined + kakao_pay?: t_checkout_kakao_pay_payment_method_options | undefined + klarna?: t_checkout_klarna_payment_method_options | undefined + konbini?: t_checkout_konbini_payment_method_options | undefined + kr_card?: t_checkout_kr_card_payment_method_options | undefined + link?: t_checkout_link_payment_method_options | undefined + mobilepay?: t_checkout_mobilepay_payment_method_options | undefined + multibanco?: t_checkout_multibanco_payment_method_options | undefined + naver_pay?: t_checkout_naver_pay_payment_method_options | undefined + oxxo?: t_checkout_oxxo_payment_method_options | undefined + p24?: t_checkout_p24_payment_method_options | undefined + payco?: t_checkout_payco_payment_method_options | undefined + paynow?: t_checkout_paynow_payment_method_options | undefined + paypal?: t_checkout_paypal_payment_method_options | undefined + pix?: t_checkout_pix_payment_method_options | undefined + revolut_pay?: t_checkout_revolut_pay_payment_method_options | undefined + samsung_pay?: t_checkout_samsung_pay_payment_method_options | undefined + sepa_debit?: t_checkout_sepa_debit_payment_method_options | undefined + sofort?: t_checkout_sofort_payment_method_options | undefined + swish?: t_checkout_swish_payment_method_options | undefined + us_bank_account?: + | t_checkout_us_bank_account_payment_method_options + | undefined +} + +export type t_checkout_sofort_payment_method_options = { + setup_future_usage?: "none" | undefined +} + +export type t_checkout_swish_payment_method_options = { + reference?: (string | null) | undefined +} + +export type t_checkout_us_bank_account_payment_method_options = { + financial_connections?: t_linked_account_options_us_bank_account | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined + verification_method?: ("automatic" | "instant") | undefined +} + +export type t_climate_order = { + amount_fees: number + amount_subtotal: number + amount_total: number + beneficiary?: t_climate_removals_beneficiary | undefined + canceled_at?: (number | null) | undefined + cancellation_reason?: + | ("expired" | "product_unavailable" | "requested" | null) + | undefined + certificate?: (string | null) | undefined + confirmed_at?: (number | null) | undefined + created: number + currency: string + delayed_at?: (number | null) | undefined + delivered_at?: (number | null) | undefined + delivery_details: t_climate_removals_order_deliveries[] + expected_delivery_year: number + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + metric_tons: string + object: "climate.order" + product: string | t_climate_product + product_substituted_at?: (number | null) | undefined + status: "awaiting_funds" | "canceled" | "confirmed" | "delivered" | "open" +} + +export type t_climate_product = { + created: number + current_prices_per_metric_ton: { + [key: string]: t_climate_removals_products_price | undefined + } + delivery_year?: (number | null) | undefined + id: string + livemode: boolean + metric_tons_available: string + name: string + object: "climate.product" + suppliers: t_climate_supplier[] +} + +export type t_climate_supplier = { + id: string + info_url: string + livemode: boolean + locations: t_climate_removals_location[] + name: string + object: "climate.supplier" + removal_pathway: + | "biomass_carbon_removal_and_storage" + | "direct_air_capture" + | "enhanced_weathering" +} + +export type t_climate_removals_beneficiary = { + public_name: string +} + +export type t_climate_removals_location = { + city?: (string | null) | undefined + country: string + latitude?: (number | null) | undefined + longitude?: (number | null) | undefined + region?: (string | null) | undefined +} + +export type t_climate_removals_order_deliveries = { + delivered_at: number + location?: (t_climate_removals_location | null) | undefined + metric_tons: string + registry_url?: (string | null) | undefined + supplier: t_climate_supplier +} + +export type t_climate_removals_products_price = { + amount_fees: number + amount_subtotal: number + amount_total: number +} + +export type t_confirmation_token = { + created: number + expires_at?: (number | null) | undefined + id: string + livemode: boolean + mandate_data?: + | (t_confirmation_tokens_resource_mandate_data | null) + | undefined + object: "confirmation_token" + payment_intent?: (string | null) | undefined + payment_method_options?: + | (t_confirmation_tokens_resource_payment_method_options | null) + | undefined + payment_method_preview?: + | (t_confirmation_tokens_resource_payment_method_preview | null) + | undefined + return_url?: (string | null) | undefined + setup_future_usage?: ("off_session" | "on_session" | null) | undefined + setup_intent?: (string | null) | undefined + shipping?: (t_confirmation_tokens_resource_shipping | null) | undefined + use_stripe_sdk: boolean +} + +export type t_confirmation_tokens_resource_mandate_data = { + customer_acceptance: t_confirmation_tokens_resource_mandate_data_resource_customer_acceptance +} + +export type t_confirmation_tokens_resource_mandate_data_resource_customer_acceptance = + { + online?: + | (t_confirmation_tokens_resource_mandate_data_resource_customer_acceptance_resource_online | null) + | undefined + type: string + } + +export type t_confirmation_tokens_resource_mandate_data_resource_customer_acceptance_resource_online = + { + ip_address?: (string | null) | undefined + user_agent?: (string | null) | undefined + } + +export type t_confirmation_tokens_resource_payment_method_options = { + card?: + | (t_confirmation_tokens_resource_payment_method_options_resource_card | null) + | undefined +} + +export type t_confirmation_tokens_resource_payment_method_options_resource_card = + { + cvc_token?: (string | null) | undefined + } + +export type t_confirmation_tokens_resource_payment_method_preview = { + acss_debit?: t_payment_method_acss_debit | undefined + affirm?: t_payment_method_affirm | undefined + afterpay_clearpay?: t_payment_method_afterpay_clearpay | undefined + alipay?: t_payment_flows_private_payment_methods_alipay | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: t_payment_method_alma | undefined + amazon_pay?: t_payment_method_amazon_pay | undefined + au_becs_debit?: t_payment_method_au_becs_debit | undefined + bacs_debit?: t_payment_method_bacs_debit | undefined + bancontact?: t_payment_method_bancontact | undefined + billie?: t_payment_method_billie | undefined + billing_details: t_billing_details + blik?: t_payment_method_blik | undefined + boleto?: t_payment_method_boleto | undefined + card?: t_payment_method_card | undefined + card_present?: t_payment_method_card_present | undefined + cashapp?: t_payment_method_cashapp | undefined + customer?: (string | t_customer | null) | undefined + customer_balance?: t_payment_method_customer_balance | undefined + eps?: t_payment_method_eps | undefined + fpx?: t_payment_method_fpx | undefined + giropay?: t_payment_method_giropay | undefined + grabpay?: t_payment_method_grabpay | undefined + ideal?: t_payment_method_ideal | undefined + interac_present?: t_payment_method_interac_present | undefined + kakao_pay?: t_payment_method_kakao_pay | undefined + klarna?: t_payment_method_klarna | undefined + konbini?: t_payment_method_konbini | undefined + kr_card?: t_payment_method_kr_card | undefined + link?: t_payment_method_link | undefined + mobilepay?: t_payment_method_mobilepay | undefined + multibanco?: t_payment_method_multibanco | undefined + naver_pay?: t_payment_method_naver_pay | undefined + nz_bank_account?: t_payment_method_nz_bank_account | undefined + oxxo?: t_payment_method_oxxo | undefined + p24?: t_payment_method_p24 | undefined + pay_by_bank?: t_payment_method_pay_by_bank | undefined + payco?: t_payment_method_payco | undefined + paynow?: t_payment_method_paynow | undefined + paypal?: t_payment_method_paypal | undefined + pix?: t_payment_method_pix | undefined + promptpay?: t_payment_method_promptpay | undefined + revolut_pay?: t_payment_method_revolut_pay | undefined + samsung_pay?: t_payment_method_samsung_pay | undefined + satispay?: t_payment_method_satispay | undefined + sepa_debit?: t_payment_method_sepa_debit | undefined + sofort?: t_payment_method_sofort | undefined + swish?: t_payment_method_swish | undefined + twint?: t_payment_method_twint | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "card_present" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "interac_present" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: t_payment_method_us_bank_account | undefined + wechat_pay?: t_payment_method_wechat_pay | undefined + zip?: t_payment_method_zip | undefined +} + +export type t_confirmation_tokens_resource_shipping = { + address: t_address + name: string + phone?: (string | null) | undefined +} + +export type t_connect_account_reference = { + account?: (string | t_account) | undefined + type: "account" | "self" +} + +export type t_connect_collection_transfer = { + amount: number + currency: string + destination: string | t_account + id: string + livemode: boolean + object: "connect_collection_transfer" +} + +export type t_connect_embedded_account_config_claim = { + enabled: boolean + features: t_connect_embedded_account_features_claim +} + +export type t_connect_embedded_account_features_claim = { + disable_stripe_user_authentication: boolean + external_account_collection: boolean +} + +export type t_connect_embedded_account_session_create_components = { + account_management: t_connect_embedded_account_config_claim + account_onboarding: t_connect_embedded_account_config_claim + balances: t_connect_embedded_payouts_config + documents: t_connect_embedded_base_config_claim + financial_account: t_connect_embedded_financial_account_config_claim + financial_account_transactions: t_connect_embedded_financial_account_transactions_config_claim + issuing_card: t_connect_embedded_issuing_card_config_claim + issuing_cards_list: t_connect_embedded_issuing_cards_list_config_claim + notification_banner: t_connect_embedded_account_config_claim + payment_details: t_connect_embedded_payments_config_claim + payments: t_connect_embedded_payments_config_claim + payouts: t_connect_embedded_payouts_config + payouts_list: t_connect_embedded_base_config_claim + tax_registrations: t_connect_embedded_base_config_claim + tax_settings: t_connect_embedded_base_config_claim +} + +export type t_connect_embedded_base_config_claim = { + enabled: boolean + features: t_connect_embedded_base_features +} + +export type t_connect_embedded_base_features = EmptyObject + +export type t_connect_embedded_financial_account_config_claim = { + enabled: boolean + features: t_connect_embedded_financial_account_features +} + +export type t_connect_embedded_financial_account_features = { + disable_stripe_user_authentication: boolean + external_account_collection: boolean + send_money: boolean + transfer_balance: boolean +} + +export type t_connect_embedded_financial_account_transactions_config_claim = { + enabled: boolean + features: t_connect_embedded_financial_account_transactions_features +} + +export type t_connect_embedded_financial_account_transactions_features = { + card_spend_dispute_management: boolean +} + +export type t_connect_embedded_issuing_card_config_claim = { + enabled: boolean + features: t_connect_embedded_issuing_card_features +} + +export type t_connect_embedded_issuing_card_features = { + card_management: boolean + card_spend_dispute_management: boolean + cardholder_management: boolean + spend_control_management: boolean +} + +export type t_connect_embedded_issuing_cards_list_config_claim = { + enabled: boolean + features: t_connect_embedded_issuing_cards_list_features +} + +export type t_connect_embedded_issuing_cards_list_features = { + card_management: boolean + card_spend_dispute_management: boolean + cardholder_management: boolean + disable_stripe_user_authentication: boolean + spend_control_management: boolean +} + +export type t_connect_embedded_payments_config_claim = { + enabled: boolean + features: t_connect_embedded_payments_features +} + +export type t_connect_embedded_payments_features = { + capture_payments: boolean + destination_on_behalf_of_charge_management: boolean + dispute_management: boolean + refund_management: boolean +} + +export type t_connect_embedded_payouts_config = { + enabled: boolean + features: t_connect_embedded_payouts_features +} + +export type t_connect_embedded_payouts_features = { + disable_stripe_user_authentication: boolean + edit_payout_schedule: boolean + external_account_collection: boolean + instant_payouts: boolean + standard_payouts: boolean +} + +export type t_country_spec = { + default_currency: string + id: string + object: "country_spec" + supported_bank_account_currencies: { + [key: string]: string[] | undefined + } + supported_payment_currencies: string[] + supported_payment_methods: string[] + supported_transfer_countries: string[] + verification_fields: t_country_spec_verification_fields +} + +export type t_country_spec_verification_field_details = { + additional: string[] + minimum: string[] +} + +export type t_country_spec_verification_fields = { + company: t_country_spec_verification_field_details + individual: t_country_spec_verification_field_details +} + +export type t_coupon = { + amount_off?: (number | null) | undefined + applies_to?: t_coupon_applies_to | undefined + created: number + currency?: (string | null) | undefined + currency_options?: + | { + [key: string]: t_coupon_currency_option | undefined + } + | undefined + duration: "forever" | "once" | "repeating" + duration_in_months?: (number | null) | undefined + id: string + livemode: boolean + max_redemptions?: (number | null) | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + name?: (string | null) | undefined + object: "coupon" + percent_off?: (number | null) | undefined + redeem_by?: (number | null) | undefined + times_redeemed: number + valid: boolean +} + +export type t_coupon_applies_to = { + products: string[] +} + +export type t_coupon_currency_option = { + amount_off: number +} + +export type t_credit_balance = { + available_balance: t_billing_credit_grants_resource_amount + ledger_balance: t_billing_credit_grants_resource_amount +} + +export type t_credit_note = { + amount: number + amount_shipping: number + created: number + currency: string + customer: string | t_customer | t_deleted_customer + customer_balance_transaction?: + | (string | t_customer_balance_transaction | null) + | undefined + discount_amount: number + discount_amounts: t_discounts_resource_discount_amount[] + effective_at?: (number | null) | undefined + id: string + invoice: string | t_invoice + lines: { + data: t_credit_note_line_item[] + has_more: boolean + object: "list" + url: string + } + livemode: boolean + memo?: (string | null) | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + number: string + object: "credit_note" + out_of_band_amount?: (number | null) | undefined + pdf: string + pretax_credit_amounts: t_credit_notes_pretax_credit_amount[] + reason?: + | ( + | "duplicate" + | "fraudulent" + | "order_change" + | "product_unsatisfactory" + | null + ) + | undefined + refunds: t_credit_note_refund[] + shipping_cost?: (t_invoices_resource_shipping_cost | null) | undefined + status: "issued" | "void" + subtotal: number + subtotal_excluding_tax?: (number | null) | undefined + total: number + total_excluding_tax?: (number | null) | undefined + total_taxes?: + | (t_billing_bill_resource_invoicing_taxes_tax[] | null) + | undefined + type: "post_payment" | "pre_payment" + voided_at?: (number | null) | undefined +} + +export type t_credit_note_line_item = { + amount: number + description?: (string | null) | undefined + discount_amount: number + discount_amounts: t_discounts_resource_discount_amount[] + id: string + invoice_line_item?: string | undefined + livemode: boolean + object: "credit_note_line_item" + pretax_credit_amounts: t_credit_notes_pretax_credit_amount[] + quantity?: (number | null) | undefined + tax_rates: t_tax_rate[] + taxes?: (t_billing_bill_resource_invoicing_taxes_tax[] | null) | undefined + type: "custom_line_item" | "invoice_line_item" + unit_amount?: (number | null) | undefined + unit_amount_decimal?: (string | null) | undefined +} + +export type t_credit_note_refund = { + amount_refunded: number + refund: string | t_refund +} + +export type t_credit_notes_pretax_credit_amount = { + amount: number + credit_balance_transaction?: + | (string | t_billing_credit_balance_transaction) + | undefined + discount?: (string | t_discount | t_deleted_discount) | undefined + type: "credit_balance_transaction" | "discount" +} + +export type t_currency_option = { + custom_unit_amount?: (t_custom_unit_amount | null) | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified" | null) | undefined + tiers?: t_price_tier[] | undefined + unit_amount?: (number | null) | undefined + unit_amount_decimal?: (string | null) | undefined +} + +export type t_custom_unit_amount = { + maximum?: (number | null) | undefined + minimum?: (number | null) | undefined + preset?: (number | null) | undefined +} + +export type t_customer = { + address?: (t_address | null) | undefined + balance?: number | undefined + cash_balance?: (t_cash_balance | null) | undefined + created: number + currency?: (string | null) | undefined + default_source?: + | (string | t_bank_account | t_card | t_source | null) + | undefined + delinquent?: (boolean | null) | undefined + description?: (string | null) | undefined + discount?: (t_discount | null) | undefined + email?: (string | null) | undefined + id: string + invoice_credit_balance?: + | { + [key: string]: number | undefined + } + | undefined + invoice_prefix?: (string | null) | undefined + invoice_settings?: t_invoice_setting_customer_setting | undefined + livemode: boolean + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: (string | null) | undefined + next_invoice_sequence?: number | undefined + object: "customer" + phone?: (string | null) | undefined + preferred_locales?: (string[] | null) | undefined + shipping?: (t_shipping | null) | undefined + sources?: + | { + data: (t_bank_account | t_card | t_source)[] + has_more: boolean + object: "list" + url: string + } + | undefined + subscriptions?: + | { + data: t_subscription[] + has_more: boolean + object: "list" + url: string + } + | undefined + tax?: t_customer_tax | undefined + tax_exempt?: ("exempt" | "none" | "reverse" | null) | undefined + tax_ids?: + | { + data: t_tax_id[] + has_more: boolean + object: "list" + url: string + } + | undefined + test_clock?: (string | t_test_helpers_test_clock | null) | undefined +} + +export type t_customer_acceptance = { + accepted_at?: (number | null) | undefined + offline?: t_offline_acceptance | undefined + online?: t_online_acceptance | undefined + type: "offline" | "online" +} + +export type t_customer_balance_customer_balance_settings = { + reconciliation_mode: "automatic" | "manual" + using_merchant_default: boolean +} + +export type t_customer_balance_resource_cash_balance_transaction_resource_adjusted_for_overdraft = + { + balance_transaction: string | t_balance_transaction + linked_transaction: string | t_customer_cash_balance_transaction + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_applied_to_payment_transaction = + { + payment_intent: string | t_payment_intent + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction = + { + bank_transfer: t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer = + { + eu_bank_transfer?: + | t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_eu_bank_transfer + | undefined + gb_bank_transfer?: + | t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_gb_bank_transfer + | undefined + jp_bank_transfer?: + | t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_jp_bank_transfer + | undefined + reference?: (string | null) | undefined + type: + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" + us_bank_transfer?: + | t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_us_bank_transfer + | undefined + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_eu_bank_transfer = + { + bic?: (string | null) | undefined + iban_last4?: (string | null) | undefined + sender_name?: (string | null) | undefined + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_gb_bank_transfer = + { + account_number_last4?: (string | null) | undefined + sender_name?: (string | null) | undefined + sort_code?: (string | null) | undefined + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_jp_bank_transfer = + { + sender_bank?: (string | null) | undefined + sender_branch?: (string | null) | undefined + sender_name?: (string | null) | undefined + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_us_bank_transfer = + { + network?: ("ach" | "domestic_wire_us" | "swift") | undefined + sender_name?: (string | null) | undefined + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction = + { + refund: string | t_refund + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance = + { + balance_transaction: string | t_balance_transaction + } + +export type t_customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction = + { + payment_intent: string | t_payment_intent + } + +export type t_customer_balance_transaction = { + amount: number + checkout_session?: (string | t_checkout_session | null) | undefined + created: number + credit_note?: (string | t_credit_note | null) | undefined + currency: string + customer: string | t_customer + description?: (string | null) | undefined + ending_balance: number + id: string + invoice?: (string | t_invoice | null) | undefined + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "customer_balance_transaction" + type: + | "adjustment" + | "applied_to_invoice" + | "checkout_session_subscription_payment" + | "checkout_session_subscription_payment_canceled" + | "credit_note" + | "initial" + | "invoice_overpaid" + | "invoice_too_large" + | "invoice_too_small" + | "migration" + | "unapplied_from_invoice" + | "unspent_receiver_credit" +} + +export type t_customer_cash_balance_transaction = { + adjusted_for_overdraft?: + | t_customer_balance_resource_cash_balance_transaction_resource_adjusted_for_overdraft + | undefined + applied_to_payment?: + | t_customer_balance_resource_cash_balance_transaction_resource_applied_to_payment_transaction + | undefined + created: number + currency: string + customer: string | t_customer + ending_balance: number + funded?: + | t_customer_balance_resource_cash_balance_transaction_resource_funded_transaction + | undefined + id: string + livemode: boolean + net_amount: number + object: "customer_cash_balance_transaction" + refunded_from_payment?: + | t_customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction + | undefined + transferred_to_balance?: + | t_customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance + | undefined + type: + | "adjusted_for_overdraft" + | "applied_to_payment" + | "funded" + | "funding_reversed" + | "refunded_from_payment" + | "return_canceled" + | "return_initiated" + | "transferred_to_balance" + | "unapplied_from_payment" + unapplied_from_payment?: + | t_customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction + | undefined +} + +export type t_customer_session = { + client_secret: string + components?: t_customer_session_resource_components | undefined + created: number + customer: string | t_customer + expires_at: number + livemode: boolean + object: "customer_session" +} + +export type t_customer_session_resource_components = { + buy_button: t_customer_session_resource_components_resource_buy_button + payment_element: t_customer_session_resource_components_resource_payment_element + pricing_table: t_customer_session_resource_components_resource_pricing_table +} + +export type t_customer_session_resource_components_resource_buy_button = { + enabled: boolean +} + +export type t_customer_session_resource_components_resource_payment_element = { + enabled: boolean + features?: + | (t_customer_session_resource_components_resource_payment_element_resource_features | null) + | undefined +} + +export type t_customer_session_resource_components_resource_payment_element_resource_features = + { + payment_method_allow_redisplay_filters: ( + | "always" + | "limited" + | "unspecified" + )[] + payment_method_redisplay: "disabled" | "enabled" + payment_method_redisplay_limit?: (number | null) | undefined + payment_method_remove: "disabled" | "enabled" + payment_method_save: "disabled" | "enabled" + payment_method_save_usage?: + | ("off_session" | "on_session" | null) + | undefined + } + +export type t_customer_session_resource_components_resource_pricing_table = { + enabled: boolean +} + +export type t_customer_tax = { + automatic_tax: + | "failed" + | "not_collecting" + | "supported" + | "unrecognized_location" + ip_address?: (string | null) | undefined + location?: (t_customer_tax_location | null) | undefined +} + +export type t_customer_tax_location = { + country: string + source: + | "billing_address" + | "ip_address" + | "payment_method" + | "shipping_destination" + state?: (string | null) | undefined +} + +export type t_deleted_account = { + deleted: boolean + id: string + object: "account" +} + +export type t_deleted_apple_pay_domain = { + deleted: boolean + id: string + object: "apple_pay_domain" +} + +export type t_deleted_application = { + deleted: boolean + id: string + name?: (string | null) | undefined + object: "application" +} + +export type t_deleted_bank_account = { + currency?: (string | null) | undefined + deleted: boolean + id: string + object: "bank_account" +} + +export type t_deleted_card = { + currency?: (string | null) | undefined + deleted: boolean + id: string + object: "card" +} + +export type t_deleted_coupon = { + deleted: boolean + id: string + object: "coupon" +} + +export type t_deleted_customer = { + deleted: boolean + id: string + object: "customer" +} + +export type t_deleted_discount = { + checkout_session?: (string | null) | undefined + coupon: t_coupon + customer?: (string | t_customer | t_deleted_customer | null) | undefined + deleted: boolean + id: string + invoice?: (string | null) | undefined + invoice_item?: (string | null) | undefined + object: "discount" + promotion_code?: (string | t_promotion_code | null) | undefined + start: number + subscription?: (string | null) | undefined + subscription_item?: (string | null) | undefined +} + +export type t_deleted_external_account = t_deleted_bank_account | t_deleted_card + +export type t_deleted_invoice = { + deleted: boolean + id: string + object: "invoice" +} + +export type t_deleted_invoiceitem = { + deleted: boolean + id: string + object: "invoiceitem" +} + +export type t_deleted_payment_source = t_deleted_bank_account | t_deleted_card + +export type t_deleted_person = { + deleted: boolean + id: string + object: "person" +} + +export type t_deleted_plan = { + deleted: boolean + id: string + object: "plan" +} + +export type t_deleted_price = { + deleted: boolean + id: string + object: "price" +} + +export type t_deleted_product = { + deleted: boolean + id: string + object: "product" +} + +export type t_deleted_product_feature = { + deleted: boolean + id: string + object: "product_feature" +} + +export type t_deleted_radar_value_list = { + deleted: boolean + id: string + object: "radar.value_list" +} + +export type t_deleted_radar_value_list_item = { + deleted: boolean + id: string + object: "radar.value_list_item" +} + +export type t_deleted_subscription_item = { + deleted: boolean + id: string + object: "subscription_item" +} + +export type t_deleted_tax_id = { + deleted: boolean + id: string + object: "tax_id" +} + +export type t_deleted_terminal_configuration = { + deleted: boolean + id: string + object: "terminal.configuration" +} + +export type t_deleted_terminal_location = { + deleted: boolean + id: string + object: "terminal.location" +} + +export type t_deleted_terminal_reader = { + deleted: boolean + id: string + object: "terminal.reader" +} + +export type t_deleted_test_helpers_test_clock = { + deleted: boolean + id: string + object: "test_helpers.test_clock" +} + +export type t_deleted_webhook_endpoint = { + deleted: boolean + id: string + object: "webhook_endpoint" +} + +export type t_destination_details_unimplemented = EmptyObject + +export type t_discount = { + checkout_session?: (string | null) | undefined + coupon: t_coupon + customer?: (string | t_customer | t_deleted_customer | null) | undefined + end?: (number | null) | undefined + id: string + invoice?: (string | null) | undefined + invoice_item?: (string | null) | undefined + object: "discount" + promotion_code?: (string | t_promotion_code | null) | undefined + start: number + subscription?: (string | null) | undefined + subscription_item?: (string | null) | undefined +} + +export type t_discounts_resource_discount_amount = { + amount: number + discount: string | t_discount | t_deleted_discount +} + +export type t_discounts_resource_stackable_discount = { + coupon?: (string | t_coupon | null) | undefined + discount?: (string | t_discount | null) | undefined + promotion_code?: (string | t_promotion_code | null) | undefined +} + +export type t_dispute = { + amount: number + balance_transactions: t_balance_transaction[] + charge: string | t_charge + created: number + currency: string + enhanced_eligibility_types: "visa_compelling_evidence_3"[] + evidence: t_dispute_evidence + evidence_details: t_dispute_evidence_details + id: string + is_charge_refundable: boolean + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "dispute" + payment_intent?: (string | t_payment_intent | null) | undefined + payment_method_details?: t_dispute_payment_method_details | undefined + reason: string + status: + | "lost" + | "needs_response" + | "under_review" + | "warning_closed" + | "warning_needs_response" + | "warning_under_review" + | "won" +} + +export type t_dispute_enhanced_eligibility = { + visa_compelling_evidence_3?: + | t_dispute_enhanced_eligibility_visa_compelling_evidence3 + | undefined + visa_compliance?: t_dispute_enhanced_eligibility_visa_compliance | undefined +} + +export type t_dispute_enhanced_eligibility_visa_compelling_evidence3 = { + required_actions: ( + | "missing_customer_identifiers" + | "missing_disputed_transaction_description" + | "missing_merchandise_or_services" + | "missing_prior_undisputed_transaction_description" + | "missing_prior_undisputed_transactions" + )[] + status: "not_qualified" | "qualified" | "requires_action" +} + +export type t_dispute_enhanced_eligibility_visa_compliance = { + status: "fee_acknowledged" | "requires_fee_acknowledgement" +} + +export type t_dispute_enhanced_evidence = { + visa_compelling_evidence_3?: + | t_dispute_enhanced_evidence_visa_compelling_evidence3 + | undefined + visa_compliance?: t_dispute_enhanced_evidence_visa_compliance | undefined +} + +export type t_dispute_enhanced_evidence_visa_compelling_evidence3 = { + disputed_transaction?: + | (t_dispute_visa_compelling_evidence3_disputed_transaction | null) + | undefined + prior_undisputed_transactions: t_dispute_visa_compelling_evidence3_prior_undisputed_transaction[] +} + +export type t_dispute_enhanced_evidence_visa_compliance = { + fee_acknowledged: boolean +} + +export type t_dispute_evidence = { + access_activity_log?: (string | null) | undefined + billing_address?: (string | null) | undefined + cancellation_policy?: (string | t_file | null) | undefined + cancellation_policy_disclosure?: (string | null) | undefined + cancellation_rebuttal?: (string | null) | undefined + customer_communication?: (string | t_file | null) | undefined + customer_email_address?: (string | null) | undefined + customer_name?: (string | null) | undefined + customer_purchase_ip?: (string | null) | undefined + customer_signature?: (string | t_file | null) | undefined + duplicate_charge_documentation?: (string | t_file | null) | undefined + duplicate_charge_explanation?: (string | null) | undefined + duplicate_charge_id?: (string | null) | undefined + enhanced_evidence: t_dispute_enhanced_evidence + product_description?: (string | null) | undefined + receipt?: (string | t_file | null) | undefined + refund_policy?: (string | t_file | null) | undefined + refund_policy_disclosure?: (string | null) | undefined + refund_refusal_explanation?: (string | null) | undefined + service_date?: (string | null) | undefined + service_documentation?: (string | t_file | null) | undefined + shipping_address?: (string | null) | undefined + shipping_carrier?: (string | null) | undefined + shipping_date?: (string | null) | undefined + shipping_documentation?: (string | t_file | null) | undefined + shipping_tracking_number?: (string | null) | undefined + uncategorized_file?: (string | t_file | null) | undefined + uncategorized_text?: (string | null) | undefined +} + +export type t_dispute_evidence_details = { + due_by?: (number | null) | undefined + enhanced_eligibility: t_dispute_enhanced_eligibility + has_evidence: boolean + past_due: boolean + submission_count: number +} + +export type t_dispute_payment_method_details = { + amazon_pay?: t_dispute_payment_method_details_amazon_pay | undefined + card?: t_dispute_payment_method_details_card | undefined + klarna?: t_dispute_payment_method_details_klarna | undefined + paypal?: t_dispute_payment_method_details_paypal | undefined + type: "amazon_pay" | "card" | "klarna" | "paypal" +} + +export type t_dispute_payment_method_details_amazon_pay = { + dispute_type?: ("chargeback" | "claim" | null) | undefined +} + +export type t_dispute_payment_method_details_card = { + brand: string + case_type: "chargeback" | "inquiry" + network_reason_code?: (string | null) | undefined +} + +export type t_dispute_payment_method_details_klarna = { + reason_code?: (string | null) | undefined +} + +export type t_dispute_payment_method_details_paypal = { + case_id?: (string | null) | undefined + reason_code?: (string | null) | undefined +} + +export type t_dispute_transaction_shipping_address = { + city?: (string | null) | undefined + country?: (string | null) | undefined + line1?: (string | null) | undefined + line2?: (string | null) | undefined + postal_code?: (string | null) | undefined + state?: (string | null) | undefined +} + +export type t_dispute_visa_compelling_evidence3_disputed_transaction = { + customer_account_id?: (string | null) | undefined + customer_device_fingerprint?: (string | null) | undefined + customer_device_id?: (string | null) | undefined + customer_email_address?: (string | null) | undefined + customer_purchase_ip?: (string | null) | undefined + merchandise_or_services?: ("merchandise" | "services" | null) | undefined + product_description?: (string | null) | undefined + shipping_address?: (t_dispute_transaction_shipping_address | null) | undefined +} + +export type t_dispute_visa_compelling_evidence3_prior_undisputed_transaction = { + charge: string + customer_account_id?: (string | null) | undefined + customer_device_fingerprint?: (string | null) | undefined + customer_device_id?: (string | null) | undefined + customer_email_address?: (string | null) | undefined + customer_purchase_ip?: (string | null) | undefined + product_description?: (string | null) | undefined + shipping_address?: (t_dispute_transaction_shipping_address | null) | undefined +} + +export type t_email_sent = { + email_sent_at: number + email_sent_to: string +} + +export type t_entitlements_active_entitlement = { + feature: string | t_entitlements_feature + id: string + livemode: boolean + lookup_key: string + object: "entitlements.active_entitlement" +} + +export type t_entitlements_feature = { + active: boolean + id: string + livemode: boolean + lookup_key: string + metadata: { + [key: string]: string | undefined + } + name: string + object: "entitlements.feature" +} + +export type t_ephemeral_key = { + created: number + expires: number + id: string + livemode: boolean + object: "ephemeral_key" + secret?: string | undefined +} + +export type t_error = { + error: t_api_errors +} + +export type t_event = { + account?: string | undefined + api_version?: (string | null) | undefined + created: number + data: t_notification_event_data + id: string + livemode: boolean + object: "event" + pending_webhooks: number + request?: (t_notification_event_request | null) | undefined + type: string +} + +export type t_exchange_rate = { + id: string + object: "exchange_rate" + rates: { + [key: string]: number | undefined + } +} + +export type t_external_account = t_bank_account | t_card + +export type t_external_account_requirements = { + currently_due?: (string[] | null) | undefined + errors?: (t_account_requirements_error[] | null) | undefined + past_due?: (string[] | null) | undefined + pending_verification?: (string[] | null) | undefined +} + +export type t_fee = { + amount: number + application?: (string | null) | undefined + currency: string + description?: (string | null) | undefined + type: string +} + +export type t_fee_refund = { + amount: number + balance_transaction?: (string | t_balance_transaction | null) | undefined + created: number + currency: string + fee: string | t_application_fee + id: string + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "fee_refund" +} + +export type t_file = { + created: number + expires_at?: (number | null) | undefined + filename?: (string | null) | undefined + id: string + links?: + | ({ + data: t_file_link[] + has_more: boolean + object: "list" + url: string + } | null) + | undefined + object: "file" + purpose: + | "account_requirement" + | "additional_verification" + | "business_icon" + | "business_logo" + | "customer_signature" + | "dispute_evidence" + | "document_provider_identity_document" + | "finance_report_run" + | "financial_account_statement" + | "identity_document" + | "identity_document_downloadable" + | "issuing_regulatory_reporting" + | "pci_document" + | "selfie" + | "sigma_scheduled_query" + | "tax_document_user_upload" + | "terminal_reader_splashscreen" + size: number + title?: (string | null) | undefined + type?: (string | null) | undefined + url?: (string | null) | undefined +} + +export type t_file_link = { + created: number + expired: boolean + expires_at?: (number | null) | undefined + file: string | t_file + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "file_link" + url?: (string | null) | undefined +} + +export type t_financial_connections_account = { + account_holder?: + | (t_bank_connections_resource_accountholder | null) + | undefined + balance?: (t_bank_connections_resource_balance | null) | undefined + balance_refresh?: + | (t_bank_connections_resource_balance_refresh | null) + | undefined + category: "cash" | "credit" | "investment" | "other" + created: number + display_name?: (string | null) | undefined + id: string + institution_name: string + last4?: (string | null) | undefined + livemode: boolean + object: "financial_connections.account" + ownership?: + | (string | t_financial_connections_account_ownership | null) + | undefined + ownership_refresh?: + | (t_bank_connections_resource_ownership_refresh | null) + | undefined + permissions?: + | (("balances" | "ownership" | "payment_method" | "transactions")[] | null) + | undefined + status: "active" | "disconnected" | "inactive" + subcategory: + | "checking" + | "credit_card" + | "line_of_credit" + | "mortgage" + | "other" + | "savings" + subscriptions?: ("transactions"[] | null) | undefined + supported_payment_method_types: ("link" | "us_bank_account")[] + transaction_refresh?: + | (t_bank_connections_resource_transaction_refresh | null) + | undefined +} + +export type t_financial_connections_account_owner = { + email?: (string | null) | undefined + id: string + name: string + object: "financial_connections.account_owner" + ownership: string + phone?: (string | null) | undefined + raw_address?: (string | null) | undefined + refreshed_at?: (number | null) | undefined +} + +export type t_financial_connections_account_ownership = { + created: number + id: string + object: "financial_connections.account_ownership" + owners: { + data: t_financial_connections_account_owner[] + has_more: boolean + object: "list" + url: string + } +} + +export type t_financial_connections_session = { + account_holder?: + | (t_bank_connections_resource_accountholder | null) + | undefined + accounts: { + data: t_financial_connections_account[] + has_more: boolean + object: "list" + url: string + } + client_secret: string + filters?: t_bank_connections_resource_link_account_session_filters | undefined + id: string + livemode: boolean + object: "financial_connections.session" + permissions: ("balances" | "ownership" | "payment_method" | "transactions")[] + prefetch?: (("balances" | "ownership" | "transactions")[] | null) | undefined + return_url?: string | undefined +} + +export type t_financial_connections_transaction = { + account: string + amount: number + currency: string + description: string + id: string + livemode: boolean + object: "financial_connections.transaction" + status: "pending" | "posted" | "void" + status_transitions: t_bank_connections_resource_transaction_resource_status_transitions + transacted_at: number + transaction_refresh: string + updated: number +} + +export type t_financial_reporting_finance_report_run_run_parameters = { + columns?: string[] | undefined + connected_account?: string | undefined + currency?: string | undefined + interval_end?: number | undefined + interval_start?: number | undefined + payout?: string | undefined + reporting_category?: string | undefined + timezone?: string | undefined +} + +export type t_forwarded_request_context = { + destination_duration: number + destination_ip_address: string +} + +export type t_forwarded_request_details = { + body: string + headers: t_forwarded_request_header[] + http_method: "POST" +} + +export type t_forwarded_request_header = { + name: string + value: string +} + +export type t_forwarded_response_details = { + body: string + headers: t_forwarded_request_header[] + status: number +} + +export type t_forwarding_request = { + created: number + id: string + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "forwarding.request" + payment_method: string + replacements: ( + | "card_cvc" + | "card_expiry" + | "card_number" + | "cardholder_name" + | "request_signature" + )[] + request_context?: (t_forwarded_request_context | null) | undefined + request_details?: (t_forwarded_request_details | null) | undefined + response_details?: (t_forwarded_response_details | null) | undefined + url?: (string | null) | undefined +} + +export type t_funding_instructions = { + bank_transfer: t_funding_instructions_bank_transfer + currency: string + funding_type: "bank_transfer" + livemode: boolean + object: "funding_instructions" +} + +export type t_funding_instructions_bank_transfer = { + country: string + financial_addresses: t_funding_instructions_bank_transfer_financial_address[] + type: "eu_bank_transfer" | "jp_bank_transfer" +} + +export type t_funding_instructions_bank_transfer_aba_record = { + account_holder_address: t_address + account_holder_name: string + account_number: string + account_type: string + bank_address: t_address + bank_name: string + routing_number: string +} + +export type t_funding_instructions_bank_transfer_financial_address = { + aba?: t_funding_instructions_bank_transfer_aba_record | undefined + iban?: t_funding_instructions_bank_transfer_iban_record | undefined + sort_code?: t_funding_instructions_bank_transfer_sort_code_record | undefined + spei?: t_funding_instructions_bank_transfer_spei_record | undefined + supported_networks?: + | ( + | "ach" + | "bacs" + | "domestic_wire_us" + | "fps" + | "sepa" + | "spei" + | "swift" + | "zengin" + )[] + | undefined + swift?: t_funding_instructions_bank_transfer_swift_record | undefined + type: "aba" | "iban" | "sort_code" | "spei" | "swift" | "zengin" + zengin?: t_funding_instructions_bank_transfer_zengin_record | undefined +} + +export type t_funding_instructions_bank_transfer_iban_record = { + account_holder_address: t_address + account_holder_name: string + bank_address: t_address + bic: string + country: string + iban: string +} + +export type t_funding_instructions_bank_transfer_sort_code_record = { + account_holder_address: t_address + account_holder_name: string + account_number: string + bank_address: t_address + sort_code: string +} + +export type t_funding_instructions_bank_transfer_spei_record = { + account_holder_address: t_address + account_holder_name: string + bank_address: t_address + bank_code: string + bank_name: string + clabe: string +} + +export type t_funding_instructions_bank_transfer_swift_record = { + account_holder_address: t_address + account_holder_name: string + account_number: string + account_type: string + bank_address: t_address + bank_name: string + swift_code: string +} + +export type t_funding_instructions_bank_transfer_zengin_record = { + account_holder_address: t_address + account_holder_name?: (string | null) | undefined + account_number?: (string | null) | undefined + account_type?: (string | null) | undefined + bank_address: t_address + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + branch_code?: (string | null) | undefined + branch_name?: (string | null) | undefined +} + +export type t_gelato_data_document_report_date_of_birth = { + day?: (number | null) | undefined + month?: (number | null) | undefined + year?: (number | null) | undefined +} + +export type t_gelato_data_document_report_expiration_date = { + day?: (number | null) | undefined + month?: (number | null) | undefined + year?: (number | null) | undefined +} + +export type t_gelato_data_document_report_issued_date = { + day?: (number | null) | undefined + month?: (number | null) | undefined + year?: (number | null) | undefined +} + +export type t_gelato_data_id_number_report_date = { + day?: (number | null) | undefined + month?: (number | null) | undefined + year?: (number | null) | undefined +} + +export type t_gelato_data_verified_outputs_date = { + day?: (number | null) | undefined + month?: (number | null) | undefined + year?: (number | null) | undefined +} + +export type t_gelato_document_report = { + address?: (t_address | null) | undefined + dob?: (t_gelato_data_document_report_date_of_birth | null) | undefined + error?: (t_gelato_document_report_error | null) | undefined + expiration_date?: + | (t_gelato_data_document_report_expiration_date | null) + | undefined + files?: (string[] | null) | undefined + first_name?: (string | null) | undefined + issued_date?: (t_gelato_data_document_report_issued_date | null) | undefined + issuing_country?: (string | null) | undefined + last_name?: (string | null) | undefined + number?: (string | null) | undefined + status: "unverified" | "verified" + type?: ("driving_license" | "id_card" | "passport" | null) | undefined +} + +export type t_gelato_document_report_error = { + code?: + | ( + | "document_expired" + | "document_type_not_supported" + | "document_unverified_other" + | null + ) + | undefined + reason?: (string | null) | undefined +} + +export type t_gelato_email_report = { + email?: (string | null) | undefined + error?: (t_gelato_email_report_error | null) | undefined + status: "unverified" | "verified" +} + +export type t_gelato_email_report_error = { + code?: + | ("email_unverified_other" | "email_verification_declined" | null) + | undefined + reason?: (string | null) | undefined +} + +export type t_gelato_id_number_report = { + dob?: (t_gelato_data_id_number_report_date | null) | undefined + error?: (t_gelato_id_number_report_error | null) | undefined + first_name?: (string | null) | undefined + id_number?: (string | null) | undefined + id_number_type?: ("br_cpf" | "sg_nric" | "us_ssn" | null) | undefined + last_name?: (string | null) | undefined + status: "unverified" | "verified" +} + +export type t_gelato_id_number_report_error = { + code?: + | ( + | "id_number_insufficient_document_data" + | "id_number_mismatch" + | "id_number_unverified_other" + | null + ) + | undefined + reason?: (string | null) | undefined +} + +export type t_gelato_phone_report = { + error?: (t_gelato_phone_report_error | null) | undefined + phone?: (string | null) | undefined + status: "unverified" | "verified" +} + +export type t_gelato_phone_report_error = { + code?: + | ("phone_unverified_other" | "phone_verification_declined" | null) + | undefined + reason?: (string | null) | undefined +} + +export type t_gelato_provided_details = { + email?: string | undefined + phone?: string | undefined +} + +export type t_gelato_report_document_options = { + allowed_types?: ("driving_license" | "id_card" | "passport")[] | undefined + require_id_number?: boolean | undefined + require_live_capture?: boolean | undefined + require_matching_selfie?: boolean | undefined +} + +export type t_gelato_report_id_number_options = EmptyObject + +export type t_gelato_selfie_report = { + document?: (string | null) | undefined + error?: (t_gelato_selfie_report_error | null) | undefined + selfie?: (string | null) | undefined + status: "unverified" | "verified" +} + +export type t_gelato_selfie_report_error = { + code?: + | ( + | "selfie_document_missing_photo" + | "selfie_face_mismatch" + | "selfie_manipulated" + | "selfie_unverified_other" + | null + ) + | undefined + reason?: (string | null) | undefined +} + +export type t_gelato_session_document_options = { + allowed_types?: ("driving_license" | "id_card" | "passport")[] | undefined + require_id_number?: boolean | undefined + require_live_capture?: boolean | undefined + require_matching_selfie?: boolean | undefined +} + +export type t_gelato_session_email_options = { + require_verification?: boolean | undefined +} + +export type t_gelato_session_id_number_options = EmptyObject + +export type t_gelato_session_last_error = { + code?: + | ( + | "abandoned" + | "consent_declined" + | "country_not_supported" + | "device_not_supported" + | "document_expired" + | "document_type_not_supported" + | "document_unverified_other" + | "email_unverified_other" + | "email_verification_declined" + | "id_number_insufficient_document_data" + | "id_number_mismatch" + | "id_number_unverified_other" + | "phone_unverified_other" + | "phone_verification_declined" + | "selfie_document_missing_photo" + | "selfie_face_mismatch" + | "selfie_manipulated" + | "selfie_unverified_other" + | "under_supported_age" + | null + ) + | undefined + reason?: (string | null) | undefined +} + +export type t_gelato_session_phone_options = { + require_verification?: boolean | undefined +} + +export type t_gelato_verification_report_options = { + document?: t_gelato_report_document_options | undefined + id_number?: t_gelato_report_id_number_options | undefined +} + +export type t_gelato_verification_session_options = { + document?: t_gelato_session_document_options | undefined + email?: t_gelato_session_email_options | undefined + id_number?: t_gelato_session_id_number_options | undefined + phone?: t_gelato_session_phone_options | undefined +} + +export type t_gelato_verified_outputs = { + address?: (t_address | null) | undefined + dob?: (t_gelato_data_verified_outputs_date | null) | undefined + email?: (string | null) | undefined + first_name?: (string | null) | undefined + id_number?: (string | null) | undefined + id_number_type?: ("br_cpf" | "sg_nric" | "us_ssn" | null) | undefined + last_name?: (string | null) | undefined + phone?: (string | null) | undefined +} + +export type t_identity_verification_report = { + client_reference_id?: (string | null) | undefined + created: number + document?: t_gelato_document_report | undefined + email?: t_gelato_email_report | undefined + id: string + id_number?: t_gelato_id_number_report | undefined + livemode: boolean + object: "identity.verification_report" + options?: t_gelato_verification_report_options | undefined + phone?: t_gelato_phone_report | undefined + selfie?: t_gelato_selfie_report | undefined + type: "document" | "id_number" | "verification_flow" + verification_flow?: string | undefined + verification_session?: (string | null) | undefined +} + +export type t_identity_verification_session = { + client_reference_id?: (string | null) | undefined + client_secret?: (string | null) | undefined + created: number + id: string + last_error?: (t_gelato_session_last_error | null) | undefined + last_verification_report?: + | (string | t_identity_verification_report | null) + | undefined + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "identity.verification_session" + options?: (t_gelato_verification_session_options | null) | undefined + provided_details?: (t_gelato_provided_details | null) | undefined + redaction?: (t_verification_session_redaction | null) | undefined + related_customer?: (string | null) | undefined + status: "canceled" | "processing" | "requires_input" | "verified" + type: "document" | "id_number" | "verification_flow" + url?: (string | null) | undefined + verification_flow?: string | undefined + verified_outputs?: (t_gelato_verified_outputs | null) | undefined +} + +export type t_inbound_transfers = { + billing_details: t_treasury_shared_resource_billing_details + type: "us_bank_account" + us_bank_account?: + | t_inbound_transfers_payment_method_details_us_bank_account + | undefined +} + +export type t_inbound_transfers_payment_method_details_us_bank_account = { + account_holder_type?: ("company" | "individual" | null) | undefined + account_type?: ("checking" | "savings" | null) | undefined + bank_name?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + mandate?: (string | t_mandate) | undefined + network: "ach" + routing_number?: (string | null) | undefined +} + +export type t_internal_card = { + brand?: (string | null) | undefined + country?: (string | null) | undefined + exp_month?: (number | null) | undefined + exp_year?: (number | null) | undefined + last4?: (string | null) | undefined +} + +export type t_invoice = { + account_country?: (string | null) | undefined + account_name?: (string | null) | undefined + account_tax_ids?: + | ((string | t_tax_id | t_deleted_tax_id)[] | null) + | undefined + amount_due: number + amount_overpaid: number + amount_paid: number + amount_remaining: number + amount_shipping: number + application?: + | (string | t_application | t_deleted_application | null) + | undefined + attempt_count: number + attempted: boolean + auto_advance: boolean + automatic_tax: t_automatic_tax + automatically_finalizes_at?: (number | null) | undefined + billing_reason?: + | ( + | "automatic_pending_invoice_item_invoice" + | "manual" + | "quote_accept" + | "subscription" + | "subscription_create" + | "subscription_cycle" + | "subscription_threshold" + | "subscription_update" + | "upcoming" + | null + ) + | undefined + collection_method: "charge_automatically" | "send_invoice" + confirmation_secret?: + | (t_invoices_resource_confirmation_secret | null) + | undefined + created: number + currency: string + custom_fields?: (t_invoice_setting_custom_field[] | null) | undefined + customer: string | t_customer | t_deleted_customer + customer_address?: (t_address | null) | undefined + customer_email?: (string | null) | undefined + customer_name?: (string | null) | undefined + customer_phone?: (string | null) | undefined + customer_shipping?: (t_shipping | null) | undefined + customer_tax_exempt?: ("exempt" | "none" | "reverse" | null) | undefined + customer_tax_ids?: (t_invoices_resource_invoice_tax_id[] | null) | undefined + default_payment_method?: (string | t_payment_method | null) | undefined + default_source?: + | (string | t_bank_account | t_card | t_source | null) + | undefined + default_tax_rates: t_tax_rate[] + description?: (string | null) | undefined + discounts: (string | t_discount | t_deleted_discount)[] + due_date?: (number | null) | undefined + effective_at?: (number | null) | undefined + ending_balance?: (number | null) | undefined + footer?: (string | null) | undefined + from_invoice?: (t_invoices_resource_from_invoice | null) | undefined + hosted_invoice_url?: (string | null) | undefined + id: string + invoice_pdf?: (string | null) | undefined + issuer: t_connect_account_reference + last_finalization_error?: (t_api_errors | null) | undefined + latest_revision?: (string | t_invoice | null) | undefined + lines: { + data: t_line_item[] + has_more: boolean + object: "list" + url: string + } + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + next_payment_attempt?: (number | null) | undefined + number?: (string | null) | undefined + object: "invoice" + on_behalf_of?: (string | t_account | null) | undefined + parent?: + | (t_billing_bill_resource_invoicing_parents_invoice_parent | null) + | undefined + payment_settings: t_invoices_payment_settings + payments?: + | { + data: t_invoice_payment[] + has_more: boolean + object: "list" + url: string + } + | undefined + period_end: number + period_start: number + post_payment_credit_notes_amount: number + pre_payment_credit_notes_amount: number + receipt_number?: (string | null) | undefined + rendering?: (t_invoices_resource_invoice_rendering | null) | undefined + shipping_cost?: (t_invoices_resource_shipping_cost | null) | undefined + shipping_details?: (t_shipping | null) | undefined + starting_balance: number + statement_descriptor?: (string | null) | undefined + status?: + | ("draft" | "open" | "paid" | "uncollectible" | "void" | null) + | undefined + status_transitions: t_invoices_resource_status_transitions + subtotal: number + subtotal_excluding_tax?: (number | null) | undefined + test_clock?: (string | t_test_helpers_test_clock | null) | undefined + threshold_reason?: t_invoice_threshold_reason | undefined + total: number + total_discount_amounts?: + | (t_discounts_resource_discount_amount[] | null) + | undefined + total_excluding_tax?: (number | null) | undefined + total_pretax_credit_amounts?: + | (t_invoices_resource_pretax_credit_amount[] | null) + | undefined + total_taxes?: + | (t_billing_bill_resource_invoicing_taxes_tax[] | null) + | undefined + webhooks_delivered_at?: (number | null) | undefined +} + +export type t_invoice_installments_card = { + enabled?: (boolean | null) | undefined +} + +export type t_invoice_item_threshold_reason = { + line_item_ids: string[] + usage_gte: number +} + +export type t_invoice_line_item_period = { + end: number + start: number +} + +export type t_invoice_mandate_options_card = { + amount?: (number | null) | undefined + amount_type?: ("fixed" | "maximum" | null) | undefined + description?: (string | null) | undefined +} + +export type t_invoice_payment = { + amount_paid?: (number | null) | undefined + amount_requested: number + created: number + currency: string + id: string + invoice: string | t_invoice | t_deleted_invoice + is_default: boolean + livemode: boolean + object: "invoice_payment" + payment: t_invoices_payments_invoice_payment_associated_payment + status: string + status_transitions: t_invoices_payments_invoice_payment_status_transitions +} + +export type t_invoice_payment_method_options_acss_debit = { + mandate_options?: + | t_invoice_payment_method_options_acss_debit_mandate_options + | undefined + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_invoice_payment_method_options_acss_debit_mandate_options = { + transaction_type?: ("business" | "personal" | null) | undefined +} + +export type t_invoice_payment_method_options_bancontact = { + preferred_language: "de" | "en" | "fr" | "nl" +} + +export type t_invoice_payment_method_options_card = { + installments?: t_invoice_installments_card | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge" | null) + | undefined +} + +export type t_invoice_payment_method_options_customer_balance = { + bank_transfer?: + | t_invoice_payment_method_options_customer_balance_bank_transfer + | undefined + funding_type?: ("bank_transfer" | null) | undefined +} + +export type t_invoice_payment_method_options_customer_balance_bank_transfer = { + eu_bank_transfer?: + | t_invoice_payment_method_options_customer_balance_bank_transfer_eu_bank_transfer + | undefined + type?: (string | null) | undefined +} + +export type t_invoice_payment_method_options_customer_balance_bank_transfer_eu_bank_transfer = + { + country: "BE" | "DE" | "ES" | "FR" | "IE" | "NL" + } + +export type t_invoice_payment_method_options_konbini = EmptyObject + +export type t_invoice_payment_method_options_sepa_debit = EmptyObject + +export type t_invoice_payment_method_options_us_bank_account = { + financial_connections?: + | t_invoice_payment_method_options_us_bank_account_linked_account_options + | undefined + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_invoice_payment_method_options_us_bank_account_linked_account_options = + { + filters?: + | t_invoice_payment_method_options_us_bank_account_linked_account_options_filters + | undefined + permissions?: + | ("balances" | "ownership" | "payment_method" | "transactions")[] + | undefined + prefetch?: + | (("balances" | "ownership" | "transactions")[] | null) + | undefined + } + +export type t_invoice_payment_method_options_us_bank_account_linked_account_options_filters = + { + account_subcategories?: ("checking" | "savings")[] | undefined + } + +export type t_invoice_rendering_pdf = { + page_size?: ("a4" | "auto" | "letter" | null) | undefined +} + +export type t_invoice_rendering_template = { + created: number + id: string + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + nickname?: (string | null) | undefined + object: "invoice_rendering_template" + status: "active" | "archived" + version: number +} + +export type t_invoice_setting_checkout_rendering_options = { + amount_tax_display?: (string | null) | undefined +} + +export type t_invoice_setting_custom_field = { + name: string + value: string +} + +export type t_invoice_setting_customer_rendering_options = { + amount_tax_display?: (string | null) | undefined + template?: (string | null) | undefined +} + +export type t_invoice_setting_customer_setting = { + custom_fields?: (t_invoice_setting_custom_field[] | null) | undefined + default_payment_method?: (string | t_payment_method | null) | undefined + footer?: (string | null) | undefined + rendering_options?: + | (t_invoice_setting_customer_rendering_options | null) + | undefined +} + +export type t_invoice_setting_quote_setting = { + days_until_due?: (number | null) | undefined + issuer: t_connect_account_reference +} + +export type t_invoice_setting_subscription_schedule_phase_setting = { + account_tax_ids?: + | ((string | t_tax_id | t_deleted_tax_id)[] | null) + | undefined + days_until_due?: (number | null) | undefined + issuer?: (t_connect_account_reference | null) | undefined +} + +export type t_invoice_setting_subscription_schedule_setting = { + account_tax_ids?: + | ((string | t_tax_id | t_deleted_tax_id)[] | null) + | undefined + days_until_due?: (number | null) | undefined + issuer: t_connect_account_reference +} + +export type t_invoice_threshold_reason = { + amount_gte?: (number | null) | undefined + item_reasons: t_invoice_item_threshold_reason[] +} + +export type t_invoiceitem = { + amount: number + currency: string + customer: string | t_customer | t_deleted_customer + date: number + description?: (string | null) | undefined + discountable: boolean + discounts?: ((string | t_discount)[] | null) | undefined + id: string + invoice?: (string | t_invoice | null) | undefined + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "invoiceitem" + parent?: + | (t_billing_bill_resource_invoice_item_parents_invoice_item_parent | null) + | undefined + period: t_invoice_line_item_period + pricing?: + | (t_billing_bill_resource_invoicing_pricing_pricing | null) + | undefined + proration: boolean + quantity: number + tax_rates?: (t_tax_rate[] | null) | undefined + test_clock?: (string | t_test_helpers_test_clock | null) | undefined +} + +export type t_invoices_payment_method_options = { + acss_debit?: (t_invoice_payment_method_options_acss_debit | null) | undefined + bancontact?: (t_invoice_payment_method_options_bancontact | null) | undefined + card?: (t_invoice_payment_method_options_card | null) | undefined + customer_balance?: + | (t_invoice_payment_method_options_customer_balance | null) + | undefined + konbini?: (t_invoice_payment_method_options_konbini | null) | undefined + sepa_debit?: (t_invoice_payment_method_options_sepa_debit | null) | undefined + us_bank_account?: + | (t_invoice_payment_method_options_us_bank_account | null) + | undefined +} + +export type t_invoices_payment_settings = { + default_mandate?: (string | null) | undefined + payment_method_options?: + | (t_invoices_payment_method_options | null) + | undefined + payment_method_types?: + | ( + | ( + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "jp_credit_transfer" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "p24" + | "payco" + | "paynow" + | "paypal" + | "promptpay" + | "revolut_pay" + | "sepa_credit_transfer" + | "sepa_debit" + | "sofort" + | "swish" + | "us_bank_account" + | "wechat_pay" + )[] + | null + ) + | undefined +} + +export type t_invoices_payments_invoice_payment_associated_payment = { + charge?: (string | t_charge) | undefined + payment_intent?: (string | t_payment_intent) | undefined + type: "charge" | "payment_intent" +} + +export type t_invoices_payments_invoice_payment_status_transitions = { + canceled_at?: (number | null) | undefined + paid_at?: (number | null) | undefined +} + +export type t_invoices_resource_confirmation_secret = { + client_secret: string + type: string +} + +export type t_invoices_resource_from_invoice = { + action: string + invoice: string | t_invoice +} + +export type t_invoices_resource_invoice_rendering = { + amount_tax_display?: (string | null) | undefined + pdf?: (t_invoice_rendering_pdf | null) | undefined + template?: (string | null) | undefined + template_version?: (number | null) | undefined +} + +export type t_invoices_resource_invoice_tax_id = { + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "unknown" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value?: (string | null) | undefined +} + +export type t_invoices_resource_pretax_credit_amount = { + amount: number + credit_balance_transaction?: + | (string | t_billing_credit_balance_transaction | null) + | undefined + discount?: (string | t_discount | t_deleted_discount) | undefined + type: "credit_balance_transaction" | "discount" +} + +export type t_invoices_resource_shipping_cost = { + amount_subtotal: number + amount_tax: number + amount_total: number + shipping_rate?: (string | t_shipping_rate | null) | undefined + taxes?: t_line_items_tax_amount[] | undefined +} + +export type t_invoices_resource_status_transitions = { + finalized_at?: (number | null) | undefined + marked_uncollectible_at?: (number | null) | undefined + paid_at?: (number | null) | undefined + voided_at?: (number | null) | undefined +} + +export type t_issuing_authorization = { + amount: number + amount_details?: (t_issuing_authorization_amount_details | null) | undefined + approved: boolean + authorization_method: "chip" | "contactless" | "keyed_in" | "online" | "swipe" + balance_transactions: t_balance_transaction[] + card: t_issuing_card + cardholder?: (string | t_issuing_cardholder | null) | undefined + created: number + currency: string + fleet?: (t_issuing_authorization_fleet_data | null) | undefined + fraud_challenges?: + | (t_issuing_authorization_fraud_challenge[] | null) + | undefined + fuel?: (t_issuing_authorization_fuel_data | null) | undefined + id: string + livemode: boolean + merchant_amount: number + merchant_currency: string + merchant_data: t_issuing_authorization_merchant_data + metadata: { + [key: string]: string | undefined + } + network_data?: (t_issuing_authorization_network_data | null) | undefined + object: "issuing.authorization" + pending_request?: (t_issuing_authorization_pending_request | null) | undefined + request_history: t_issuing_authorization_request[] + status: "closed" | "expired" | "pending" | "reversed" + token?: (string | t_issuing_token | null) | undefined + transactions: t_issuing_transaction[] + treasury?: (t_issuing_authorization_treasury | null) | undefined + verification_data: t_issuing_authorization_verification_data + verified_by_fraud_challenge?: (boolean | null) | undefined + wallet?: (string | null) | undefined +} + +export type t_issuing_card = { + brand: string + cancellation_reason?: + | ("design_rejected" | "lost" | "stolen" | null) + | undefined + cardholder: t_issuing_cardholder + created: number + currency: string + cvc?: string | undefined + exp_month: number + exp_year: number + financial_account?: (string | null) | undefined + id: string + last4: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + number?: string | undefined + object: "issuing.card" + personalization_design?: + | (string | t_issuing_personalization_design | null) + | undefined + replaced_by?: (string | t_issuing_card | null) | undefined + replacement_for?: (string | t_issuing_card | null) | undefined + replacement_reason?: + | ("damaged" | "expired" | "lost" | "stolen" | null) + | undefined + shipping?: (t_issuing_card_shipping | null) | undefined + spending_controls: t_issuing_card_authorization_controls + status: "active" | "canceled" | "inactive" + type: "physical" | "virtual" + wallets?: (t_issuing_card_wallets | null) | undefined +} + +export type t_issuing_cardholder = { + billing: t_issuing_cardholder_address + company?: (t_issuing_cardholder_company | null) | undefined + created: number + email?: (string | null) | undefined + id: string + individual?: (t_issuing_cardholder_individual | null) | undefined + livemode: boolean + metadata: { + [key: string]: string | undefined + } + name: string + object: "issuing.cardholder" + phone_number?: (string | null) | undefined + preferred_locales?: (("de" | "en" | "es" | "fr" | "it")[] | null) | undefined + requirements: t_issuing_cardholder_requirements + spending_controls?: + | (t_issuing_cardholder_authorization_controls | null) + | undefined + status: "active" | "blocked" | "inactive" + type: "company" | "individual" +} + +export type t_issuing_dispute = { + amount: number + balance_transactions?: (t_balance_transaction[] | null) | undefined + created: number + currency: string + evidence: t_issuing_dispute_evidence + id: string + livemode: boolean + loss_reason?: + | ( + | "cardholder_authentication_issuer_liability" + | "eci5_token_transaction_with_tavv" + | "excess_disputes_in_timeframe" + | "has_not_met_the_minimum_dispute_amount_requirements" + | "invalid_duplicate_dispute" + | "invalid_incorrect_amount_dispute" + | "invalid_no_authorization" + | "invalid_use_of_disputes" + | "merchandise_delivered_or_shipped" + | "merchandise_or_service_as_described" + | "not_cancelled" + | "other" + | "refund_issued" + | "submitted_beyond_allowable_time_limit" + | "transaction_3ds_required" + | "transaction_approved_after_prior_fraud_dispute" + | "transaction_authorized" + | "transaction_electronically_read" + | "transaction_qualifies_for_visa_easy_payment_service" + | "transaction_unattended" + ) + | undefined + metadata: { + [key: string]: string | undefined + } + object: "issuing.dispute" + status: "expired" | "lost" | "submitted" | "unsubmitted" | "won" + transaction: string | t_issuing_transaction + treasury?: (t_issuing_dispute_treasury | null) | undefined +} + +export type t_issuing_personalization_design = { + card_logo?: (string | t_file | null) | undefined + carrier_text?: + | (t_issuing_personalization_design_carrier_text | null) + | undefined + created: number + id: string + livemode: boolean + lookup_key?: (string | null) | undefined + metadata: { + [key: string]: string | undefined + } + name?: (string | null) | undefined + object: "issuing.personalization_design" + physical_bundle: string | t_issuing_physical_bundle + preferences: t_issuing_personalization_design_preferences + rejection_reasons: t_issuing_personalization_design_rejection_reasons + status: "active" | "inactive" | "rejected" | "review" +} + +export type t_issuing_physical_bundle = { + features: t_issuing_physical_bundle_features + id: string + livemode: boolean + name: string + object: "issuing.physical_bundle" + status: "active" | "inactive" | "review" + type: "custom" | "standard" +} + +export type t_issuing_settlement = { + bin: string + clearing_date: number + created: number + currency: string + id: string + interchange_fees_amount: number + livemode: boolean + metadata: { + [key: string]: string | undefined + } + net_total_amount: number + network: "maestro" | "visa" + network_fees_amount: number + network_settlement_identifier: string + object: "issuing.settlement" + settlement_service: string + status: "complete" | "pending" + transaction_amount: number + transaction_count: number +} + +export type t_issuing_token = { + card: string | t_issuing_card + created: number + device_fingerprint?: (string | null) | undefined + id: string + last4?: string | undefined + livemode: boolean + network: "mastercard" | "visa" + network_data?: t_issuing_network_token_network_data | undefined + network_updated_at: number + object: "issuing.token" + status: "active" | "deleted" | "requested" | "suspended" + wallet_provider?: ("apple_pay" | "google_pay" | "samsung_pay") | undefined +} + +export type t_issuing_transaction = { + amount: number + amount_details?: (t_issuing_transaction_amount_details | null) | undefined + authorization?: (string | t_issuing_authorization | null) | undefined + balance_transaction?: (string | t_balance_transaction | null) | undefined + card: string | t_issuing_card + cardholder?: (string | t_issuing_cardholder | null) | undefined + created: number + currency: string + dispute?: (string | t_issuing_dispute | null) | undefined + id: string + livemode: boolean + merchant_amount: number + merchant_currency: string + merchant_data: t_issuing_authorization_merchant_data + metadata: { + [key: string]: string | undefined + } + network_data?: (t_issuing_transaction_network_data | null) | undefined + object: "issuing.transaction" + purchase_details?: (t_issuing_transaction_purchase_details | null) | undefined + token?: (string | t_issuing_token | null) | undefined + treasury?: (t_issuing_transaction_treasury | null) | undefined + type: "capture" | "refund" + wallet?: ("apple_pay" | "google_pay" | "samsung_pay" | null) | undefined +} + +export type t_issuing_authorization_amount_details = { + atm_fee?: (number | null) | undefined + cashback_amount?: (number | null) | undefined +} + +export type t_issuing_authorization_authentication_exemption = { + claimed_by: "acquirer" | "issuer" + type: "low_value_transaction" | "transaction_risk_analysis" | "unknown" +} + +export type t_issuing_authorization_fleet_cardholder_prompt_data = { + alphanumeric_id?: (string | null) | undefined + driver_id?: (string | null) | undefined + odometer?: (number | null) | undefined + unspecified_id?: (string | null) | undefined + user_id?: (string | null) | undefined + vehicle_number?: (string | null) | undefined +} + +export type t_issuing_authorization_fleet_data = { + cardholder_prompt_data?: + | (t_issuing_authorization_fleet_cardholder_prompt_data | null) + | undefined + purchase_type?: + | ( + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + | null + ) + | undefined + reported_breakdown?: + | (t_issuing_authorization_fleet_reported_breakdown | null) + | undefined + service_type?: + | ("full_service" | "non_fuel_transaction" | "self_service" | null) + | undefined +} + +export type t_issuing_authorization_fleet_fuel_price_data = { + gross_amount_decimal?: (string | null) | undefined +} + +export type t_issuing_authorization_fleet_non_fuel_price_data = { + gross_amount_decimal?: (string | null) | undefined +} + +export type t_issuing_authorization_fleet_reported_breakdown = { + fuel?: (t_issuing_authorization_fleet_fuel_price_data | null) | undefined + non_fuel?: + | (t_issuing_authorization_fleet_non_fuel_price_data | null) + | undefined + tax?: (t_issuing_authorization_fleet_tax_data | null) | undefined +} + +export type t_issuing_authorization_fleet_tax_data = { + local_amount_decimal?: (string | null) | undefined + national_amount_decimal?: (string | null) | undefined +} + +export type t_issuing_authorization_fraud_challenge = { + channel: "sms" + status: "expired" | "pending" | "rejected" | "undeliverable" | "verified" + undeliverable_reason?: + | ("no_phone_number" | "unsupported_phone_number" | null) + | undefined +} + +export type t_issuing_authorization_fuel_data = { + industry_product_code?: (string | null) | undefined + quantity_decimal?: (string | null) | undefined + type?: + | ( + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + | null + ) + | undefined + unit?: + | ( + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + | null + ) + | undefined + unit_cost_decimal?: (string | null) | undefined +} + +export type t_issuing_authorization_merchant_data = { + category: string + category_code: string + city?: (string | null) | undefined + country?: (string | null) | undefined + name?: (string | null) | undefined + network_id: string + postal_code?: (string | null) | undefined + state?: (string | null) | undefined + tax_id?: (string | null) | undefined + terminal_id?: (string | null) | undefined + url?: (string | null) | undefined +} + +export type t_issuing_authorization_network_data = { + acquiring_institution_id?: (string | null) | undefined + system_trace_audit_number?: (string | null) | undefined + transaction_id?: (string | null) | undefined +} + +export type t_issuing_authorization_pending_request = { + amount: number + amount_details?: (t_issuing_authorization_amount_details | null) | undefined + currency: string + is_amount_controllable: boolean + merchant_amount: number + merchant_currency: string + network_risk_score?: (number | null) | undefined +} + +export type t_issuing_authorization_request = { + amount: number + amount_details?: (t_issuing_authorization_amount_details | null) | undefined + approved: boolean + authorization_code?: (string | null) | undefined + created: number + currency: string + merchant_amount: number + merchant_currency: string + network_risk_score?: (number | null) | undefined + reason: + | "account_disabled" + | "card_active" + | "card_canceled" + | "card_expired" + | "card_inactive" + | "cardholder_blocked" + | "cardholder_inactive" + | "cardholder_verification_required" + | "insecure_authorization_method" + | "insufficient_funds" + | "network_fallback" + | "not_allowed" + | "pin_blocked" + | "spending_controls" + | "suspected_fraud" + | "verification_failed" + | "webhook_approved" + | "webhook_declined" + | "webhook_error" + | "webhook_timeout" + reason_message?: (string | null) | undefined + requested_at?: (number | null) | undefined +} + +export type t_issuing_authorization_three_d_secure = { + result: "attempt_acknowledged" | "authenticated" | "failed" | "required" +} + +export type t_issuing_authorization_treasury = { + received_credits: string[] + received_debits: string[] + transaction?: (string | null) | undefined +} + +export type t_issuing_authorization_verification_data = { + address_line1_check: "match" | "mismatch" | "not_provided" + address_postal_code_check: "match" | "mismatch" | "not_provided" + authentication_exemption?: + | (t_issuing_authorization_authentication_exemption | null) + | undefined + cvc_check: "match" | "mismatch" | "not_provided" + expiry_check: "match" | "mismatch" | "not_provided" + postal_code?: (string | null) | undefined + three_d_secure?: (t_issuing_authorization_three_d_secure | null) | undefined +} + +export type t_issuing_card_apple_pay = { + eligible: boolean + ineligible_reason?: + | ( + | "missing_agreement" + | "missing_cardholder_contact" + | "unsupported_region" + | null + ) + | undefined +} + +export type t_issuing_card_authorization_controls = { + allowed_categories?: + | ( + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | null + ) + | undefined + allowed_merchant_countries?: (string[] | null) | undefined + blocked_categories?: + | ( + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | null + ) + | undefined + blocked_merchant_countries?: (string[] | null) | undefined + spending_limits?: (t_issuing_card_spending_limit[] | null) | undefined + spending_limits_currency?: (string | null) | undefined +} + +export type t_issuing_card_google_pay = { + eligible: boolean + ineligible_reason?: + | ( + | "missing_agreement" + | "missing_cardholder_contact" + | "unsupported_region" + | null + ) + | undefined +} + +export type t_issuing_card_shipping = { + address: t_address + address_validation?: + | (t_issuing_card_shipping_address_validation | null) + | undefined + carrier?: ("dhl" | "fedex" | "royal_mail" | "usps" | null) | undefined + customs?: (t_issuing_card_shipping_customs | null) | undefined + eta?: (number | null) | undefined + name: string + phone_number?: (string | null) | undefined + require_signature?: (boolean | null) | undefined + service: "express" | "priority" | "standard" + status?: + | ( + | "canceled" + | "delivered" + | "failure" + | "pending" + | "returned" + | "shipped" + | "submitted" + | null + ) + | undefined + tracking_number?: (string | null) | undefined + tracking_url?: (string | null) | undefined + type: "bulk" | "individual" +} + +export type t_issuing_card_shipping_address_validation = { + mode: "disabled" | "normalization_only" | "validation_and_normalization" + normalized_address?: (t_address | null) | undefined + result?: + | ("indeterminate" | "likely_deliverable" | "likely_undeliverable" | null) + | undefined +} + +export type t_issuing_card_shipping_customs = { + eori_number?: (string | null) | undefined +} + +export type t_issuing_card_spending_limit = { + amount: number + categories?: + | ( + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | null + ) + | undefined + interval: + | "all_time" + | "daily" + | "monthly" + | "per_authorization" + | "weekly" + | "yearly" +} + +export type t_issuing_card_wallets = { + apple_pay: t_issuing_card_apple_pay + google_pay: t_issuing_card_google_pay + primary_account_identifier?: (string | null) | undefined +} + +export type t_issuing_cardholder_address = { + address: t_address +} + +export type t_issuing_cardholder_authorization_controls = { + allowed_categories?: + | ( + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | null + ) + | undefined + allowed_merchant_countries?: (string[] | null) | undefined + blocked_categories?: + | ( + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | null + ) + | undefined + blocked_merchant_countries?: (string[] | null) | undefined + spending_limits?: (t_issuing_cardholder_spending_limit[] | null) | undefined + spending_limits_currency?: (string | null) | undefined +} + +export type t_issuing_cardholder_card_issuing = { + user_terms_acceptance?: + | (t_issuing_cardholder_user_terms_acceptance | null) + | undefined +} + +export type t_issuing_cardholder_company = { + tax_id_provided: boolean +} + +export type t_issuing_cardholder_id_document = { + back?: (string | t_file | null) | undefined + front?: (string | t_file | null) | undefined +} + +export type t_issuing_cardholder_individual = { + card_issuing?: (t_issuing_cardholder_card_issuing | null) | undefined + dob?: (t_issuing_cardholder_individual_dob | null) | undefined + first_name?: (string | null) | undefined + last_name?: (string | null) | undefined + verification?: (t_issuing_cardholder_verification | null) | undefined +} + +export type t_issuing_cardholder_individual_dob = { + day?: (number | null) | undefined + month?: (number | null) | undefined + year?: (number | null) | undefined +} + +export type t_issuing_cardholder_requirements = { + disabled_reason?: + | ( + | "listed" + | "rejected.listed" + | "requirements.past_due" + | "under_review" + | null + ) + | undefined + past_due?: + | ( + | ( + | "company.tax_id" + | "individual.card_issuing.user_terms_acceptance.date" + | "individual.card_issuing.user_terms_acceptance.ip" + | "individual.dob.day" + | "individual.dob.month" + | "individual.dob.year" + | "individual.first_name" + | "individual.last_name" + | "individual.verification.document" + )[] + | null + ) + | undefined +} + +export type t_issuing_cardholder_spending_limit = { + amount: number + categories?: + | ( + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | null + ) + | undefined + interval: + | "all_time" + | "daily" + | "monthly" + | "per_authorization" + | "weekly" + | "yearly" +} + +export type t_issuing_cardholder_user_terms_acceptance = { + date?: (number | null) | undefined + ip?: (string | null) | undefined + user_agent?: (string | null) | undefined +} + +export type t_issuing_cardholder_verification = { + document?: (t_issuing_cardholder_id_document | null) | undefined +} + +export type t_issuing_dispute_canceled_evidence = { + additional_documentation?: (string | t_file | null) | undefined + canceled_at?: (number | null) | undefined + cancellation_policy_provided?: (boolean | null) | undefined + cancellation_reason?: (string | null) | undefined + expected_at?: (number | null) | undefined + explanation?: (string | null) | undefined + product_description?: (string | null) | undefined + product_type?: ("merchandise" | "service" | null) | undefined + return_status?: ("merchant_rejected" | "successful" | null) | undefined + returned_at?: (number | null) | undefined +} + +export type t_issuing_dispute_duplicate_evidence = { + additional_documentation?: (string | t_file | null) | undefined + card_statement?: (string | t_file | null) | undefined + cash_receipt?: (string | t_file | null) | undefined + check_image?: (string | t_file | null) | undefined + explanation?: (string | null) | undefined + original_transaction?: (string | null) | undefined +} + +export type t_issuing_dispute_evidence = { + canceled?: t_issuing_dispute_canceled_evidence | undefined + duplicate?: t_issuing_dispute_duplicate_evidence | undefined + fraudulent?: t_issuing_dispute_fraudulent_evidence | undefined + merchandise_not_as_described?: + | t_issuing_dispute_merchandise_not_as_described_evidence + | undefined + no_valid_authorization?: + | t_issuing_dispute_no_valid_authorization_evidence + | undefined + not_received?: t_issuing_dispute_not_received_evidence | undefined + other?: t_issuing_dispute_other_evidence | undefined + reason: + | "canceled" + | "duplicate" + | "fraudulent" + | "merchandise_not_as_described" + | "no_valid_authorization" + | "not_received" + | "other" + | "service_not_as_described" + service_not_as_described?: + | t_issuing_dispute_service_not_as_described_evidence + | undefined +} + +export type t_issuing_dispute_fraudulent_evidence = { + additional_documentation?: (string | t_file | null) | undefined + explanation?: (string | null) | undefined +} + +export type t_issuing_dispute_merchandise_not_as_described_evidence = { + additional_documentation?: (string | t_file | null) | undefined + explanation?: (string | null) | undefined + received_at?: (number | null) | undefined + return_description?: (string | null) | undefined + return_status?: ("merchant_rejected" | "successful" | null) | undefined + returned_at?: (number | null) | undefined +} + +export type t_issuing_dispute_no_valid_authorization_evidence = { + additional_documentation?: (string | t_file | null) | undefined + explanation?: (string | null) | undefined +} + +export type t_issuing_dispute_not_received_evidence = { + additional_documentation?: (string | t_file | null) | undefined + expected_at?: (number | null) | undefined + explanation?: (string | null) | undefined + product_description?: (string | null) | undefined + product_type?: ("merchandise" | "service" | null) | undefined +} + +export type t_issuing_dispute_other_evidence = { + additional_documentation?: (string | t_file | null) | undefined + explanation?: (string | null) | undefined + product_description?: (string | null) | undefined + product_type?: ("merchandise" | "service" | null) | undefined +} + +export type t_issuing_dispute_service_not_as_described_evidence = { + additional_documentation?: (string | t_file | null) | undefined + canceled_at?: (number | null) | undefined + cancellation_reason?: (string | null) | undefined + explanation?: (string | null) | undefined + received_at?: (number | null) | undefined +} + +export type t_issuing_dispute_treasury = { + debit_reversal?: (string | null) | undefined + received_debit: string +} + +export type t_issuing_network_token_address = { + line1: string + postal_code: string +} + +export type t_issuing_network_token_device = { + device_fingerprint?: string | undefined + ip_address?: string | undefined + location?: string | undefined + name?: string | undefined + phone_number?: string | undefined + type?: ("other" | "phone" | "watch") | undefined +} + +export type t_issuing_network_token_mastercard = { + card_reference_id?: string | undefined + token_reference_id: string + token_requestor_id: string + token_requestor_name?: string | undefined +} + +export type t_issuing_network_token_network_data = { + device?: t_issuing_network_token_device | undefined + mastercard?: t_issuing_network_token_mastercard | undefined + type: "mastercard" | "visa" + visa?: t_issuing_network_token_visa | undefined + wallet_provider?: t_issuing_network_token_wallet_provider | undefined +} + +export type t_issuing_network_token_visa = { + card_reference_id: string + token_reference_id: string + token_requestor_id: string + token_risk_score?: string | undefined +} + +export type t_issuing_network_token_wallet_provider = { + account_id?: string | undefined + account_trust_score?: number | undefined + card_number_source?: ("app" | "manual" | "on_file" | "other") | undefined + cardholder_address?: t_issuing_network_token_address | undefined + cardholder_name?: string | undefined + device_trust_score?: number | undefined + hashed_account_email_address?: string | undefined + reason_codes?: + | ( + | "account_card_too_new" + | "account_recently_changed" + | "account_too_new" + | "account_too_new_since_launch" + | "additional_device" + | "data_expired" + | "defer_id_v_decision" + | "device_recently_lost" + | "good_activity_history" + | "has_suspended_tokens" + | "high_risk" + | "inactive_account" + | "long_account_tenure" + | "low_account_score" + | "low_device_score" + | "low_phone_number_score" + | "network_service_error" + | "outside_home_territory" + | "provisioning_cardholder_mismatch" + | "provisioning_device_and_cardholder_mismatch" + | "provisioning_device_mismatch" + | "same_device_no_prior_authentication" + | "same_device_successful_prior_authentication" + | "software_update" + | "suspicious_activity" + | "too_many_different_cardholders" + | "too_many_recent_attempts" + | "too_many_recent_tokens" + )[] + | undefined + suggested_decision?: ("approve" | "decline" | "require_auth") | undefined + suggested_decision_version?: string | undefined +} + +export type t_issuing_personalization_design_carrier_text = { + footer_body?: (string | null) | undefined + footer_title?: (string | null) | undefined + header_body?: (string | null) | undefined + header_title?: (string | null) | undefined +} + +export type t_issuing_personalization_design_preferences = { + is_default: boolean + is_platform_default?: (boolean | null) | undefined +} + +export type t_issuing_personalization_design_rejection_reasons = { + card_logo?: + | ( + | ( + | "geographic_location" + | "inappropriate" + | "network_name" + | "non_binary_image" + | "non_fiat_currency" + | "other" + | "other_entity" + | "promotional_material" + )[] + | null + ) + | undefined + carrier_text?: + | ( + | ( + | "geographic_location" + | "inappropriate" + | "network_name" + | "non_fiat_currency" + | "other" + | "other_entity" + | "promotional_material" + )[] + | null + ) + | undefined +} + +export type t_issuing_physical_bundle_features = { + card_logo: "optional" | "required" | "unsupported" + carrier_text: "optional" | "required" | "unsupported" + second_line: "optional" | "required" | "unsupported" +} + +export type t_issuing_transaction_amount_details = { + atm_fee?: (number | null) | undefined + cashback_amount?: (number | null) | undefined +} + +export type t_issuing_transaction_fleet_cardholder_prompt_data = { + driver_id?: (string | null) | undefined + odometer?: (number | null) | undefined + unspecified_id?: (string | null) | undefined + user_id?: (string | null) | undefined + vehicle_number?: (string | null) | undefined +} + +export type t_issuing_transaction_fleet_data = { + cardholder_prompt_data?: + | (t_issuing_transaction_fleet_cardholder_prompt_data | null) + | undefined + purchase_type?: (string | null) | undefined + reported_breakdown?: + | (t_issuing_transaction_fleet_reported_breakdown | null) + | undefined + service_type?: (string | null) | undefined +} + +export type t_issuing_transaction_fleet_fuel_price_data = { + gross_amount_decimal?: (string | null) | undefined +} + +export type t_issuing_transaction_fleet_non_fuel_price_data = { + gross_amount_decimal?: (string | null) | undefined +} + +export type t_issuing_transaction_fleet_reported_breakdown = { + fuel?: (t_issuing_transaction_fleet_fuel_price_data | null) | undefined + non_fuel?: + | (t_issuing_transaction_fleet_non_fuel_price_data | null) + | undefined + tax?: (t_issuing_transaction_fleet_tax_data | null) | undefined +} + +export type t_issuing_transaction_fleet_tax_data = { + local_amount_decimal?: (string | null) | undefined + national_amount_decimal?: (string | null) | undefined +} + +export type t_issuing_transaction_flight_data = { + departure_at?: (number | null) | undefined + passenger_name?: (string | null) | undefined + refundable?: (boolean | null) | undefined + segments?: (t_issuing_transaction_flight_data_leg[] | null) | undefined + travel_agency?: (string | null) | undefined +} + +export type t_issuing_transaction_flight_data_leg = { + arrival_airport_code?: (string | null) | undefined + carrier?: (string | null) | undefined + departure_airport_code?: (string | null) | undefined + flight_number?: (string | null) | undefined + service_class?: (string | null) | undefined + stopover_allowed?: (boolean | null) | undefined +} + +export type t_issuing_transaction_fuel_data = { + industry_product_code?: (string | null) | undefined + quantity_decimal?: (string | null) | undefined + type: string + unit: string + unit_cost_decimal: string +} + +export type t_issuing_transaction_lodging_data = { + check_in_at?: (number | null) | undefined + nights?: (number | null) | undefined +} + +export type t_issuing_transaction_network_data = { + authorization_code?: (string | null) | undefined + processing_date?: (string | null) | undefined + transaction_id?: (string | null) | undefined +} + +export type t_issuing_transaction_purchase_details = { + fleet?: (t_issuing_transaction_fleet_data | null) | undefined + flight?: (t_issuing_transaction_flight_data | null) | undefined + fuel?: (t_issuing_transaction_fuel_data | null) | undefined + lodging?: (t_issuing_transaction_lodging_data | null) | undefined + receipt?: (t_issuing_transaction_receipt_data[] | null) | undefined + reference?: (string | null) | undefined +} + +export type t_issuing_transaction_receipt_data = { + description?: (string | null) | undefined + quantity?: (number | null) | undefined + total?: (number | null) | undefined + unit_cost?: (number | null) | undefined +} + +export type t_issuing_transaction_treasury = { + received_credit?: (string | null) | undefined + received_debit?: (string | null) | undefined +} + +export type t_item = { + amount_discount: number + amount_subtotal: number + amount_tax: number + amount_total: number + currency: string + description?: (string | null) | undefined + discounts?: t_line_items_discount_amount[] | undefined + id: string + object: "item" + price?: (t_price | null) | undefined + quantity?: (number | null) | undefined + taxes?: t_line_items_tax_amount[] | undefined +} + +export type t_klarna_address = { + country?: (string | null) | undefined +} + +export type t_klarna_payer_details = { + address?: (t_klarna_address | null) | undefined +} + +export type t_legal_entity_company = { + address?: t_address | undefined + address_kana?: (t_legal_entity_japan_address | null) | undefined + address_kanji?: (t_legal_entity_japan_address | null) | undefined + directors_provided?: boolean | undefined + directorship_declaration?: + | (t_legal_entity_directorship_declaration | null) + | undefined + executives_provided?: boolean | undefined + export_license_id?: string | undefined + export_purpose_code?: string | undefined + name?: (string | null) | undefined + name_kana?: (string | null) | undefined + name_kanji?: (string | null) | undefined + owners_provided?: boolean | undefined + ownership_declaration?: (t_legal_entity_ubo_declaration | null) | undefined + ownership_exemption_reason?: + | ( + | "qualified_entity_exceeds_ownership_threshold" + | "qualifies_as_financial_institution" + ) + | undefined + phone?: (string | null) | undefined + structure?: + | ( + | "free_zone_establishment" + | "free_zone_llc" + | "government_instrumentality" + | "governmental_unit" + | "incorporated_non_profit" + | "incorporated_partnership" + | "limited_liability_partnership" + | "llc" + | "multi_member_llc" + | "private_company" + | "private_corporation" + | "private_partnership" + | "public_company" + | "public_corporation" + | "public_partnership" + | "registered_charity" + | "single_member_llc" + | "sole_establishment" + | "sole_proprietorship" + | "tax_exempt_government_instrumentality" + | "unincorporated_association" + | "unincorporated_non_profit" + | "unincorporated_partnership" + ) + | undefined + tax_id_provided?: boolean | undefined + tax_id_registrar?: string | undefined + vat_id_provided?: boolean | undefined + verification?: (t_legal_entity_company_verification | null) | undefined +} + +export type t_legal_entity_company_verification = { + document: t_legal_entity_company_verification_document +} + +export type t_legal_entity_company_verification_document = { + back?: (string | t_file | null) | undefined + details?: (string | null) | undefined + details_code?: (string | null) | undefined + front?: (string | t_file | null) | undefined +} + +export type t_legal_entity_directorship_declaration = { + date?: (number | null) | undefined + ip?: (string | null) | undefined + user_agent?: (string | null) | undefined +} + +export type t_legal_entity_dob = { + day?: (number | null) | undefined + month?: (number | null) | undefined + year?: (number | null) | undefined +} + +export type t_legal_entity_japan_address = { + city?: (string | null) | undefined + country?: (string | null) | undefined + line1?: (string | null) | undefined + line2?: (string | null) | undefined + postal_code?: (string | null) | undefined + state?: (string | null) | undefined + town?: (string | null) | undefined +} + +export type t_legal_entity_person_verification = { + additional_document?: + | (t_legal_entity_person_verification_document | null) + | undefined + details?: (string | null) | undefined + details_code?: (string | null) | undefined + document?: t_legal_entity_person_verification_document | undefined + status: string +} + +export type t_legal_entity_person_verification_document = { + back?: (string | t_file | null) | undefined + details?: (string | null) | undefined + details_code?: (string | null) | undefined + front?: (string | t_file | null) | undefined +} + +export type t_legal_entity_ubo_declaration = { + date?: (number | null) | undefined + ip?: (string | null) | undefined + user_agent?: (string | null) | undefined +} + +export type t_line_item = { + amount: number + currency: string + description?: (string | null) | undefined + discount_amounts?: (t_discounts_resource_discount_amount[] | null) | undefined + discountable: boolean + discounts: (string | t_discount)[] + id: string + invoice?: (string | null) | undefined + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "line_item" + parent?: + | (t_billing_bill_resource_invoicing_lines_parents_invoice_line_item_parent | null) + | undefined + period: t_invoice_line_item_period + pretax_credit_amounts?: + | (t_invoices_resource_pretax_credit_amount[] | null) + | undefined + pricing?: + | (t_billing_bill_resource_invoicing_pricing_pricing | null) + | undefined + quantity?: (number | null) | undefined + subscription?: (string | t_subscription | null) | undefined + taxes?: (t_billing_bill_resource_invoicing_taxes_tax[] | null) | undefined +} + +export type t_line_items_discount_amount = { + amount: number + discount: t_discount +} + +export type t_line_items_tax_amount = { + amount: number + rate: t_tax_rate + taxability_reason?: + | ( + | "customer_exempt" + | "not_collecting" + | "not_subject_to_tax" + | "not_supported" + | "portion_product_exempt" + | "portion_reduced_rated" + | "portion_standard_rated" + | "product_exempt" + | "product_exempt_holiday" + | "proportionally_rated" + | "reduced_rated" + | "reverse_charge" + | "standard_rated" + | "taxable_basis_reduced" + | "zero_rated" + | null + ) + | undefined + taxable_amount?: (number | null) | undefined +} + +export type t_linked_account_options_us_bank_account = { + filters?: + | t_payment_flows_private_payment_methods_us_bank_account_linked_account_options_filters + | undefined + permissions?: + | ("balances" | "ownership" | "payment_method" | "transactions")[] + | undefined + prefetch?: (("balances" | "ownership" | "transactions")[] | null) | undefined + return_url?: string | undefined +} + +export type t_login_link = { + created: number + object: "login_link" + url: string +} + +export type t_mandate = { + customer_acceptance: t_customer_acceptance + id: string + livemode: boolean + multi_use?: t_mandate_multi_use | undefined + object: "mandate" + on_behalf_of?: string | undefined + payment_method: string | t_payment_method + payment_method_details: t_mandate_payment_method_details + single_use?: t_mandate_single_use | undefined + status: "active" | "inactive" | "pending" + type: "multi_use" | "single_use" +} + +export type t_mandate_acss_debit = { + default_for?: ("invoice" | "subscription")[] | undefined + interval_description?: (string | null) | undefined + payment_schedule: "combined" | "interval" | "sporadic" + transaction_type: "business" | "personal" +} + +export type t_mandate_amazon_pay = EmptyObject + +export type t_mandate_au_becs_debit = { + url: string +} + +export type t_mandate_bacs_debit = { + network_status: "accepted" | "pending" | "refused" | "revoked" + reference: string + revocation_reason?: + | ( + | "account_closed" + | "bank_account_restricted" + | "bank_ownership_changed" + | "could_not_process" + | "debit_not_authorized" + | null + ) + | undefined + url: string +} + +export type t_mandate_cashapp = EmptyObject + +export type t_mandate_kakao_pay = EmptyObject + +export type t_mandate_kr_card = EmptyObject + +export type t_mandate_link = EmptyObject + +export type t_mandate_multi_use = EmptyObject + +export type t_mandate_naver_pay = EmptyObject + +export type t_mandate_nz_bank_account = EmptyObject + +export type t_mandate_payment_method_details = { + acss_debit?: t_mandate_acss_debit | undefined + amazon_pay?: t_mandate_amazon_pay | undefined + au_becs_debit?: t_mandate_au_becs_debit | undefined + bacs_debit?: t_mandate_bacs_debit | undefined + card?: t_card_mandate_payment_method_details | undefined + cashapp?: t_mandate_cashapp | undefined + kakao_pay?: t_mandate_kakao_pay | undefined + kr_card?: t_mandate_kr_card | undefined + link?: t_mandate_link | undefined + naver_pay?: t_mandate_naver_pay | undefined + nz_bank_account?: t_mandate_nz_bank_account | undefined + paypal?: t_mandate_paypal | undefined + revolut_pay?: t_mandate_revolut_pay | undefined + sepa_debit?: t_mandate_sepa_debit | undefined + type: string + us_bank_account?: t_mandate_us_bank_account | undefined +} + +export type t_mandate_paypal = { + billing_agreement_id?: (string | null) | undefined + payer_id?: (string | null) | undefined +} + +export type t_mandate_revolut_pay = EmptyObject + +export type t_mandate_sepa_debit = { + reference: string + url: string +} + +export type t_mandate_single_use = { + amount: number + currency: string +} + +export type t_mandate_us_bank_account = { + collection_method?: "paper" | undefined +} + +export type t_networks = { + available: string[] + preferred?: (string | null) | undefined +} + +export type t_notification_event_data = { + object: EmptyObject + previous_attributes?: EmptyObject | undefined +} + +export type t_notification_event_request = { + id?: (string | null) | undefined + idempotency_key?: (string | null) | undefined +} + +export type t_offline_acceptance = EmptyObject + +export type t_online_acceptance = { + ip_address?: (string | null) | undefined + user_agent?: (string | null) | undefined +} + +export type t_outbound_payments_payment_method_details = { + billing_details: t_treasury_shared_resource_billing_details + financial_account?: + | t_outbound_payments_payment_method_details_financial_account + | undefined + type: "financial_account" | "us_bank_account" + us_bank_account?: + | t_outbound_payments_payment_method_details_us_bank_account + | undefined +} + +export type t_outbound_payments_payment_method_details_financial_account = { + id: string + network: "stripe" +} + +export type t_outbound_payments_payment_method_details_us_bank_account = { + account_holder_type?: ("company" | "individual" | null) | undefined + account_type?: ("checking" | "savings" | null) | undefined + bank_name?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + mandate?: (string | t_mandate) | undefined + network: "ach" | "us_domestic_wire" + routing_number?: (string | null) | undefined +} + +export type t_outbound_transfers_payment_method_details = { + billing_details: t_treasury_shared_resource_billing_details + financial_account?: + | t_outbound_transfers_payment_method_details_financial_account + | undefined + type: "financial_account" | "us_bank_account" + us_bank_account?: + | t_outbound_transfers_payment_method_details_us_bank_account + | undefined +} + +export type t_outbound_transfers_payment_method_details_financial_account = { + id: string + network: "stripe" +} + +export type t_outbound_transfers_payment_method_details_us_bank_account = { + account_holder_type?: ("company" | "individual" | null) | undefined + account_type?: ("checking" | "savings" | null) | undefined + bank_name?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + mandate?: (string | t_mandate) | undefined + network: "ach" | "us_domestic_wire" + routing_number?: (string | null) | undefined +} + +export type t_package_dimensions = { + height: number + length: number + weight: number + width: number +} + +export type t_payment_flows_amount_details = { + tip?: t_payment_flows_amount_details_client_resource_tip | undefined +} + +export type t_payment_flows_amount_details_client = { + tip?: t_payment_flows_amount_details_client_resource_tip | undefined +} + +export type t_payment_flows_amount_details_client_resource_tip = { + amount?: number | undefined +} + +export type t_payment_flows_automatic_payment_methods_payment_intent = { + allow_redirects?: ("always" | "never") | undefined + enabled: boolean +} + +export type t_payment_flows_automatic_payment_methods_setup_intent = { + allow_redirects?: ("always" | "never") | undefined + enabled?: (boolean | null) | undefined +} + +export type t_payment_flows_installment_options = { + enabled: boolean + plan?: t_payment_method_details_card_installments_plan | undefined +} + +export type t_payment_flows_payment_intent_presentment_details = { + presentment_amount: number + presentment_currency: string +} + +export type t_payment_flows_private_payment_methods_alipay = EmptyObject + +export type t_payment_flows_private_payment_methods_alipay_details = { + buyer_id?: string | undefined + fingerprint?: (string | null) | undefined + transaction_id?: (string | null) | undefined +} + +export type t_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_extended_authorization_extended_authorization = + { + status: "disabled" | "enabled" + } + +export type t_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_incremental_authorization_incremental_authorization = + { + status: "available" | "unavailable" + } + +export type t_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_overcapture_overcapture = + { + maximum_amount_capturable: number + status: "available" | "unavailable" + } + +export type t_payment_flows_private_payment_methods_card_details_api_resource_multicapture = + { + status: "available" | "unavailable" + } + +export type t_payment_flows_private_payment_methods_card_present_common_wallet = + { + type: "apple_pay" | "google_pay" | "samsung_pay" | "unknown" + } + +export type t_payment_flows_private_payment_methods_kakao_pay_payment_method_options = + { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined + } + +export type t_payment_flows_private_payment_methods_klarna_dob = { + day?: (number | null) | undefined + month?: (number | null) | undefined + year?: (number | null) | undefined +} + +export type t_payment_flows_private_payment_methods_naver_pay_payment_method_options = + { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined + } + +export type t_payment_flows_private_payment_methods_payco_payment_method_options = + { + capture_method?: "manual" | undefined + } + +export type t_payment_flows_private_payment_methods_samsung_pay_payment_method_options = + { + capture_method?: "manual" | undefined + } + +export type t_payment_flows_private_payment_methods_us_bank_account_linked_account_options_filters = + { + account_subcategories?: ("checking" | "savings")[] | undefined + } + +export type t_payment_intent = { + amount: number + amount_capturable?: number | undefined + amount_details?: + | (t_payment_flows_amount_details | t_payment_flows_amount_details_client) + | undefined + amount_received?: number | undefined + application?: (string | t_application | null) | undefined + application_fee_amount?: (number | null) | undefined + automatic_payment_methods?: + | (t_payment_flows_automatic_payment_methods_payment_intent | null) + | undefined + canceled_at?: (number | null) | undefined + cancellation_reason?: + | ( + | "abandoned" + | "automatic" + | "duplicate" + | "expired" + | "failed_invoice" + | "fraudulent" + | "requested_by_customer" + | "void_invoice" + | null + ) + | undefined + capture_method: "automatic" | "automatic_async" | "manual" + client_secret?: (string | null) | undefined + confirmation_method: "automatic" | "manual" + created: number + currency: string + customer?: (string | t_customer | t_deleted_customer | null) | undefined + description?: (string | null) | undefined + id: string + last_payment_error?: (t_api_errors | null) | undefined + latest_charge?: (string | t_charge | null) | undefined + livemode: boolean + metadata?: + | { + [key: string]: string | undefined + } + | undefined + next_action?: (t_payment_intent_next_action | null) | undefined + object: "payment_intent" + on_behalf_of?: (string | t_account | null) | undefined + payment_method?: (string | t_payment_method | null) | undefined + payment_method_configuration_details?: + | (t_payment_method_config_biz_payment_method_configuration_details | null) + | undefined + payment_method_options?: + | (t_payment_intent_payment_method_options | null) + | undefined + payment_method_types: string[] + presentment_details?: + | t_payment_flows_payment_intent_presentment_details + | undefined + processing?: (t_payment_intent_processing | null) | undefined + receipt_email?: (string | null) | undefined + review?: (string | t_review | null) | undefined + setup_future_usage?: ("off_session" | "on_session" | null) | undefined + shipping?: (t_shipping | null) | undefined + statement_descriptor?: (string | null) | undefined + statement_descriptor_suffix?: (string | null) | undefined + status: + | "canceled" + | "processing" + | "requires_action" + | "requires_capture" + | "requires_confirmation" + | "requires_payment_method" + | "succeeded" + transfer_data?: (t_transfer_data | null) | undefined + transfer_group?: (string | null) | undefined +} + +export type t_payment_intent_card_processing = { + customer_notification?: + | t_payment_intent_processing_customer_notification + | undefined +} + +export type t_payment_intent_next_action = { + alipay_handle_redirect?: + | t_payment_intent_next_action_alipay_handle_redirect + | undefined + boleto_display_details?: t_payment_intent_next_action_boleto | undefined + card_await_notification?: + | t_payment_intent_next_action_card_await_notification + | undefined + cashapp_handle_redirect_or_display_qr_code?: + | t_payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code + | undefined + display_bank_transfer_instructions?: + | t_payment_intent_next_action_display_bank_transfer_instructions + | undefined + konbini_display_details?: t_payment_intent_next_action_konbini | undefined + multibanco_display_details?: + | t_payment_intent_next_action_display_multibanco_details + | undefined + oxxo_display_details?: + | t_payment_intent_next_action_display_oxxo_details + | undefined + paynow_display_qr_code?: + | t_payment_intent_next_action_paynow_display_qr_code + | undefined + pix_display_qr_code?: + | t_payment_intent_next_action_pix_display_qr_code + | undefined + promptpay_display_qr_code?: + | t_payment_intent_next_action_promptpay_display_qr_code + | undefined + redirect_to_url?: t_payment_intent_next_action_redirect_to_url | undefined + swish_handle_redirect_or_display_qr_code?: + | t_payment_intent_next_action_swish_handle_redirect_or_display_qr_code + | undefined + type: string + use_stripe_sdk?: EmptyObject | undefined + verify_with_microdeposits?: + | t_payment_intent_next_action_verify_with_microdeposits + | undefined + wechat_pay_display_qr_code?: + | t_payment_intent_next_action_wechat_pay_display_qr_code + | undefined + wechat_pay_redirect_to_android_app?: + | t_payment_intent_next_action_wechat_pay_redirect_to_android_app + | undefined + wechat_pay_redirect_to_ios_app?: + | t_payment_intent_next_action_wechat_pay_redirect_to_ios_app + | undefined +} + +export type t_payment_intent_next_action_alipay_handle_redirect = { + native_data?: (string | null) | undefined + native_url?: (string | null) | undefined + return_url?: (string | null) | undefined + url?: (string | null) | undefined +} + +export type t_payment_intent_next_action_boleto = { + expires_at?: (number | null) | undefined + hosted_voucher_url?: (string | null) | undefined + number?: (string | null) | undefined + pdf?: (string | null) | undefined +} + +export type t_payment_intent_next_action_card_await_notification = { + charge_attempt_at?: (number | null) | undefined + customer_approval_required?: (boolean | null) | undefined +} + +export type t_payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code = + { + hosted_instructions_url: string + mobile_auth_url: string + qr_code: t_payment_intent_next_action_cashapp_qr_code + } + +export type t_payment_intent_next_action_cashapp_qr_code = { + expires_at: number + image_url_png: string + image_url_svg: string +} + +export type t_payment_intent_next_action_display_bank_transfer_instructions = { + amount_remaining?: (number | null) | undefined + currency?: (string | null) | undefined + financial_addresses?: + | t_funding_instructions_bank_transfer_financial_address[] + | undefined + hosted_instructions_url?: (string | null) | undefined + reference?: (string | null) | undefined + type: + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" +} + +export type t_payment_intent_next_action_display_multibanco_details = { + entity?: (string | null) | undefined + expires_at?: (number | null) | undefined + hosted_voucher_url?: (string | null) | undefined + reference?: (string | null) | undefined +} + +export type t_payment_intent_next_action_display_oxxo_details = { + expires_after?: (number | null) | undefined + hosted_voucher_url?: (string | null) | undefined + number?: (string | null) | undefined +} + +export type t_payment_intent_next_action_konbini = { + expires_at: number + hosted_voucher_url?: (string | null) | undefined + stores: t_payment_intent_next_action_konbini_stores +} + +export type t_payment_intent_next_action_konbini_familymart = { + confirmation_number?: string | undefined + payment_code: string +} + +export type t_payment_intent_next_action_konbini_lawson = { + confirmation_number?: string | undefined + payment_code: string +} + +export type t_payment_intent_next_action_konbini_ministop = { + confirmation_number?: string | undefined + payment_code: string +} + +export type t_payment_intent_next_action_konbini_seicomart = { + confirmation_number?: string | undefined + payment_code: string +} + +export type t_payment_intent_next_action_konbini_stores = { + familymart?: + | (t_payment_intent_next_action_konbini_familymart | null) + | undefined + lawson?: (t_payment_intent_next_action_konbini_lawson | null) | undefined + ministop?: (t_payment_intent_next_action_konbini_ministop | null) | undefined + seicomart?: + | (t_payment_intent_next_action_konbini_seicomart | null) + | undefined +} + +export type t_payment_intent_next_action_paynow_display_qr_code = { + data: string + hosted_instructions_url?: (string | null) | undefined + image_url_png: string + image_url_svg: string +} + +export type t_payment_intent_next_action_pix_display_qr_code = { + data?: string | undefined + expires_at?: number | undefined + hosted_instructions_url?: string | undefined + image_url_png?: string | undefined + image_url_svg?: string | undefined +} + +export type t_payment_intent_next_action_promptpay_display_qr_code = { + data: string + hosted_instructions_url: string + image_url_png: string + image_url_svg: string +} + +export type t_payment_intent_next_action_redirect_to_url = { + return_url?: (string | null) | undefined + url?: (string | null) | undefined +} + +export type t_payment_intent_next_action_swish_handle_redirect_or_display_qr_code = + { + hosted_instructions_url: string + qr_code: t_payment_intent_next_action_swish_qr_code + } + +export type t_payment_intent_next_action_swish_qr_code = { + data: string + image_url_png: string + image_url_svg: string +} + +export type t_payment_intent_next_action_verify_with_microdeposits = { + arrival_date: number + hosted_verification_url: string + microdeposit_type?: ("amounts" | "descriptor_code" | null) | undefined +} + +export type t_payment_intent_next_action_wechat_pay_display_qr_code = { + data: string + hosted_instructions_url: string + image_data_url: string + image_url_png: string + image_url_svg: string +} + +export type t_payment_intent_next_action_wechat_pay_redirect_to_android_app = { + app_id: string + nonce_str: string + package: string + partner_id: string + prepay_id: string + sign: string + timestamp: string +} + +export type t_payment_intent_next_action_wechat_pay_redirect_to_ios_app = { + native_url: string +} + +export type t_payment_intent_payment_method_options = { + acss_debit?: + | ( + | t_payment_intent_payment_method_options_acss_debit + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + affirm?: + | ( + | t_payment_method_options_affirm + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + afterpay_clearpay?: + | ( + | t_payment_method_options_afterpay_clearpay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + alipay?: + | ( + | t_payment_method_options_alipay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + alma?: + | ( + | t_payment_method_options_alma + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + amazon_pay?: + | ( + | t_payment_method_options_amazon_pay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + au_becs_debit?: + | ( + | t_payment_intent_payment_method_options_au_becs_debit + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + bacs_debit?: + | ( + | t_payment_intent_payment_method_options_bacs_debit + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + bancontact?: + | ( + | t_payment_method_options_bancontact + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + blik?: + | ( + | t_payment_intent_payment_method_options_blik + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + boleto?: + | ( + | t_payment_method_options_boleto + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + card?: + | ( + | t_payment_intent_payment_method_options_card + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + card_present?: + | ( + | t_payment_method_options_card_present + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + cashapp?: + | ( + | t_payment_method_options_cashapp + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + customer_balance?: + | ( + | t_payment_method_options_customer_balance + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + eps?: + | ( + | t_payment_intent_payment_method_options_eps + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + fpx?: + | ( + | t_payment_method_options_fpx + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + giropay?: + | ( + | t_payment_method_options_giropay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + grabpay?: + | ( + | t_payment_method_options_grabpay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + ideal?: + | ( + | t_payment_method_options_ideal + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + interac_present?: + | ( + | t_payment_method_options_interac_present + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + kakao_pay?: + | ( + | t_payment_flows_private_payment_methods_kakao_pay_payment_method_options + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + klarna?: + | ( + | t_payment_method_options_klarna + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + konbini?: + | ( + | t_payment_method_options_konbini + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + kr_card?: + | ( + | t_payment_method_options_kr_card + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + link?: + | ( + | t_payment_intent_payment_method_options_link + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + mobilepay?: + | ( + | t_payment_intent_payment_method_options_mobilepay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + multibanco?: + | ( + | t_payment_method_options_multibanco + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + naver_pay?: + | ( + | t_payment_flows_private_payment_methods_naver_pay_payment_method_options + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + nz_bank_account?: + | ( + | t_payment_intent_payment_method_options_nz_bank_account + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + oxxo?: + | ( + | t_payment_method_options_oxxo + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + p24?: + | ( + | t_payment_method_options_p24 + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + pay_by_bank?: + | ( + | t_payment_method_options_pay_by_bank + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + payco?: + | ( + | t_payment_flows_private_payment_methods_payco_payment_method_options + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + paynow?: + | ( + | t_payment_method_options_paynow + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + paypal?: + | ( + | t_payment_method_options_paypal + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + pix?: + | ( + | t_payment_method_options_pix + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + promptpay?: + | ( + | t_payment_method_options_promptpay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + revolut_pay?: + | ( + | t_payment_method_options_revolut_pay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + samsung_pay?: + | ( + | t_payment_flows_private_payment_methods_samsung_pay_payment_method_options + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + sepa_debit?: + | ( + | t_payment_intent_payment_method_options_sepa_debit + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + sofort?: + | ( + | t_payment_method_options_sofort + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + swish?: + | ( + | t_payment_intent_payment_method_options_swish + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + twint?: + | ( + | t_payment_method_options_twint + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + us_bank_account?: + | ( + | t_payment_intent_payment_method_options_us_bank_account + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + wechat_pay?: + | ( + | t_payment_method_options_wechat_pay + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined + zip?: + | ( + | t_payment_method_options_zip + | t_payment_intent_type_specific_payment_method_options_client + ) + | undefined +} + +export type t_payment_intent_payment_method_options_acss_debit = { + mandate_options?: + | t_payment_intent_payment_method_options_mandate_options_acss_debit + | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_payment_intent_payment_method_options_au_becs_debit = { + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined +} + +export type t_payment_intent_payment_method_options_bacs_debit = { + mandate_options?: + | t_payment_intent_payment_method_options_mandate_options_bacs_debit + | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined +} + +export type t_payment_intent_payment_method_options_blik = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_intent_payment_method_options_card = { + capture_method?: "manual" | undefined + installments?: (t_payment_method_options_card_installments | null) | undefined + mandate_options?: + | (t_payment_method_options_card_mandate_options | null) + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + | null + ) + | undefined + request_extended_authorization?: ("if_available" | "never") | undefined + request_incremental_authorization?: ("if_available" | "never") | undefined + request_multicapture?: ("if_available" | "never") | undefined + request_overcapture?: ("if_available" | "never") | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge" | null) + | undefined + require_cvc_recollection?: boolean | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + statement_descriptor_suffix_kana?: string | undefined + statement_descriptor_suffix_kanji?: string | undefined +} + +export type t_payment_intent_payment_method_options_eps = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_intent_payment_method_options_link = { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_intent_payment_method_options_mandate_options_acss_debit = + { + custom_mandate_url?: string | undefined + interval_description?: (string | null) | undefined + payment_schedule?: ("combined" | "interval" | "sporadic" | null) | undefined + transaction_type?: ("business" | "personal" | null) | undefined + } + +export type t_payment_intent_payment_method_options_mandate_options_bacs_debit = + { + reference_prefix?: string | undefined + } + +export type t_payment_intent_payment_method_options_mandate_options_sepa_debit = + { + reference_prefix?: string | undefined + } + +export type t_payment_intent_payment_method_options_mobilepay = { + capture_method?: "manual" | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_intent_payment_method_options_nz_bank_account = { + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined +} + +export type t_payment_intent_payment_method_options_sepa_debit = { + mandate_options?: + | t_payment_intent_payment_method_options_mandate_options_sepa_debit + | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined +} + +export type t_payment_intent_payment_method_options_swish = { + reference?: (string | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_intent_payment_method_options_us_bank_account = { + financial_connections?: t_linked_account_options_us_bank_account | undefined + mandate_options?: + | t_payment_method_options_us_bank_account_mandate_options + | undefined + preferred_settlement_speed?: ("fastest" | "standard") | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + target_date?: string | undefined + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_payment_intent_processing = { + card?: t_payment_intent_card_processing | undefined + type: "card" +} + +export type t_payment_intent_processing_customer_notification = { + approval_requested?: (boolean | null) | undefined + completes_at?: (number | null) | undefined +} + +export type t_payment_intent_type_specific_payment_method_options_client = { + capture_method?: ("manual" | "manual_preferred") | undefined + installments?: t_payment_flows_installment_options | undefined + request_incremental_authorization_support?: boolean | undefined + require_cvc_recollection?: boolean | undefined + routing?: t_payment_method_options_card_present_routing | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_payment_link = { + active: boolean + after_completion: t_payment_links_resource_after_completion + allow_promotion_codes: boolean + application?: + | (string | t_application | t_deleted_application | null) + | undefined + application_fee_amount?: (number | null) | undefined + application_fee_percent?: (number | null) | undefined + automatic_tax: t_payment_links_resource_automatic_tax + billing_address_collection: "auto" | "required" + consent_collection?: + | (t_payment_links_resource_consent_collection | null) + | undefined + currency: string + custom_fields: t_payment_links_resource_custom_fields[] + custom_text: t_payment_links_resource_custom_text + customer_creation: "always" | "if_required" + id: string + inactive_message?: (string | null) | undefined + invoice_creation?: + | (t_payment_links_resource_invoice_creation | null) + | undefined + line_items?: + | { + data: t_item[] + has_more: boolean + object: "list" + url: string + } + | undefined + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "payment_link" + on_behalf_of?: (string | t_account | null) | undefined + optional_items?: (t_payment_links_resource_optional_item[] | null) | undefined + payment_intent_data?: + | (t_payment_links_resource_payment_intent_data | null) + | undefined + payment_method_collection: "always" | "if_required" + payment_method_types?: + | ( + | ( + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "cashapp" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "klarna" + | "konbini" + | "link" + | "mobilepay" + | "multibanco" + | "oxxo" + | "p24" + | "pay_by_bank" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + )[] + | null + ) + | undefined + phone_number_collection: t_payment_links_resource_phone_number_collection + restrictions?: (t_payment_links_resource_restrictions | null) | undefined + shipping_address_collection?: + | (t_payment_links_resource_shipping_address_collection | null) + | undefined + shipping_options: t_payment_links_resource_shipping_option[] + submit_type: "auto" | "book" | "donate" | "pay" | "subscribe" + subscription_data?: + | (t_payment_links_resource_subscription_data | null) + | undefined + tax_id_collection: t_payment_links_resource_tax_id_collection + transfer_data?: (t_payment_links_resource_transfer_data | null) | undefined + url: string +} + +export type t_payment_links_resource_after_completion = { + hosted_confirmation?: + | t_payment_links_resource_completion_behavior_confirmation_page + | undefined + redirect?: t_payment_links_resource_completion_behavior_redirect | undefined + type: "hosted_confirmation" | "redirect" +} + +export type t_payment_links_resource_automatic_tax = { + enabled: boolean + liability?: (t_connect_account_reference | null) | undefined +} + +export type t_payment_links_resource_completed_sessions = { + count: number + limit: number +} + +export type t_payment_links_resource_completion_behavior_confirmation_page = { + custom_message?: (string | null) | undefined +} + +export type t_payment_links_resource_completion_behavior_redirect = { + url: string +} + +export type t_payment_links_resource_consent_collection = { + payment_method_reuse_agreement?: + | (t_payment_links_resource_payment_method_reuse_agreement | null) + | undefined + promotions?: ("auto" | "none" | null) | undefined + terms_of_service?: ("none" | "required" | null) | undefined +} + +export type t_payment_links_resource_custom_fields = { + dropdown?: t_payment_links_resource_custom_fields_dropdown | undefined + key: string + label: t_payment_links_resource_custom_fields_label + numeric?: t_payment_links_resource_custom_fields_numeric | undefined + optional: boolean + text?: t_payment_links_resource_custom_fields_text | undefined + type: "dropdown" | "numeric" | "text" +} + +export type t_payment_links_resource_custom_fields_dropdown = { + default_value?: (string | null) | undefined + options: t_payment_links_resource_custom_fields_dropdown_option[] +} + +export type t_payment_links_resource_custom_fields_dropdown_option = { + label: string + value: string +} + +export type t_payment_links_resource_custom_fields_label = { + custom?: (string | null) | undefined + type: "custom" +} + +export type t_payment_links_resource_custom_fields_numeric = { + default_value?: (string | null) | undefined + maximum_length?: (number | null) | undefined + minimum_length?: (number | null) | undefined +} + +export type t_payment_links_resource_custom_fields_text = { + default_value?: (string | null) | undefined + maximum_length?: (number | null) | undefined + minimum_length?: (number | null) | undefined +} + +export type t_payment_links_resource_custom_text = { + after_submit?: + | (t_payment_links_resource_custom_text_position | null) + | undefined + shipping_address?: + | (t_payment_links_resource_custom_text_position | null) + | undefined + submit?: (t_payment_links_resource_custom_text_position | null) | undefined + terms_of_service_acceptance?: + | (t_payment_links_resource_custom_text_position | null) + | undefined +} + +export type t_payment_links_resource_custom_text_position = { + message: string +} + +export type t_payment_links_resource_invoice_creation = { + enabled: boolean + invoice_data?: (t_payment_links_resource_invoice_settings | null) | undefined +} + +export type t_payment_links_resource_invoice_settings = { + account_tax_ids?: + | ((string | t_tax_id | t_deleted_tax_id)[] | null) + | undefined + custom_fields?: (t_invoice_setting_custom_field[] | null) | undefined + description?: (string | null) | undefined + footer?: (string | null) | undefined + issuer?: (t_connect_account_reference | null) | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + rendering_options?: + | (t_invoice_setting_checkout_rendering_options | null) + | undefined +} + +export type t_payment_links_resource_optional_item = { + adjustable_quantity?: + | (t_payment_links_resource_optional_item_adjustable_quantity | null) + | undefined + price: string + quantity: number +} + +export type t_payment_links_resource_optional_item_adjustable_quantity = { + enabled: boolean + maximum?: (number | null) | undefined + minimum?: (number | null) | undefined +} + +export type t_payment_links_resource_payment_intent_data = { + capture_method?: + | ("automatic" | "automatic_async" | "manual" | null) + | undefined + description?: (string | null) | undefined + metadata: { + [key: string]: string | undefined + } + setup_future_usage?: ("off_session" | "on_session" | null) | undefined + statement_descriptor?: (string | null) | undefined + statement_descriptor_suffix?: (string | null) | undefined + transfer_group?: (string | null) | undefined +} + +export type t_payment_links_resource_payment_method_reuse_agreement = { + position: "auto" | "hidden" +} + +export type t_payment_links_resource_phone_number_collection = { + enabled: boolean +} + +export type t_payment_links_resource_restrictions = { + completed_sessions: t_payment_links_resource_completed_sessions +} + +export type t_payment_links_resource_shipping_address_collection = { + allowed_countries: ( + | "AC" + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TA" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VN" + | "VU" + | "WF" + | "WS" + | "XK" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | "ZZ" + )[] +} + +export type t_payment_links_resource_shipping_option = { + shipping_amount: number + shipping_rate: string | t_shipping_rate +} + +export type t_payment_links_resource_subscription_data = { + description?: (string | null) | undefined + invoice_settings: t_payment_links_resource_subscription_data_invoice_settings + metadata: { + [key: string]: string | undefined + } + trial_period_days?: (number | null) | undefined + trial_settings?: + | (t_subscriptions_trials_resource_trial_settings | null) + | undefined +} + +export type t_payment_links_resource_subscription_data_invoice_settings = { + issuer: t_connect_account_reference +} + +export type t_payment_links_resource_tax_id_collection = { + enabled: boolean + required: "if_supported" | "never" +} + +export type t_payment_links_resource_transfer_data = { + amount?: (number | null) | undefined + destination: string | t_account +} + +export type t_payment_method = { + acss_debit?: t_payment_method_acss_debit | undefined + affirm?: t_payment_method_affirm | undefined + afterpay_clearpay?: t_payment_method_afterpay_clearpay | undefined + alipay?: t_payment_flows_private_payment_methods_alipay | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: t_payment_method_alma | undefined + amazon_pay?: t_payment_method_amazon_pay | undefined + au_becs_debit?: t_payment_method_au_becs_debit | undefined + bacs_debit?: t_payment_method_bacs_debit | undefined + bancontact?: t_payment_method_bancontact | undefined + billie?: t_payment_method_billie | undefined + billing_details: t_billing_details + blik?: t_payment_method_blik | undefined + boleto?: t_payment_method_boleto | undefined + card?: t_payment_method_card | undefined + card_present?: t_payment_method_card_present | undefined + cashapp?: t_payment_method_cashapp | undefined + created: number + customer?: (string | t_customer | null) | undefined + customer_balance?: t_payment_method_customer_balance | undefined + eps?: t_payment_method_eps | undefined + fpx?: t_payment_method_fpx | undefined + giropay?: t_payment_method_giropay | undefined + grabpay?: t_payment_method_grabpay | undefined + id: string + ideal?: t_payment_method_ideal | undefined + interac_present?: t_payment_method_interac_present | undefined + kakao_pay?: t_payment_method_kakao_pay | undefined + klarna?: t_payment_method_klarna | undefined + konbini?: t_payment_method_konbini | undefined + kr_card?: t_payment_method_kr_card | undefined + link?: t_payment_method_link | undefined + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + mobilepay?: t_payment_method_mobilepay | undefined + multibanco?: t_payment_method_multibanco | undefined + naver_pay?: t_payment_method_naver_pay | undefined + nz_bank_account?: t_payment_method_nz_bank_account | undefined + object: "payment_method" + oxxo?: t_payment_method_oxxo | undefined + p24?: t_payment_method_p24 | undefined + pay_by_bank?: t_payment_method_pay_by_bank | undefined + payco?: t_payment_method_payco | undefined + paynow?: t_payment_method_paynow | undefined + paypal?: t_payment_method_paypal | undefined + pix?: t_payment_method_pix | undefined + promptpay?: t_payment_method_promptpay | undefined + radar_options?: t_radar_radar_options | undefined + revolut_pay?: t_payment_method_revolut_pay | undefined + samsung_pay?: t_payment_method_samsung_pay | undefined + satispay?: t_payment_method_satispay | undefined + sepa_debit?: t_payment_method_sepa_debit | undefined + sofort?: t_payment_method_sofort | undefined + swish?: t_payment_method_swish | undefined + twint?: t_payment_method_twint | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "card_present" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "interac_present" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: t_payment_method_us_bank_account | undefined + wechat_pay?: t_payment_method_wechat_pay | undefined + zip?: t_payment_method_zip | undefined +} + +export type t_payment_method_acss_debit = { + bank_name?: (string | null) | undefined + fingerprint?: (string | null) | undefined + institution_number?: (string | null) | undefined + last4?: (string | null) | undefined + transit_number?: (string | null) | undefined +} + +export type t_payment_method_affirm = EmptyObject + +export type t_payment_method_afterpay_clearpay = EmptyObject + +export type t_payment_method_alma = EmptyObject + +export type t_payment_method_amazon_pay = EmptyObject + +export type t_payment_method_au_becs_debit = { + bsb_number?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined +} + +export type t_payment_method_bacs_debit = { + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + sort_code?: (string | null) | undefined +} + +export type t_payment_method_bancontact = EmptyObject + +export type t_payment_method_billie = EmptyObject + +export type t_payment_method_blik = EmptyObject + +export type t_payment_method_boleto = { + tax_id: string +} + +export type t_payment_method_card = { + brand: string + checks?: (t_payment_method_card_checks | null) | undefined + country?: (string | null) | undefined + display_brand?: (string | null) | undefined + exp_month: number + exp_year: number + fingerprint?: (string | null) | undefined + funding: string + generated_from?: (t_payment_method_card_generated_card | null) | undefined + last4: string + networks?: (t_networks | null) | undefined + regulated_status?: ("regulated" | "unregulated" | null) | undefined + three_d_secure_usage?: (t_three_d_secure_usage | null) | undefined + wallet?: (t_payment_method_card_wallet | null) | undefined +} + +export type t_payment_method_card_checks = { + address_line1_check?: (string | null) | undefined + address_postal_code_check?: (string | null) | undefined + cvc_check?: (string | null) | undefined +} + +export type t_payment_method_card_generated_card = { + charge?: (string | null) | undefined + payment_method_details?: + | (t_card_generated_from_payment_method_details | null) + | undefined + setup_attempt?: (string | t_setup_attempt | null) | undefined +} + +export type t_payment_method_card_present = { + brand?: (string | null) | undefined + brand_product?: (string | null) | undefined + cardholder_name?: (string | null) | undefined + country?: (string | null) | undefined + description?: (string | null) | undefined + exp_month: number + exp_year: number + fingerprint?: (string | null) | undefined + funding?: (string | null) | undefined + issuer?: (string | null) | undefined + last4?: (string | null) | undefined + networks?: (t_payment_method_card_present_networks | null) | undefined + offline?: (t_payment_method_details_card_present_offline | null) | undefined + preferred_locales?: (string[] | null) | undefined + read_method?: + | ( + | "contact_emv" + | "contactless_emv" + | "contactless_magstripe_mode" + | "magnetic_stripe_fallback" + | "magnetic_stripe_track2" + | null + ) + | undefined + wallet?: + | t_payment_flows_private_payment_methods_card_present_common_wallet + | undefined +} + +export type t_payment_method_card_present_networks = { + available: string[] + preferred?: (string | null) | undefined +} + +export type t_payment_method_card_wallet = { + amex_express_checkout?: + | t_payment_method_card_wallet_amex_express_checkout + | undefined + apple_pay?: t_payment_method_card_wallet_apple_pay | undefined + dynamic_last4?: (string | null) | undefined + google_pay?: t_payment_method_card_wallet_google_pay | undefined + link?: t_payment_method_card_wallet_link | undefined + masterpass?: t_payment_method_card_wallet_masterpass | undefined + samsung_pay?: t_payment_method_card_wallet_samsung_pay | undefined + type: + | "amex_express_checkout" + | "apple_pay" + | "google_pay" + | "link" + | "masterpass" + | "samsung_pay" + | "visa_checkout" + visa_checkout?: t_payment_method_card_wallet_visa_checkout | undefined +} + +export type t_payment_method_card_wallet_amex_express_checkout = EmptyObject + +export type t_payment_method_card_wallet_apple_pay = EmptyObject + +export type t_payment_method_card_wallet_google_pay = EmptyObject + +export type t_payment_method_card_wallet_link = EmptyObject + +export type t_payment_method_card_wallet_masterpass = { + billing_address?: (t_address | null) | undefined + email?: (string | null) | undefined + name?: (string | null) | undefined + shipping_address?: (t_address | null) | undefined +} + +export type t_payment_method_card_wallet_samsung_pay = EmptyObject + +export type t_payment_method_card_wallet_visa_checkout = { + billing_address?: (t_address | null) | undefined + email?: (string | null) | undefined + name?: (string | null) | undefined + shipping_address?: (t_address | null) | undefined +} + +export type t_payment_method_cashapp = { + buyer_id?: (string | null) | undefined + cashtag?: (string | null) | undefined +} + +export type t_payment_method_config_biz_payment_method_configuration_details = { + id: string + parent?: (string | null) | undefined +} + +export type t_payment_method_config_resource_display_preference = { + overridable?: (boolean | null) | undefined + preference: "none" | "off" | "on" + value: "off" | "on" +} + +export type t_payment_method_config_resource_payment_method_properties = { + available: boolean + display_preference: t_payment_method_config_resource_display_preference +} + +export type t_payment_method_configuration = { + acss_debit?: + | t_payment_method_config_resource_payment_method_properties + | undefined + active: boolean + affirm?: + | t_payment_method_config_resource_payment_method_properties + | undefined + afterpay_clearpay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + alipay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + alma?: t_payment_method_config_resource_payment_method_properties | undefined + amazon_pay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + apple_pay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + application?: (string | null) | undefined + au_becs_debit?: + | t_payment_method_config_resource_payment_method_properties + | undefined + bacs_debit?: + | t_payment_method_config_resource_payment_method_properties + | undefined + bancontact?: + | t_payment_method_config_resource_payment_method_properties + | undefined + billie?: + | t_payment_method_config_resource_payment_method_properties + | undefined + blik?: t_payment_method_config_resource_payment_method_properties | undefined + boleto?: + | t_payment_method_config_resource_payment_method_properties + | undefined + card?: t_payment_method_config_resource_payment_method_properties | undefined + cartes_bancaires?: + | t_payment_method_config_resource_payment_method_properties + | undefined + cashapp?: + | t_payment_method_config_resource_payment_method_properties + | undefined + customer_balance?: + | t_payment_method_config_resource_payment_method_properties + | undefined + eps?: t_payment_method_config_resource_payment_method_properties | undefined + fpx?: t_payment_method_config_resource_payment_method_properties | undefined + giropay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + google_pay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + grabpay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + id: string + ideal?: t_payment_method_config_resource_payment_method_properties | undefined + is_default: boolean + jcb?: t_payment_method_config_resource_payment_method_properties | undefined + klarna?: + | t_payment_method_config_resource_payment_method_properties + | undefined + konbini?: + | t_payment_method_config_resource_payment_method_properties + | undefined + link?: t_payment_method_config_resource_payment_method_properties | undefined + livemode: boolean + mobilepay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + multibanco?: + | t_payment_method_config_resource_payment_method_properties + | undefined + name: string + nz_bank_account?: + | t_payment_method_config_resource_payment_method_properties + | undefined + object: "payment_method_configuration" + oxxo?: t_payment_method_config_resource_payment_method_properties | undefined + p24?: t_payment_method_config_resource_payment_method_properties | undefined + parent?: (string | null) | undefined + pay_by_bank?: + | t_payment_method_config_resource_payment_method_properties + | undefined + paynow?: + | t_payment_method_config_resource_payment_method_properties + | undefined + paypal?: + | t_payment_method_config_resource_payment_method_properties + | undefined + promptpay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + revolut_pay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + satispay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + sepa_debit?: + | t_payment_method_config_resource_payment_method_properties + | undefined + sofort?: + | t_payment_method_config_resource_payment_method_properties + | undefined + swish?: t_payment_method_config_resource_payment_method_properties | undefined + twint?: t_payment_method_config_resource_payment_method_properties | undefined + us_bank_account?: + | t_payment_method_config_resource_payment_method_properties + | undefined + wechat_pay?: + | t_payment_method_config_resource_payment_method_properties + | undefined + zip?: t_payment_method_config_resource_payment_method_properties | undefined +} + +export type t_payment_method_customer_balance = EmptyObject + +export type t_payment_method_details = { + ach_credit_transfer?: t_payment_method_details_ach_credit_transfer | undefined + ach_debit?: t_payment_method_details_ach_debit | undefined + acss_debit?: t_payment_method_details_acss_debit | undefined + affirm?: t_payment_method_details_affirm | undefined + afterpay_clearpay?: t_payment_method_details_afterpay_clearpay | undefined + alipay?: t_payment_flows_private_payment_methods_alipay_details | undefined + alma?: t_payment_method_details_alma | undefined + amazon_pay?: t_payment_method_details_amazon_pay | undefined + au_becs_debit?: t_payment_method_details_au_becs_debit | undefined + bacs_debit?: t_payment_method_details_bacs_debit | undefined + bancontact?: t_payment_method_details_bancontact | undefined + billie?: t_payment_method_details_billie | undefined + blik?: t_payment_method_details_blik | undefined + boleto?: t_payment_method_details_boleto | undefined + card?: t_payment_method_details_card | undefined + card_present?: t_payment_method_details_card_present | undefined + cashapp?: t_payment_method_details_cashapp | undefined + customer_balance?: t_payment_method_details_customer_balance | undefined + eps?: t_payment_method_details_eps | undefined + fpx?: t_payment_method_details_fpx | undefined + giropay?: t_payment_method_details_giropay | undefined + grabpay?: t_payment_method_details_grabpay | undefined + ideal?: t_payment_method_details_ideal | undefined + interac_present?: t_payment_method_details_interac_present | undefined + kakao_pay?: t_payment_method_details_kakao_pay | undefined + klarna?: t_payment_method_details_klarna | undefined + konbini?: t_payment_method_details_konbini | undefined + kr_card?: t_payment_method_details_kr_card | undefined + link?: t_payment_method_details_link | undefined + mobilepay?: t_payment_method_details_mobilepay | undefined + multibanco?: t_payment_method_details_multibanco | undefined + naver_pay?: t_payment_method_details_naver_pay | undefined + nz_bank_account?: t_payment_method_details_nz_bank_account | undefined + oxxo?: t_payment_method_details_oxxo | undefined + p24?: t_payment_method_details_p24 | undefined + pay_by_bank?: t_payment_method_details_pay_by_bank | undefined + payco?: t_payment_method_details_payco | undefined + paynow?: t_payment_method_details_paynow | undefined + paypal?: t_payment_method_details_paypal | undefined + pix?: t_payment_method_details_pix | undefined + promptpay?: t_payment_method_details_promptpay | undefined + revolut_pay?: t_payment_method_details_revolut_pay | undefined + samsung_pay?: t_payment_method_details_samsung_pay | undefined + satispay?: t_payment_method_details_satispay | undefined + sepa_debit?: t_payment_method_details_sepa_debit | undefined + sofort?: t_payment_method_details_sofort | undefined + stripe_account?: t_payment_method_details_stripe_account | undefined + swish?: t_payment_method_details_swish | undefined + twint?: t_payment_method_details_twint | undefined + type: string + us_bank_account?: t_payment_method_details_us_bank_account | undefined + wechat?: t_payment_method_details_wechat | undefined + wechat_pay?: t_payment_method_details_wechat_pay | undefined + zip?: t_payment_method_details_zip | undefined +} + +export type t_payment_method_details_ach_credit_transfer = { + account_number?: (string | null) | undefined + bank_name?: (string | null) | undefined + routing_number?: (string | null) | undefined + swift_code?: (string | null) | undefined +} + +export type t_payment_method_details_ach_debit = { + account_holder_type?: ("company" | "individual" | null) | undefined + bank_name?: (string | null) | undefined + country?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + routing_number?: (string | null) | undefined +} + +export type t_payment_method_details_acss_debit = { + bank_name?: (string | null) | undefined + fingerprint?: (string | null) | undefined + institution_number?: (string | null) | undefined + last4?: (string | null) | undefined + mandate?: string | undefined + transit_number?: (string | null) | undefined +} + +export type t_payment_method_details_affirm = { + transaction_id?: (string | null) | undefined +} + +export type t_payment_method_details_afterpay_clearpay = { + order_id?: (string | null) | undefined + reference?: (string | null) | undefined +} + +export type t_payment_method_details_alma = EmptyObject + +export type t_payment_method_details_amazon_pay = { + funding?: t_amazon_pay_underlying_payment_method_funding_details | undefined +} + +export type t_payment_method_details_au_becs_debit = { + bsb_number?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + mandate?: string | undefined +} + +export type t_payment_method_details_bacs_debit = { + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + mandate?: (string | null) | undefined + sort_code?: (string | null) | undefined +} + +export type t_payment_method_details_bancontact = { + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + bic?: (string | null) | undefined + generated_sepa_debit?: (string | t_payment_method | null) | undefined + generated_sepa_debit_mandate?: (string | t_mandate | null) | undefined + iban_last4?: (string | null) | undefined + preferred_language?: ("de" | "en" | "fr" | "nl" | null) | undefined + verified_name?: (string | null) | undefined +} + +export type t_payment_method_details_billie = EmptyObject + +export type t_payment_method_details_blik = { + buyer_id?: (string | null) | undefined +} + +export type t_payment_method_details_boleto = { + tax_id: string +} + +export type t_payment_method_details_card = { + amount_authorized?: (number | null) | undefined + authorization_code?: (string | null) | undefined + brand?: (string | null) | undefined + capture_before?: number | undefined + checks?: (t_payment_method_details_card_checks | null) | undefined + country?: (string | null) | undefined + exp_month: number + exp_year: number + extended_authorization?: + | t_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_extended_authorization_extended_authorization + | undefined + fingerprint?: (string | null) | undefined + funding?: (string | null) | undefined + incremental_authorization?: + | t_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_incremental_authorization_incremental_authorization + | undefined + installments?: (t_payment_method_details_card_installments | null) | undefined + last4?: (string | null) | undefined + mandate?: (string | null) | undefined + multicapture?: + | t_payment_flows_private_payment_methods_card_details_api_resource_multicapture + | undefined + network?: (string | null) | undefined + network_token?: + | (t_payment_method_details_card_network_token | null) + | undefined + network_transaction_id?: (string | null) | undefined + overcapture?: + | t_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_overcapture_overcapture + | undefined + regulated_status?: ("regulated" | "unregulated" | null) | undefined + three_d_secure?: (t_three_d_secure_details_charge | null) | undefined + wallet?: (t_payment_method_details_card_wallet | null) | undefined +} + +export type t_payment_method_details_card_checks = { + address_line1_check?: (string | null) | undefined + address_postal_code_check?: (string | null) | undefined + cvc_check?: (string | null) | undefined +} + +export type t_payment_method_details_card_installments = { + plan?: (t_payment_method_details_card_installments_plan | null) | undefined +} + +export type t_payment_method_details_card_installments_plan = { + count?: (number | null) | undefined + interval?: ("month" | null) | undefined + type: "fixed_count" +} + +export type t_payment_method_details_card_network_token = { + used: boolean +} + +export type t_payment_method_details_card_present = { + amount_authorized?: (number | null) | undefined + brand?: (string | null) | undefined + brand_product?: (string | null) | undefined + capture_before?: number | undefined + cardholder_name?: (string | null) | undefined + country?: (string | null) | undefined + description?: (string | null) | undefined + emv_auth_data?: (string | null) | undefined + exp_month: number + exp_year: number + fingerprint?: (string | null) | undefined + funding?: (string | null) | undefined + generated_card?: (string | null) | undefined + incremental_authorization_supported: boolean + issuer?: (string | null) | undefined + last4?: (string | null) | undefined + network?: (string | null) | undefined + network_transaction_id?: (string | null) | undefined + offline?: (t_payment_method_details_card_present_offline | null) | undefined + overcapture_supported: boolean + preferred_locales?: (string[] | null) | undefined + read_method?: + | ( + | "contact_emv" + | "contactless_emv" + | "contactless_magstripe_mode" + | "magnetic_stripe_fallback" + | "magnetic_stripe_track2" + | null + ) + | undefined + receipt?: (t_payment_method_details_card_present_receipt | null) | undefined + wallet?: + | t_payment_flows_private_payment_methods_card_present_common_wallet + | undefined +} + +export type t_payment_method_details_card_present_offline = { + stored_at?: (number | null) | undefined + type?: ("deferred" | null) | undefined +} + +export type t_payment_method_details_card_present_receipt = { + account_type?: ("checking" | "credit" | "prepaid" | "unknown") | undefined + application_cryptogram?: (string | null) | undefined + application_preferred_name?: (string | null) | undefined + authorization_code?: (string | null) | undefined + authorization_response_code?: (string | null) | undefined + cardholder_verification_method?: (string | null) | undefined + dedicated_file_name?: (string | null) | undefined + terminal_verification_results?: (string | null) | undefined + transaction_status_information?: (string | null) | undefined +} + +export type t_payment_method_details_card_wallet = { + amex_express_checkout?: + | t_payment_method_details_card_wallet_amex_express_checkout + | undefined + apple_pay?: t_payment_method_details_card_wallet_apple_pay | undefined + dynamic_last4?: (string | null) | undefined + google_pay?: t_payment_method_details_card_wallet_google_pay | undefined + link?: t_payment_method_details_card_wallet_link | undefined + masterpass?: t_payment_method_details_card_wallet_masterpass | undefined + samsung_pay?: t_payment_method_details_card_wallet_samsung_pay | undefined + type: + | "amex_express_checkout" + | "apple_pay" + | "google_pay" + | "link" + | "masterpass" + | "samsung_pay" + | "visa_checkout" + visa_checkout?: t_payment_method_details_card_wallet_visa_checkout | undefined +} + +export type t_payment_method_details_card_wallet_amex_express_checkout = + EmptyObject + +export type t_payment_method_details_card_wallet_apple_pay = EmptyObject + +export type t_payment_method_details_card_wallet_google_pay = EmptyObject + +export type t_payment_method_details_card_wallet_link = EmptyObject + +export type t_payment_method_details_card_wallet_masterpass = { + billing_address?: (t_address | null) | undefined + email?: (string | null) | undefined + name?: (string | null) | undefined + shipping_address?: (t_address | null) | undefined +} + +export type t_payment_method_details_card_wallet_samsung_pay = EmptyObject + +export type t_payment_method_details_card_wallet_visa_checkout = { + billing_address?: (t_address | null) | undefined + email?: (string | null) | undefined + name?: (string | null) | undefined + shipping_address?: (t_address | null) | undefined +} + +export type t_payment_method_details_cashapp = { + buyer_id?: (string | null) | undefined + cashtag?: (string | null) | undefined +} + +export type t_payment_method_details_customer_balance = EmptyObject + +export type t_payment_method_details_eps = { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + | null + ) + | undefined + verified_name?: (string | null) | undefined +} + +export type t_payment_method_details_fpx = { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + transaction_id?: (string | null) | undefined +} + +export type t_payment_method_details_giropay = { + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + bic?: (string | null) | undefined + verified_name?: (string | null) | undefined +} + +export type t_payment_method_details_grabpay = { + transaction_id?: (string | null) | undefined +} + +export type t_payment_method_details_ideal = { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + | null + ) + | undefined + bic?: + | ( + | "ABNANL2A" + | "ASNBNL21" + | "BITSNL2A" + | "BUNQNL2A" + | "FVLBNL22" + | "HANDNL2A" + | "INGBNL2A" + | "KNABNL2H" + | "MOYONL21" + | "NNBANL2G" + | "NTSBDEB1" + | "RABONL2U" + | "RBRBNL21" + | "REVOIE23" + | "REVOLT21" + | "SNSBNL2A" + | "TRIONL2U" + | null + ) + | undefined + generated_sepa_debit?: (string | t_payment_method | null) | undefined + generated_sepa_debit_mandate?: (string | t_mandate | null) | undefined + iban_last4?: (string | null) | undefined + verified_name?: (string | null) | undefined +} + +export type t_payment_method_details_interac_present = { + brand?: (string | null) | undefined + cardholder_name?: (string | null) | undefined + country?: (string | null) | undefined + description?: (string | null) | undefined + emv_auth_data?: (string | null) | undefined + exp_month: number + exp_year: number + fingerprint?: (string | null) | undefined + funding?: (string | null) | undefined + generated_card?: (string | null) | undefined + issuer?: (string | null) | undefined + last4?: (string | null) | undefined + network?: (string | null) | undefined + network_transaction_id?: (string | null) | undefined + preferred_locales?: (string[] | null) | undefined + read_method?: + | ( + | "contact_emv" + | "contactless_emv" + | "contactless_magstripe_mode" + | "magnetic_stripe_fallback" + | "magnetic_stripe_track2" + | null + ) + | undefined + receipt?: + | (t_payment_method_details_interac_present_receipt | null) + | undefined +} + +export type t_payment_method_details_interac_present_receipt = { + account_type?: ("checking" | "savings" | "unknown") | undefined + application_cryptogram?: (string | null) | undefined + application_preferred_name?: (string | null) | undefined + authorization_code?: (string | null) | undefined + authorization_response_code?: (string | null) | undefined + cardholder_verification_method?: (string | null) | undefined + dedicated_file_name?: (string | null) | undefined + terminal_verification_results?: (string | null) | undefined + transaction_status_information?: (string | null) | undefined +} + +export type t_payment_method_details_kakao_pay = { + buyer_id?: (string | null) | undefined +} + +export type t_payment_method_details_klarna = { + payer_details?: (t_klarna_payer_details | null) | undefined + payment_method_category?: (string | null) | undefined + preferred_locale?: (string | null) | undefined +} + +export type t_payment_method_details_konbini = { + store?: (t_payment_method_details_konbini_store | null) | undefined +} + +export type t_payment_method_details_konbini_store = { + chain?: + | ("familymart" | "lawson" | "ministop" | "seicomart" | null) + | undefined +} + +export type t_payment_method_details_kr_card = { + brand?: + | ( + | "bc" + | "citi" + | "hana" + | "hyundai" + | "jeju" + | "jeonbuk" + | "kakaobank" + | "kbank" + | "kdbbank" + | "kookmin" + | "kwangju" + | "lotte" + | "mg" + | "nh" + | "post" + | "samsung" + | "savingsbank" + | "shinhan" + | "shinhyup" + | "suhyup" + | "tossbank" + | "woori" + | null + ) + | undefined + buyer_id?: (string | null) | undefined + last4?: (string | null) | undefined +} + +export type t_payment_method_details_link = { + country?: (string | null) | undefined +} + +export type t_payment_method_details_mobilepay = { + card?: (t_internal_card | null) | undefined +} + +export type t_payment_method_details_multibanco = { + entity?: (string | null) | undefined + reference?: (string | null) | undefined +} + +export type t_payment_method_details_naver_pay = { + buyer_id?: (string | null) | undefined +} + +export type t_payment_method_details_nz_bank_account = { + account_holder_name?: (string | null) | undefined + bank_code: string + bank_name: string + branch_code: string + last4: string + suffix?: (string | null) | undefined +} + +export type t_payment_method_details_oxxo = { + number?: (string | null) | undefined +} + +export type t_payment_method_details_p24 = { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + | null + ) + | undefined + reference?: (string | null) | undefined + verified_name?: (string | null) | undefined +} + +export type t_payment_method_details_passthrough_card = { + brand?: (string | null) | undefined + country?: (string | null) | undefined + exp_month?: (number | null) | undefined + exp_year?: (number | null) | undefined + funding?: (string | null) | undefined + last4?: (string | null) | undefined +} + +export type t_payment_method_details_pay_by_bank = EmptyObject + +export type t_payment_method_details_payco = { + buyer_id?: (string | null) | undefined +} + +export type t_payment_method_details_paynow = { + reference?: (string | null) | undefined +} + +export type t_payment_method_details_paypal = { + country?: (string | null) | undefined + payer_email?: (string | null) | undefined + payer_id?: (string | null) | undefined + payer_name?: (string | null) | undefined + seller_protection?: (t_paypal_seller_protection | null) | undefined + transaction_id?: (string | null) | undefined +} + +export type t_payment_method_details_pix = { + bank_transaction_id?: (string | null) | undefined +} + +export type t_payment_method_details_promptpay = { + reference?: (string | null) | undefined +} + +export type t_payment_method_details_revolut_pay = { + funding?: t_revolut_pay_underlying_payment_method_funding_details | undefined +} + +export type t_payment_method_details_samsung_pay = { + buyer_id?: (string | null) | undefined +} + +export type t_payment_method_details_satispay = EmptyObject + +export type t_payment_method_details_sepa_debit = { + bank_code?: (string | null) | undefined + branch_code?: (string | null) | undefined + country?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + mandate?: (string | null) | undefined +} + +export type t_payment_method_details_sofort = { + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + bic?: (string | null) | undefined + country?: (string | null) | undefined + generated_sepa_debit?: (string | t_payment_method | null) | undefined + generated_sepa_debit_mandate?: (string | t_mandate | null) | undefined + iban_last4?: (string | null) | undefined + preferred_language?: + | ("de" | "en" | "es" | "fr" | "it" | "nl" | "pl" | null) + | undefined + verified_name?: (string | null) | undefined +} + +export type t_payment_method_details_stripe_account = EmptyObject + +export type t_payment_method_details_swish = { + fingerprint?: (string | null) | undefined + payment_reference?: (string | null) | undefined + verified_phone_last4?: (string | null) | undefined +} + +export type t_payment_method_details_twint = EmptyObject + +export type t_payment_method_details_us_bank_account = { + account_holder_type?: ("company" | "individual" | null) | undefined + account_type?: ("checking" | "savings" | null) | undefined + bank_name?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + mandate?: (string | t_mandate) | undefined + payment_reference?: (string | null) | undefined + routing_number?: (string | null) | undefined +} + +export type t_payment_method_details_wechat = EmptyObject + +export type t_payment_method_details_wechat_pay = { + fingerprint?: (string | null) | undefined + transaction_id?: (string | null) | undefined +} + +export type t_payment_method_details_zip = EmptyObject + +export type t_payment_method_domain = { + amazon_pay: t_payment_method_domain_resource_payment_method_status + apple_pay: t_payment_method_domain_resource_payment_method_status + created: number + domain_name: string + enabled: boolean + google_pay: t_payment_method_domain_resource_payment_method_status + id: string + link: t_payment_method_domain_resource_payment_method_status + livemode: boolean + object: "payment_method_domain" + paypal: t_payment_method_domain_resource_payment_method_status +} + +export type t_payment_method_domain_resource_payment_method_status = { + status: "active" | "inactive" + status_details?: + | t_payment_method_domain_resource_payment_method_status_details + | undefined +} + +export type t_payment_method_domain_resource_payment_method_status_details = { + error_message: string +} + +export type t_payment_method_eps = { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + | null + ) + | undefined +} + +export type t_payment_method_fpx = { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" +} + +export type t_payment_method_giropay = EmptyObject + +export type t_payment_method_grabpay = EmptyObject + +export type t_payment_method_ideal = { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + | null + ) + | undefined + bic?: + | ( + | "ABNANL2A" + | "ASNBNL21" + | "BITSNL2A" + | "BUNQNL2A" + | "FVLBNL22" + | "HANDNL2A" + | "INGBNL2A" + | "KNABNL2H" + | "MOYONL21" + | "NNBANL2G" + | "NTSBDEB1" + | "RABONL2U" + | "RBRBNL21" + | "REVOIE23" + | "REVOLT21" + | "SNSBNL2A" + | "TRIONL2U" + | null + ) + | undefined +} + +export type t_payment_method_interac_present = { + brand?: (string | null) | undefined + cardholder_name?: (string | null) | undefined + country?: (string | null) | undefined + description?: (string | null) | undefined + exp_month: number + exp_year: number + fingerprint?: (string | null) | undefined + funding?: (string | null) | undefined + issuer?: (string | null) | undefined + last4?: (string | null) | undefined + networks?: (t_payment_method_card_present_networks | null) | undefined + preferred_locales?: (string[] | null) | undefined + read_method?: + | ( + | "contact_emv" + | "contactless_emv" + | "contactless_magstripe_mode" + | "magnetic_stripe_fallback" + | "magnetic_stripe_track2" + | null + ) + | undefined +} + +export type t_payment_method_kakao_pay = EmptyObject + +export type t_payment_method_klarna = { + dob?: (t_payment_flows_private_payment_methods_klarna_dob | null) | undefined +} + +export type t_payment_method_konbini = EmptyObject + +export type t_payment_method_kr_card = { + brand?: + | ( + | "bc" + | "citi" + | "hana" + | "hyundai" + | "jeju" + | "jeonbuk" + | "kakaobank" + | "kbank" + | "kdbbank" + | "kookmin" + | "kwangju" + | "lotte" + | "mg" + | "nh" + | "post" + | "samsung" + | "savingsbank" + | "shinhan" + | "shinhyup" + | "suhyup" + | "tossbank" + | "woori" + | null + ) + | undefined + last4?: (string | null) | undefined +} + +export type t_payment_method_link = { + email?: (string | null) | undefined +} + +export type t_payment_method_mobilepay = EmptyObject + +export type t_payment_method_multibanco = EmptyObject + +export type t_payment_method_naver_pay = { + buyer_id?: (string | null) | undefined + funding: "card" | "points" +} + +export type t_payment_method_nz_bank_account = { + account_holder_name?: (string | null) | undefined + bank_code: string + bank_name: string + branch_code: string + last4: string + suffix?: (string | null) | undefined +} + +export type t_payment_method_options_affirm = { + capture_method?: "manual" | undefined + preferred_locale?: string | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_afterpay_clearpay = { + capture_method?: "manual" | undefined + reference?: (string | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_alipay = { + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_method_options_alma = { + capture_method?: "manual" | undefined +} + +export type t_payment_method_options_amazon_pay = { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_method_options_bancontact = { + preferred_language: "de" | "en" | "fr" | "nl" + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_method_options_boleto = { + expires_after_days: number + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined +} + +export type t_payment_method_options_card_installments = { + available_plans?: + | (t_payment_method_details_card_installments_plan[] | null) + | undefined + enabled: boolean + plan?: (t_payment_method_details_card_installments_plan | null) | undefined +} + +export type t_payment_method_options_card_mandate_options = { + amount: number + amount_type: "fixed" | "maximum" + description?: (string | null) | undefined + end_date?: (number | null) | undefined + interval: "day" | "month" | "sporadic" | "week" | "year" + interval_count?: (number | null) | undefined + reference: string + start_date: number + supported_types?: ("india"[] | null) | undefined +} + +export type t_payment_method_options_card_present = { + request_extended_authorization?: (boolean | null) | undefined + request_incremental_authorization_support?: (boolean | null) | undefined + routing?: t_payment_method_options_card_present_routing | undefined +} + +export type t_payment_method_options_card_present_routing = { + requested_priority?: ("domestic" | "international" | null) | undefined +} + +export type t_payment_method_options_cashapp = { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session" | "on_session") | undefined +} + +export type t_payment_method_options_customer_balance = { + bank_transfer?: + | t_payment_method_options_customer_balance_bank_transfer + | undefined + funding_type?: ("bank_transfer" | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_customer_balance_bank_transfer = { + eu_bank_transfer?: + | t_payment_method_options_customer_balance_eu_bank_account + | undefined + requested_address_types?: + | ("aba" | "iban" | "sepa" | "sort_code" | "spei" | "swift" | "zengin")[] + | undefined + type?: + | ( + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" + | null + ) + | undefined +} + +export type t_payment_method_options_customer_balance_eu_bank_account = { + country: "BE" | "DE" | "ES" | "FR" | "IE" | "NL" +} + +export type t_payment_method_options_fpx = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_giropay = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_grabpay = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_ideal = { + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_method_options_interac_present = EmptyObject + +export type t_payment_method_options_klarna = { + capture_method?: "manual" | undefined + preferred_locale?: (string | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_konbini = { + confirmation_number?: (string | null) | undefined + expires_after_days?: (number | null) | undefined + expires_at?: (number | null) | undefined + product_description?: (string | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_kr_card = { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_method_options_multibanco = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_oxxo = { + expires_after_days: number + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_p24 = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_pay_by_bank = EmptyObject + +export type t_payment_method_options_paynow = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_paypal = { + capture_method?: "manual" | undefined + preferred_locale?: (string | null) | undefined + reference?: (string | null) | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_method_options_pix = { + expires_after_seconds?: (number | null) | undefined + expires_at?: (number | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_promptpay = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_revolut_pay = { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_method_options_sofort = { + preferred_language?: + | ("de" | "en" | "es" | "fr" | "it" | "nl" | "pl" | null) + | undefined + setup_future_usage?: ("none" | "off_session") | undefined +} + +export type t_payment_method_options_twint = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_us_bank_account_mandate_options = { + collection_method?: "paper" | undefined +} + +export type t_payment_method_options_wechat_pay = { + app_id?: (string | null) | undefined + client?: ("android" | "ios" | "web" | null) | undefined + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_options_zip = { + setup_future_usage?: "none" | undefined +} + +export type t_payment_method_oxxo = EmptyObject + +export type t_payment_method_p24 = { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + | null + ) + | undefined +} + +export type t_payment_method_pay_by_bank = EmptyObject + +export type t_payment_method_payco = EmptyObject + +export type t_payment_method_paynow = EmptyObject + +export type t_payment_method_paypal = { + country?: (string | null) | undefined + payer_email?: (string | null) | undefined + payer_id?: (string | null) | undefined +} + +export type t_payment_method_pix = EmptyObject + +export type t_payment_method_promptpay = EmptyObject + +export type t_payment_method_revolut_pay = EmptyObject + +export type t_payment_method_samsung_pay = EmptyObject + +export type t_payment_method_satispay = EmptyObject + +export type t_payment_method_sepa_debit = { + bank_code?: (string | null) | undefined + branch_code?: (string | null) | undefined + country?: (string | null) | undefined + fingerprint?: (string | null) | undefined + generated_from?: (t_sepa_debit_generated_from | null) | undefined + last4?: (string | null) | undefined +} + +export type t_payment_method_sofort = { + country?: (string | null) | undefined +} + +export type t_payment_method_swish = EmptyObject + +export type t_payment_method_twint = EmptyObject + +export type t_payment_method_us_bank_account = { + account_holder_type?: ("company" | "individual" | null) | undefined + account_type?: ("checking" | "savings" | null) | undefined + bank_name?: (string | null) | undefined + financial_connections_account?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + networks?: (t_us_bank_account_networks | null) | undefined + routing_number?: (string | null) | undefined + status_details?: + | (t_payment_method_us_bank_account_status_details | null) + | undefined +} + +export type t_payment_method_us_bank_account_blocked = { + network_code?: + | ( + | "R02" + | "R03" + | "R04" + | "R05" + | "R07" + | "R08" + | "R10" + | "R11" + | "R16" + | "R20" + | "R29" + | "R31" + | null + ) + | undefined + reason?: + | ( + | "bank_account_closed" + | "bank_account_frozen" + | "bank_account_invalid_details" + | "bank_account_restricted" + | "bank_account_unusable" + | "debit_not_authorized" + | null + ) + | undefined +} + +export type t_payment_method_us_bank_account_status_details = { + blocked?: t_payment_method_us_bank_account_blocked | undefined +} + +export type t_payment_method_wechat_pay = EmptyObject + +export type t_payment_method_zip = EmptyObject + +export type t_payment_pages_checkout_session_adaptive_pricing = { + enabled: boolean +} + +export type t_payment_pages_checkout_session_after_expiration = { + recovery?: + | (t_payment_pages_checkout_session_after_expiration_recovery | null) + | undefined +} + +export type t_payment_pages_checkout_session_after_expiration_recovery = { + allow_promotion_codes: boolean + enabled: boolean + expires_at?: (number | null) | undefined + url?: (string | null) | undefined +} + +export type t_payment_pages_checkout_session_automatic_tax = { + enabled: boolean + liability?: (t_connect_account_reference | null) | undefined + status?: + | ("complete" | "failed" | "requires_location_inputs" | null) + | undefined +} + +export type t_payment_pages_checkout_session_checkout_address_details = { + address: t_address + name: string +} + +export type t_payment_pages_checkout_session_collected_information = { + shipping_details?: + | (t_payment_pages_checkout_session_checkout_address_details | null) + | undefined +} + +export type t_payment_pages_checkout_session_consent = { + promotions?: ("opt_in" | "opt_out" | null) | undefined + terms_of_service?: ("accepted" | null) | undefined +} + +export type t_payment_pages_checkout_session_consent_collection = { + payment_method_reuse_agreement?: + | (t_payment_pages_checkout_session_payment_method_reuse_agreement | null) + | undefined + promotions?: ("auto" | "none" | null) | undefined + terms_of_service?: ("none" | "required" | null) | undefined +} + +export type t_payment_pages_checkout_session_currency_conversion = { + amount_subtotal: number + amount_total: number + fx_rate: string + source_currency: string +} + +export type t_payment_pages_checkout_session_custom_fields = { + dropdown?: t_payment_pages_checkout_session_custom_fields_dropdown | undefined + key: string + label: t_payment_pages_checkout_session_custom_fields_label + numeric?: t_payment_pages_checkout_session_custom_fields_numeric | undefined + optional: boolean + text?: t_payment_pages_checkout_session_custom_fields_text | undefined + type: "dropdown" | "numeric" | "text" +} + +export type t_payment_pages_checkout_session_custom_fields_dropdown = { + default_value?: (string | null) | undefined + options: t_payment_pages_checkout_session_custom_fields_option[] + value?: (string | null) | undefined +} + +export type t_payment_pages_checkout_session_custom_fields_label = { + custom?: (string | null) | undefined + type: "custom" +} + +export type t_payment_pages_checkout_session_custom_fields_numeric = { + default_value?: (string | null) | undefined + maximum_length?: (number | null) | undefined + minimum_length?: (number | null) | undefined + value?: (string | null) | undefined +} + +export type t_payment_pages_checkout_session_custom_fields_option = { + label: string + value: string +} + +export type t_payment_pages_checkout_session_custom_fields_text = { + default_value?: (string | null) | undefined + maximum_length?: (number | null) | undefined + minimum_length?: (number | null) | undefined + value?: (string | null) | undefined +} + +export type t_payment_pages_checkout_session_custom_text = { + after_submit?: + | (t_payment_pages_checkout_session_custom_text_position | null) + | undefined + shipping_address?: + | (t_payment_pages_checkout_session_custom_text_position | null) + | undefined + submit?: + | (t_payment_pages_checkout_session_custom_text_position | null) + | undefined + terms_of_service_acceptance?: + | (t_payment_pages_checkout_session_custom_text_position | null) + | undefined +} + +export type t_payment_pages_checkout_session_custom_text_position = { + message: string +} + +export type t_payment_pages_checkout_session_customer_details = { + address?: (t_address | null) | undefined + email?: (string | null) | undefined + name?: (string | null) | undefined + phone?: (string | null) | undefined + tax_exempt?: ("exempt" | "none" | "reverse" | null) | undefined + tax_ids?: (t_payment_pages_checkout_session_tax_id[] | null) | undefined +} + +export type t_payment_pages_checkout_session_discount = { + coupon?: (string | t_coupon | null) | undefined + promotion_code?: (string | t_promotion_code | null) | undefined +} + +export type t_payment_pages_checkout_session_invoice_creation = { + enabled: boolean + invoice_data: t_payment_pages_checkout_session_invoice_settings +} + +export type t_payment_pages_checkout_session_invoice_settings = { + account_tax_ids?: + | ((string | t_tax_id | t_deleted_tax_id)[] | null) + | undefined + custom_fields?: (t_invoice_setting_custom_field[] | null) | undefined + description?: (string | null) | undefined + footer?: (string | null) | undefined + issuer?: (t_connect_account_reference | null) | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + rendering_options?: + | (t_invoice_setting_checkout_rendering_options | null) + | undefined +} + +export type t_payment_pages_checkout_session_optional_item = { + adjustable_quantity?: + | (t_payment_pages_checkout_session_optional_item_adjustable_quantity | null) + | undefined + price: string + quantity: number +} + +export type t_payment_pages_checkout_session_optional_item_adjustable_quantity = + { + enabled: boolean + maximum?: (number | null) | undefined + minimum?: (number | null) | undefined + } + +export type t_payment_pages_checkout_session_payment_method_reuse_agreement = { + position: "auto" | "hidden" +} + +export type t_payment_pages_checkout_session_permissions = { + update_shipping_details?: ("client_only" | "server_only" | null) | undefined +} + +export type t_payment_pages_checkout_session_phone_number_collection = { + enabled: boolean +} + +export type t_payment_pages_checkout_session_saved_payment_method_options = { + allow_redisplay_filters?: + | (("always" | "limited" | "unspecified")[] | null) + | undefined + payment_method_remove?: ("disabled" | "enabled" | null) | undefined + payment_method_save?: ("disabled" | "enabled" | null) | undefined +} + +export type t_payment_pages_checkout_session_shipping_address_collection = { + allowed_countries: ( + | "AC" + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TA" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VN" + | "VU" + | "WF" + | "WS" + | "XK" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | "ZZ" + )[] +} + +export type t_payment_pages_checkout_session_shipping_cost = { + amount_subtotal: number + amount_tax: number + amount_total: number + shipping_rate?: (string | t_shipping_rate | null) | undefined + taxes?: t_line_items_tax_amount[] | undefined +} + +export type t_payment_pages_checkout_session_shipping_option = { + shipping_amount: number + shipping_rate: string | t_shipping_rate +} + +export type t_payment_pages_checkout_session_tax_id = { + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "unknown" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value?: (string | null) | undefined +} + +export type t_payment_pages_checkout_session_tax_id_collection = { + enabled: boolean + required: "if_supported" | "never" +} + +export type t_payment_pages_checkout_session_total_details = { + amount_discount: number + amount_shipping?: (number | null) | undefined + amount_tax: number + breakdown?: + | t_payment_pages_checkout_session_total_details_resource_breakdown + | undefined +} + +export type t_payment_pages_checkout_session_total_details_resource_breakdown = + { + discounts: t_line_items_discount_amount[] + taxes: t_line_items_tax_amount[] + } + +export type t_payment_pages_private_card_payment_method_options_resource_restrictions = + { + brands_blocked?: + | ( + | "american_express" + | "discover_global_network" + | "mastercard" + | "visa" + )[] + | undefined + } + +export type t_payment_source = t_account | t_bank_account | t_card | t_source + +export type t_payout = { + amount: number + application_fee?: (string | t_application_fee | null) | undefined + application_fee_amount?: (number | null) | undefined + arrival_date: number + automatic: boolean + balance_transaction?: (string | t_balance_transaction | null) | undefined + created: number + currency: string + description?: (string | null) | undefined + destination?: + | ( + | string + | t_bank_account + | t_card + | t_deleted_bank_account + | t_deleted_card + | null + ) + | undefined + failure_balance_transaction?: + | (string | t_balance_transaction | null) + | undefined + failure_code?: (string | null) | undefined + failure_message?: (string | null) | undefined + id: string + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + method: string + object: "payout" + original_payout?: (string | t_payout | null) | undefined + reconciliation_status: "completed" | "in_progress" | "not_applicable" + reversed_by?: (string | t_payout | null) | undefined + source_type: string + statement_descriptor?: (string | null) | undefined + status: string + trace_id?: (t_payouts_trace_id | null) | undefined + type: "bank_account" | "card" +} + +export type t_payouts_trace_id = { + status: string + value?: (string | null) | undefined +} + +export type t_paypal_seller_protection = { + dispute_categories?: + | (("fraudulent" | "product_not_received")[] | null) + | undefined + status: "eligible" | "not_eligible" | "partially_eligible" +} + +export type t_person = { + account: string + additional_tos_acceptances?: t_person_additional_tos_acceptances | undefined + address?: t_address | undefined + address_kana?: (t_legal_entity_japan_address | null) | undefined + address_kanji?: (t_legal_entity_japan_address | null) | undefined + created: number + dob?: t_legal_entity_dob | undefined + email?: (string | null) | undefined + first_name?: (string | null) | undefined + first_name_kana?: (string | null) | undefined + first_name_kanji?: (string | null) | undefined + full_name_aliases?: string[] | undefined + future_requirements?: (t_person_future_requirements | null) | undefined + gender?: (string | null) | undefined + id: string + id_number_provided?: boolean | undefined + id_number_secondary_provided?: boolean | undefined + last_name?: (string | null) | undefined + last_name_kana?: (string | null) | undefined + last_name_kanji?: (string | null) | undefined + maiden_name?: (string | null) | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + nationality?: (string | null) | undefined + object: "person" + phone?: (string | null) | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: t_address | undefined + relationship?: t_person_relationship | undefined + requirements?: (t_person_requirements | null) | undefined + ssn_last_4_provided?: boolean | undefined + verification?: t_legal_entity_person_verification | undefined +} + +export type t_person_additional_tos_acceptance = { + date?: (number | null) | undefined + ip?: (string | null) | undefined + user_agent?: (string | null) | undefined +} + +export type t_person_additional_tos_acceptances = { + account?: (t_person_additional_tos_acceptance | null) | undefined +} + +export type t_person_future_requirements = { + alternatives?: (t_account_requirements_alternative[] | null) | undefined + currently_due: string[] + errors: t_account_requirements_error[] + eventually_due: string[] + past_due: string[] + pending_verification: string[] +} + +export type t_person_relationship = { + authorizer?: (boolean | null) | undefined + director?: (boolean | null) | undefined + executive?: (boolean | null) | undefined + legal_guardian?: (boolean | null) | undefined + owner?: (boolean | null) | undefined + percent_ownership?: (number | null) | undefined + representative?: (boolean | null) | undefined + title?: (string | null) | undefined +} + +export type t_person_requirements = { + alternatives?: (t_account_requirements_alternative[] | null) | undefined + currently_due: string[] + errors: t_account_requirements_error[] + eventually_due: string[] + past_due: string[] + pending_verification: string[] +} + +export type t_plan = { + active: boolean + amount?: (number | null) | undefined + amount_decimal?: (string | null) | undefined + billing_scheme: "per_unit" | "tiered" + created: number + currency: string + id: string + interval: "day" | "month" | "week" | "year" + interval_count: number + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + meter?: (string | null) | undefined + nickname?: (string | null) | undefined + object: "plan" + product?: (string | t_product | t_deleted_product | null) | undefined + tiers?: t_plan_tier[] | undefined + tiers_mode?: ("graduated" | "volume" | null) | undefined + transform_usage?: (t_transform_usage | null) | undefined + trial_period_days?: (number | null) | undefined + usage_type: "licensed" | "metered" +} + +export type t_plan_tier = { + flat_amount?: (number | null) | undefined + flat_amount_decimal?: (string | null) | undefined + unit_amount?: (number | null) | undefined + unit_amount_decimal?: (string | null) | undefined + up_to?: (number | null) | undefined +} + +export type t_platform_earning_fee_source = { + charge?: string | undefined + payout?: string | undefined + type: "charge" | "payout" +} + +export type t_portal_business_profile = { + headline?: (string | null) | undefined + privacy_policy_url?: (string | null) | undefined + terms_of_service_url?: (string | null) | undefined +} + +export type t_portal_customer_update = { + allowed_updates: ( + | "address" + | "email" + | "name" + | "phone" + | "shipping" + | "tax_id" + )[] + enabled: boolean +} + +export type t_portal_features = { + customer_update: t_portal_customer_update + invoice_history: t_portal_invoice_list + payment_method_update: t_portal_payment_method_update + subscription_cancel: t_portal_subscription_cancel + subscription_update: t_portal_subscription_update +} + +export type t_portal_flows_after_completion_hosted_confirmation = { + custom_message?: (string | null) | undefined +} + +export type t_portal_flows_after_completion_redirect = { + return_url: string +} + +export type t_portal_flows_coupon_offer = { + coupon: string +} + +export type t_portal_flows_flow = { + after_completion: t_portal_flows_flow_after_completion + subscription_cancel?: + | (t_portal_flows_flow_subscription_cancel | null) + | undefined + subscription_update?: + | (t_portal_flows_flow_subscription_update | null) + | undefined + subscription_update_confirm?: + | (t_portal_flows_flow_subscription_update_confirm | null) + | undefined + type: + | "payment_method_update" + | "subscription_cancel" + | "subscription_update" + | "subscription_update_confirm" +} + +export type t_portal_flows_flow_after_completion = { + hosted_confirmation?: + | (t_portal_flows_after_completion_hosted_confirmation | null) + | undefined + redirect?: (t_portal_flows_after_completion_redirect | null) | undefined + type: "hosted_confirmation" | "portal_homepage" | "redirect" +} + +export type t_portal_flows_flow_subscription_cancel = { + retention?: (t_portal_flows_retention | null) | undefined + subscription: string +} + +export type t_portal_flows_flow_subscription_update = { + subscription: string +} + +export type t_portal_flows_flow_subscription_update_confirm = { + discounts?: + | (t_portal_flows_subscription_update_confirm_discount[] | null) + | undefined + items: t_portal_flows_subscription_update_confirm_item[] + subscription: string +} + +export type t_portal_flows_retention = { + coupon_offer?: (t_portal_flows_coupon_offer | null) | undefined + type: "coupon_offer" +} + +export type t_portal_flows_subscription_update_confirm_discount = { + coupon?: (string | null) | undefined + promotion_code?: (string | null) | undefined +} + +export type t_portal_flows_subscription_update_confirm_item = { + id?: (string | null) | undefined + price?: (string | null) | undefined + quantity?: number | undefined +} + +export type t_portal_invoice_list = { + enabled: boolean +} + +export type t_portal_login_page = { + enabled: boolean + url?: (string | null) | undefined +} + +export type t_portal_payment_method_update = { + enabled: boolean +} + +export type t_portal_resource_schedule_update_at_period_end = { + conditions: t_portal_resource_schedule_update_at_period_end_condition[] +} + +export type t_portal_resource_schedule_update_at_period_end_condition = { + type: "decreasing_item_amount" | "shortening_interval" +} + +export type t_portal_subscription_cancel = { + cancellation_reason: t_portal_subscription_cancellation_reason + enabled: boolean + mode: "at_period_end" | "immediately" + proration_behavior: "always_invoice" | "create_prorations" | "none" +} + +export type t_portal_subscription_cancellation_reason = { + enabled: boolean + options: ( + | "customer_service" + | "low_quality" + | "missing_features" + | "other" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + )[] +} + +export type t_portal_subscription_update = { + default_allowed_updates: ("price" | "promotion_code" | "quantity")[] + enabled: boolean + products?: (t_portal_subscription_update_product[] | null) | undefined + proration_behavior: "always_invoice" | "create_prorations" | "none" + schedule_at_period_end: t_portal_resource_schedule_update_at_period_end +} + +export type t_portal_subscription_update_product = { + prices: string[] + product: string +} + +export type t_price = { + active: boolean + billing_scheme: "per_unit" | "tiered" + created: number + currency: string + currency_options?: + | { + [key: string]: t_currency_option | undefined + } + | undefined + custom_unit_amount?: (t_custom_unit_amount | null) | undefined + id: string + livemode: boolean + lookup_key?: (string | null) | undefined + metadata: { + [key: string]: string | undefined + } + nickname?: (string | null) | undefined + object: "price" + product: string | t_product | t_deleted_product + recurring?: (t_recurring | null) | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified" | null) | undefined + tiers?: t_price_tier[] | undefined + tiers_mode?: ("graduated" | "volume" | null) | undefined + transform_quantity?: (t_transform_quantity | null) | undefined + type: "one_time" | "recurring" + unit_amount?: (number | null) | undefined + unit_amount_decimal?: (string | null) | undefined +} + +export type t_price_tier = { + flat_amount?: (number | null) | undefined + flat_amount_decimal?: (string | null) | undefined + unit_amount?: (number | null) | undefined + unit_amount_decimal?: (string | null) | undefined + up_to?: (number | null) | undefined +} + +export type t_product = { + active: boolean + created: number + default_price?: (string | t_price | null) | undefined + description?: (string | null) | undefined + id: string + images: string[] + livemode: boolean + marketing_features: t_product_marketing_feature[] + metadata: { + [key: string]: string | undefined + } + name: string + object: "product" + package_dimensions?: (t_package_dimensions | null) | undefined + shippable?: (boolean | null) | undefined + statement_descriptor?: (string | null) | undefined + tax_code?: (string | t_tax_code | null) | undefined + unit_label?: (string | null) | undefined + updated: number + url?: (string | null) | undefined +} + +export type t_product_feature = { + entitlement_feature: t_entitlements_feature + id: string + livemode: boolean + object: "product_feature" +} + +export type t_product_marketing_feature = { + name?: string | undefined +} + +export type t_promotion_code = { + active: boolean + code: string + coupon: t_coupon + created: number + customer?: (string | t_customer | t_deleted_customer | null) | undefined + expires_at?: (number | null) | undefined + id: string + livemode: boolean + max_redemptions?: (number | null) | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "promotion_code" + restrictions: t_promotion_codes_resource_restrictions + times_redeemed: number +} + +export type t_promotion_code_currency_option = { + minimum_amount: number +} + +export type t_promotion_codes_resource_restrictions = { + currency_options?: + | { + [key: string]: t_promotion_code_currency_option | undefined + } + | undefined + first_time_transaction: boolean + minimum_amount?: (number | null) | undefined + minimum_amount_currency?: (string | null) | undefined +} + +export type t_quote = { + amount_subtotal: number + amount_total: number + application?: + | (string | t_application | t_deleted_application | null) + | undefined + application_fee_amount?: (number | null) | undefined + application_fee_percent?: (number | null) | undefined + automatic_tax: t_quotes_resource_automatic_tax + collection_method: "charge_automatically" | "send_invoice" + computed: t_quotes_resource_computed + created: number + currency?: (string | null) | undefined + customer?: (string | t_customer | t_deleted_customer | null) | undefined + default_tax_rates?: (string | t_tax_rate)[] | undefined + description?: (string | null) | undefined + discounts: (string | t_discount)[] + expires_at: number + footer?: (string | null) | undefined + from_quote?: (t_quotes_resource_from_quote | null) | undefined + header?: (string | null) | undefined + id: string + invoice?: (string | t_invoice | t_deleted_invoice | null) | undefined + invoice_settings: t_invoice_setting_quote_setting + line_items?: + | { + data: t_item[] + has_more: boolean + object: "list" + url: string + } + | undefined + livemode: boolean + metadata: { + [key: string]: string | undefined + } + number?: (string | null) | undefined + object: "quote" + on_behalf_of?: (string | t_account | null) | undefined + status: "accepted" | "canceled" | "draft" | "open" + status_transitions: t_quotes_resource_status_transitions + subscription?: (string | t_subscription | null) | undefined + subscription_data: t_quotes_resource_subscription_data_subscription_data + subscription_schedule?: (string | t_subscription_schedule | null) | undefined + test_clock?: (string | t_test_helpers_test_clock | null) | undefined + total_details: t_quotes_resource_total_details + transfer_data?: (t_quotes_resource_transfer_data | null) | undefined +} + +export type t_quotes_resource_automatic_tax = { + enabled: boolean + liability?: (t_connect_account_reference | null) | undefined + status?: + | ("complete" | "failed" | "requires_location_inputs" | null) + | undefined +} + +export type t_quotes_resource_computed = { + recurring?: (t_quotes_resource_recurring | null) | undefined + upfront: t_quotes_resource_upfront +} + +export type t_quotes_resource_from_quote = { + is_revision: boolean + quote: string | t_quote +} + +export type t_quotes_resource_recurring = { + amount_subtotal: number + amount_total: number + interval: "day" | "month" | "week" | "year" + interval_count: number + total_details: t_quotes_resource_total_details +} + +export type t_quotes_resource_status_transitions = { + accepted_at?: (number | null) | undefined + canceled_at?: (number | null) | undefined + finalized_at?: (number | null) | undefined +} + +export type t_quotes_resource_subscription_data_subscription_data = { + description?: (string | null) | undefined + effective_date?: (number | null) | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + trial_period_days?: (number | null) | undefined +} + +export type t_quotes_resource_total_details = { + amount_discount: number + amount_shipping?: (number | null) | undefined + amount_tax: number + breakdown?: t_quotes_resource_total_details_resource_breakdown | undefined +} + +export type t_quotes_resource_total_details_resource_breakdown = { + discounts: t_line_items_discount_amount[] + taxes: t_line_items_tax_amount[] +} + +export type t_quotes_resource_transfer_data = { + amount?: (number | null) | undefined + amount_percent?: (number | null) | undefined + destination: string | t_account +} + +export type t_quotes_resource_upfront = { + amount_subtotal: number + amount_total: number + line_items?: + | { + data: t_item[] + has_more: boolean + object: "list" + url: string + } + | undefined + total_details: t_quotes_resource_total_details +} + +export type t_radar_early_fraud_warning = { + actionable: boolean + charge: string | t_charge + created: number + fraud_type: string + id: string + livemode: boolean + object: "radar.early_fraud_warning" + payment_intent?: (string | t_payment_intent) | undefined +} + +export type t_radar_value_list = { + alias: string + created: number + created_by: string + id: string + item_type: + | "card_bin" + | "card_fingerprint" + | "case_sensitive_string" + | "country" + | "customer_id" + | "email" + | "ip_address" + | "sepa_debit_fingerprint" + | "string" + | "us_bank_account_fingerprint" + list_items: { + data: t_radar_value_list_item[] + has_more: boolean + object: "list" + url: string + } + livemode: boolean + metadata: { + [key: string]: string | undefined + } + name: string + object: "radar.value_list" +} + +export type t_radar_value_list_item = { + created: number + created_by: string + id: string + livemode: boolean + object: "radar.value_list_item" + value: string + value_list: string +} + +export type t_radar_radar_options = { + session?: string | undefined +} + +export type t_radar_review_resource_location = { + city?: (string | null) | undefined + country?: (string | null) | undefined + latitude?: (number | null) | undefined + longitude?: (number | null) | undefined + region?: (string | null) | undefined +} + +export type t_radar_review_resource_session = { + browser?: (string | null) | undefined + device?: (string | null) | undefined + platform?: (string | null) | undefined + version?: (string | null) | undefined +} + +export type t_received_payment_method_details_financial_account = { + id: string + network: "stripe" +} + +export type t_recurring = { + interval: "day" | "month" | "week" | "year" + interval_count: number + meter?: (string | null) | undefined + usage_type: "licensed" | "metered" +} + +export type t_refund = { + amount: number + balance_transaction?: (string | t_balance_transaction | null) | undefined + charge?: (string | t_charge | null) | undefined + created: number + currency: string + description?: string | undefined + destination_details?: t_refund_destination_details | undefined + failure_balance_transaction?: (string | t_balance_transaction) | undefined + failure_reason?: string | undefined + id: string + instructions_email?: string | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + next_action?: t_refund_next_action | undefined + object: "refund" + payment_intent?: (string | t_payment_intent | null) | undefined + presentment_details?: + | t_payment_flows_payment_intent_presentment_details + | undefined + reason?: + | ( + | "duplicate" + | "expired_uncaptured_charge" + | "fraudulent" + | "requested_by_customer" + | null + ) + | undefined + receipt_number?: (string | null) | undefined + source_transfer_reversal?: (string | t_transfer_reversal | null) | undefined + status?: (string | null) | undefined + transfer_reversal?: (string | t_transfer_reversal | null) | undefined +} + +export type t_refund_destination_details = { + affirm?: t_destination_details_unimplemented | undefined + afterpay_clearpay?: t_destination_details_unimplemented | undefined + alipay?: t_destination_details_unimplemented | undefined + alma?: t_destination_details_unimplemented | undefined + amazon_pay?: t_destination_details_unimplemented | undefined + au_bank_transfer?: t_destination_details_unimplemented | undefined + blik?: t_refund_destination_details_blik | undefined + br_bank_transfer?: t_refund_destination_details_br_bank_transfer | undefined + card?: t_refund_destination_details_card | undefined + cashapp?: t_destination_details_unimplemented | undefined + customer_cash_balance?: t_destination_details_unimplemented | undefined + eps?: t_destination_details_unimplemented | undefined + eu_bank_transfer?: t_refund_destination_details_eu_bank_transfer | undefined + gb_bank_transfer?: t_refund_destination_details_gb_bank_transfer | undefined + giropay?: t_destination_details_unimplemented | undefined + grabpay?: t_destination_details_unimplemented | undefined + jp_bank_transfer?: t_refund_destination_details_jp_bank_transfer | undefined + klarna?: t_destination_details_unimplemented | undefined + multibanco?: t_refund_destination_details_multibanco | undefined + mx_bank_transfer?: t_refund_destination_details_mx_bank_transfer | undefined + nz_bank_transfer?: t_destination_details_unimplemented | undefined + p24?: t_refund_destination_details_p24 | undefined + paynow?: t_destination_details_unimplemented | undefined + paypal?: t_destination_details_unimplemented | undefined + pix?: t_destination_details_unimplemented | undefined + revolut?: t_destination_details_unimplemented | undefined + sofort?: t_destination_details_unimplemented | undefined + swish?: t_refund_destination_details_swish | undefined + th_bank_transfer?: t_refund_destination_details_th_bank_transfer | undefined + type: string + us_bank_transfer?: t_refund_destination_details_us_bank_transfer | undefined + wechat_pay?: t_destination_details_unimplemented | undefined + zip?: t_destination_details_unimplemented | undefined +} + +export type t_refund_destination_details_blik = { + network_decline_code?: (string | null) | undefined + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_br_bank_transfer = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_card = { + reference?: string | undefined + reference_status?: string | undefined + reference_type?: string | undefined + type: "pending" | "refund" | "reversal" +} + +export type t_refund_destination_details_eu_bank_transfer = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_gb_bank_transfer = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_jp_bank_transfer = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_multibanco = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_mx_bank_transfer = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_p24 = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_swish = { + network_decline_code?: (string | null) | undefined + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_th_bank_transfer = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_destination_details_us_bank_transfer = { + reference?: (string | null) | undefined + reference_status?: (string | null) | undefined +} + +export type t_refund_next_action = { + display_details?: t_refund_next_action_display_details | undefined + type: string +} + +export type t_refund_next_action_display_details = { + email_sent: t_email_sent + expires_at: number +} + +export type t_reporting_report_run = { + created: number + error?: (string | null) | undefined + id: string + livemode: boolean + object: "reporting.report_run" + parameters: t_financial_reporting_finance_report_run_run_parameters + report_type: string + result?: (t_file | null) | undefined + status: string + succeeded_at?: (number | null) | undefined +} + +export type t_reporting_report_type = { + data_available_end: number + data_available_start: number + default_columns?: (string[] | null) | undefined + id: string + livemode: boolean + name: string + object: "reporting.report_type" + updated: number + version: number +} + +export type t_reserve_transaction = { + amount: number + currency: string + description?: (string | null) | undefined + id: string + object: "reserve_transaction" +} + +export type t_review = { + billing_zip?: (string | null) | undefined + charge?: (string | t_charge | null) | undefined + closed_reason?: + | ( + | "approved" + | "canceled" + | "disputed" + | "redacted" + | "refunded" + | "refunded_as_fraud" + | null + ) + | undefined + created: number + id: string + ip_address?: (string | null) | undefined + ip_address_location?: (t_radar_review_resource_location | null) | undefined + livemode: boolean + object: "review" + open: boolean + opened_reason: "manual" | "rule" + payment_intent?: (string | t_payment_intent) | undefined + reason: string + session?: (t_radar_review_resource_session | null) | undefined +} + +export type t_revolut_pay_underlying_payment_method_funding_details = { + card?: t_payment_method_details_passthrough_card | undefined + type?: ("card" | null) | undefined +} + +export type t_rule = { + action: string + id: string + predicate: string +} + +export type t_scheduled_query_run = { + created: number + data_load_time: number + error?: t_sigma_scheduled_query_run_error | undefined + file?: (t_file | null) | undefined + id: string + livemode: boolean + object: "scheduled_query_run" + result_available_until: number + sql: string + status: string + title: string +} + +export type t_schedules_phase_automatic_tax = { + disabled_reason?: ("requires_location_inputs" | null) | undefined + enabled: boolean + liability?: (t_connect_account_reference | null) | undefined +} + +export type t_secret_service_resource_scope = { + type: "account" | "user" + user?: string | undefined +} + +export type t_sepa_debit_generated_from = { + charge?: (string | t_charge | null) | undefined + setup_attempt?: (string | t_setup_attempt | null) | undefined +} + +export type t_setup_attempt = { + application?: (string | t_application | null) | undefined + attach_to_self?: boolean | undefined + created: number + customer?: (string | t_customer | t_deleted_customer | null) | undefined + flow_directions?: (("inbound" | "outbound")[] | null) | undefined + id: string + livemode: boolean + object: "setup_attempt" + on_behalf_of?: (string | t_account | null) | undefined + payment_method: string | t_payment_method + payment_method_details: t_setup_attempt_payment_method_details + setup_error?: (t_api_errors | null) | undefined + setup_intent: string | t_setup_intent + status: string + usage: string +} + +export type t_setup_attempt_payment_method_details = { + acss_debit?: t_setup_attempt_payment_method_details_acss_debit | undefined + amazon_pay?: t_setup_attempt_payment_method_details_amazon_pay | undefined + au_becs_debit?: + | t_setup_attempt_payment_method_details_au_becs_debit + | undefined + bacs_debit?: t_setup_attempt_payment_method_details_bacs_debit | undefined + bancontact?: t_setup_attempt_payment_method_details_bancontact | undefined + boleto?: t_setup_attempt_payment_method_details_boleto | undefined + card?: t_setup_attempt_payment_method_details_card | undefined + card_present?: t_setup_attempt_payment_method_details_card_present | undefined + cashapp?: t_setup_attempt_payment_method_details_cashapp | undefined + ideal?: t_setup_attempt_payment_method_details_ideal | undefined + kakao_pay?: t_setup_attempt_payment_method_details_kakao_pay | undefined + klarna?: t_setup_attempt_payment_method_details_klarna | undefined + kr_card?: t_setup_attempt_payment_method_details_kr_card | undefined + link?: t_setup_attempt_payment_method_details_link | undefined + naver_pay?: t_setup_attempt_payment_method_details_naver_pay | undefined + nz_bank_account?: + | t_setup_attempt_payment_method_details_nz_bank_account + | undefined + paypal?: t_setup_attempt_payment_method_details_paypal | undefined + revolut_pay?: t_setup_attempt_payment_method_details_revolut_pay | undefined + sepa_debit?: t_setup_attempt_payment_method_details_sepa_debit | undefined + sofort?: t_setup_attempt_payment_method_details_sofort | undefined + type: string + us_bank_account?: + | t_setup_attempt_payment_method_details_us_bank_account + | undefined +} + +export type t_setup_attempt_payment_method_details_acss_debit = EmptyObject + +export type t_setup_attempt_payment_method_details_amazon_pay = EmptyObject + +export type t_setup_attempt_payment_method_details_au_becs_debit = EmptyObject + +export type t_setup_attempt_payment_method_details_bacs_debit = EmptyObject + +export type t_setup_attempt_payment_method_details_bancontact = { + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + bic?: (string | null) | undefined + generated_sepa_debit?: (string | t_payment_method | null) | undefined + generated_sepa_debit_mandate?: (string | t_mandate | null) | undefined + iban_last4?: (string | null) | undefined + preferred_language?: ("de" | "en" | "fr" | "nl" | null) | undefined + verified_name?: (string | null) | undefined +} + +export type t_setup_attempt_payment_method_details_boleto = EmptyObject + +export type t_setup_attempt_payment_method_details_card = { + brand?: (string | null) | undefined + checks?: + | (t_setup_attempt_payment_method_details_card_checks | null) + | undefined + country?: (string | null) | undefined + exp_month?: (number | null) | undefined + exp_year?: (number | null) | undefined + fingerprint?: (string | null) | undefined + funding?: (string | null) | undefined + last4?: (string | null) | undefined + network?: (string | null) | undefined + three_d_secure?: (t_three_d_secure_details | null) | undefined + wallet?: + | (t_setup_attempt_payment_method_details_card_wallet | null) + | undefined +} + +export type t_setup_attempt_payment_method_details_card_checks = { + address_line1_check?: (string | null) | undefined + address_postal_code_check?: (string | null) | undefined + cvc_check?: (string | null) | undefined +} + +export type t_setup_attempt_payment_method_details_card_present = { + generated_card?: (string | t_payment_method | null) | undefined + offline?: (t_payment_method_details_card_present_offline | null) | undefined +} + +export type t_setup_attempt_payment_method_details_card_wallet = { + apple_pay?: t_payment_method_details_card_wallet_apple_pay | undefined + google_pay?: t_payment_method_details_card_wallet_google_pay | undefined + type: "apple_pay" | "google_pay" | "link" +} + +export type t_setup_attempt_payment_method_details_cashapp = EmptyObject + +export type t_setup_attempt_payment_method_details_ideal = { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + | null + ) + | undefined + bic?: + | ( + | "ABNANL2A" + | "ASNBNL21" + | "BITSNL2A" + | "BUNQNL2A" + | "FVLBNL22" + | "HANDNL2A" + | "INGBNL2A" + | "KNABNL2H" + | "MOYONL21" + | "NNBANL2G" + | "NTSBDEB1" + | "RABONL2U" + | "RBRBNL21" + | "REVOIE23" + | "REVOLT21" + | "SNSBNL2A" + | "TRIONL2U" + | null + ) + | undefined + generated_sepa_debit?: (string | t_payment_method | null) | undefined + generated_sepa_debit_mandate?: (string | t_mandate | null) | undefined + iban_last4?: (string | null) | undefined + verified_name?: (string | null) | undefined +} + +export type t_setup_attempt_payment_method_details_kakao_pay = EmptyObject + +export type t_setup_attempt_payment_method_details_klarna = EmptyObject + +export type t_setup_attempt_payment_method_details_kr_card = EmptyObject + +export type t_setup_attempt_payment_method_details_link = EmptyObject + +export type t_setup_attempt_payment_method_details_naver_pay = { + buyer_id?: string | undefined +} + +export type t_setup_attempt_payment_method_details_nz_bank_account = EmptyObject + +export type t_setup_attempt_payment_method_details_paypal = EmptyObject + +export type t_setup_attempt_payment_method_details_revolut_pay = EmptyObject + +export type t_setup_attempt_payment_method_details_sepa_debit = EmptyObject + +export type t_setup_attempt_payment_method_details_sofort = { + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + bic?: (string | null) | undefined + generated_sepa_debit?: (string | t_payment_method | null) | undefined + generated_sepa_debit_mandate?: (string | t_mandate | null) | undefined + iban_last4?: (string | null) | undefined + preferred_language?: ("de" | "en" | "fr" | "nl" | null) | undefined + verified_name?: (string | null) | undefined +} + +export type t_setup_attempt_payment_method_details_us_bank_account = EmptyObject + +export type t_setup_intent = { + application?: (string | t_application | null) | undefined + attach_to_self?: boolean | undefined + automatic_payment_methods?: + | (t_payment_flows_automatic_payment_methods_setup_intent | null) + | undefined + cancellation_reason?: + | ("abandoned" | "duplicate" | "requested_by_customer" | null) + | undefined + client_secret?: (string | null) | undefined + created: number + customer?: (string | t_customer | t_deleted_customer | null) | undefined + description?: (string | null) | undefined + flow_directions?: (("inbound" | "outbound")[] | null) | undefined + id: string + last_setup_error?: (t_api_errors | null) | undefined + latest_attempt?: (string | t_setup_attempt | null) | undefined + livemode: boolean + mandate?: (string | t_mandate | null) | undefined + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + next_action?: (t_setup_intent_next_action | null) | undefined + object: "setup_intent" + on_behalf_of?: (string | t_account | null) | undefined + payment_method?: (string | t_payment_method | null) | undefined + payment_method_configuration_details?: + | (t_payment_method_config_biz_payment_method_configuration_details | null) + | undefined + payment_method_options?: + | (t_setup_intent_payment_method_options | null) + | undefined + payment_method_types: string[] + single_use_mandate?: (string | t_mandate | null) | undefined + status: + | "canceled" + | "processing" + | "requires_action" + | "requires_confirmation" + | "requires_payment_method" + | "succeeded" + usage: string +} + +export type t_setup_intent_next_action = { + cashapp_handle_redirect_or_display_qr_code?: + | t_payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code + | undefined + redirect_to_url?: t_setup_intent_next_action_redirect_to_url | undefined + type: string + use_stripe_sdk?: EmptyObject | undefined + verify_with_microdeposits?: + | t_setup_intent_next_action_verify_with_microdeposits + | undefined +} + +export type t_setup_intent_next_action_redirect_to_url = { + return_url?: (string | null) | undefined + url?: (string | null) | undefined +} + +export type t_setup_intent_next_action_verify_with_microdeposits = { + arrival_date: number + hosted_verification_url: string + microdeposit_type?: ("amounts" | "descriptor_code" | null) | undefined +} + +export type t_setup_intent_payment_method_options = { + acss_debit?: + | ( + | t_setup_intent_payment_method_options_acss_debit + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined + amazon_pay?: + | ( + | t_setup_intent_payment_method_options_amazon_pay + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined + bacs_debit?: + | ( + | t_setup_intent_payment_method_options_bacs_debit + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined + card?: + | ( + | t_setup_intent_payment_method_options_card + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined + card_present?: + | ( + | t_setup_intent_payment_method_options_card_present + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined + link?: + | ( + | t_setup_intent_payment_method_options_link + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined + paypal?: + | ( + | t_setup_intent_payment_method_options_paypal + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined + sepa_debit?: + | ( + | t_setup_intent_payment_method_options_sepa_debit + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined + us_bank_account?: + | ( + | t_setup_intent_payment_method_options_us_bank_account + | t_setup_intent_type_specific_payment_method_options_client + ) + | undefined +} + +export type t_setup_intent_payment_method_options_acss_debit = { + currency?: ("cad" | "usd" | null) | undefined + mandate_options?: + | t_setup_intent_payment_method_options_mandate_options_acss_debit + | undefined + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_setup_intent_payment_method_options_amazon_pay = EmptyObject + +export type t_setup_intent_payment_method_options_bacs_debit = { + mandate_options?: + | t_setup_intent_payment_method_options_mandate_options_bacs_debit + | undefined +} + +export type t_setup_intent_payment_method_options_card = { + mandate_options?: + | (t_setup_intent_payment_method_options_card_mandate_options | null) + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + | null + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge" | null) + | undefined +} + +export type t_setup_intent_payment_method_options_card_mandate_options = { + amount: number + amount_type: "fixed" | "maximum" + currency: string + description?: (string | null) | undefined + end_date?: (number | null) | undefined + interval: "day" | "month" | "sporadic" | "week" | "year" + interval_count?: (number | null) | undefined + reference: string + start_date: number + supported_types?: ("india"[] | null) | undefined +} + +export type t_setup_intent_payment_method_options_card_present = EmptyObject + +export type t_setup_intent_payment_method_options_link = EmptyObject + +export type t_setup_intent_payment_method_options_mandate_options_acss_debit = { + custom_mandate_url?: string | undefined + default_for?: ("invoice" | "subscription")[] | undefined + interval_description?: (string | null) | undefined + payment_schedule?: ("combined" | "interval" | "sporadic" | null) | undefined + transaction_type?: ("business" | "personal" | null) | undefined +} + +export type t_setup_intent_payment_method_options_mandate_options_bacs_debit = { + reference_prefix?: string | undefined +} + +export type t_setup_intent_payment_method_options_mandate_options_sepa_debit = { + reference_prefix?: string | undefined +} + +export type t_setup_intent_payment_method_options_paypal = { + billing_agreement_id?: (string | null) | undefined +} + +export type t_setup_intent_payment_method_options_sepa_debit = { + mandate_options?: + | t_setup_intent_payment_method_options_mandate_options_sepa_debit + | undefined +} + +export type t_setup_intent_payment_method_options_us_bank_account = { + financial_connections?: t_linked_account_options_us_bank_account | undefined + mandate_options?: + | t_payment_method_options_us_bank_account_mandate_options + | undefined + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_setup_intent_type_specific_payment_method_options_client = { + verification_method?: ("automatic" | "instant" | "microdeposits") | undefined +} + +export type t_shipping = { + address?: t_address | undefined + carrier?: (string | null) | undefined + name?: string | undefined + phone?: (string | null) | undefined + tracking_number?: (string | null) | undefined +} + +export type t_shipping_rate = { + active: boolean + created: number + delivery_estimate?: (t_shipping_rate_delivery_estimate | null) | undefined + display_name?: (string | null) | undefined + fixed_amount?: t_shipping_rate_fixed_amount | undefined + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "shipping_rate" + tax_behavior?: ("exclusive" | "inclusive" | "unspecified" | null) | undefined + tax_code?: (string | t_tax_code | null) | undefined + type: "fixed_amount" +} + +export type t_shipping_rate_currency_option = { + amount: number + tax_behavior: "exclusive" | "inclusive" | "unspecified" +} + +export type t_shipping_rate_delivery_estimate = { + maximum?: (t_shipping_rate_delivery_estimate_bound | null) | undefined + minimum?: (t_shipping_rate_delivery_estimate_bound | null) | undefined +} + +export type t_shipping_rate_delivery_estimate_bound = { + unit: "business_day" | "day" | "hour" | "month" | "week" + value: number +} + +export type t_shipping_rate_fixed_amount = { + amount: number + currency: string + currency_options?: + | { + [key: string]: t_shipping_rate_currency_option | undefined + } + | undefined +} + +export type t_sigma_sigma_api_query = { + created: number + id: string + livemode: boolean + name: string + object: "sigma.sigma_api_query" + sql: string +} + +export type t_sigma_scheduled_query_run_error = { + message: string +} + +export type t_source = { + ach_credit_transfer?: t_source_type_ach_credit_transfer | undefined + ach_debit?: t_source_type_ach_debit | undefined + acss_debit?: t_source_type_acss_debit | undefined + alipay?: t_source_type_alipay | undefined + allow_redisplay?: ("always" | "limited" | "unspecified" | null) | undefined + amount?: (number | null) | undefined + au_becs_debit?: t_source_type_au_becs_debit | undefined + bancontact?: t_source_type_bancontact | undefined + card?: t_source_type_card | undefined + card_present?: t_source_type_card_present | undefined + client_secret: string + code_verification?: t_source_code_verification_flow | undefined + created: number + currency?: (string | null) | undefined + customer?: string | undefined + eps?: t_source_type_eps | undefined + flow: string + giropay?: t_source_type_giropay | undefined + id: string + ideal?: t_source_type_ideal | undefined + klarna?: t_source_type_klarna | undefined + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + multibanco?: t_source_type_multibanco | undefined + object: "source" + owner?: (t_source_owner | null) | undefined + p24?: t_source_type_p24 | undefined + receiver?: t_source_receiver_flow | undefined + redirect?: t_source_redirect_flow | undefined + sepa_debit?: t_source_type_sepa_debit | undefined + sofort?: t_source_type_sofort | undefined + source_order?: t_source_order | undefined + statement_descriptor?: (string | null) | undefined + status: string + three_d_secure?: t_source_type_three_d_secure | undefined + type: + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "alipay" + | "au_becs_debit" + | "bancontact" + | "card" + | "card_present" + | "eps" + | "giropay" + | "ideal" + | "klarna" + | "multibanco" + | "p24" + | "sepa_debit" + | "sofort" + | "three_d_secure" + | "wechat" + usage?: (string | null) | undefined + wechat?: t_source_type_wechat | undefined +} + +export type t_source_code_verification_flow = { + attempts_remaining: number + status: string +} + +export type t_source_mandate_notification = { + acss_debit?: t_source_mandate_notification_acss_debit_data | undefined + amount?: (number | null) | undefined + bacs_debit?: t_source_mandate_notification_bacs_debit_data | undefined + created: number + id: string + livemode: boolean + object: "source_mandate_notification" + reason: string + sepa_debit?: t_source_mandate_notification_sepa_debit_data | undefined + source: t_source + status: string + type: string +} + +export type t_source_mandate_notification_acss_debit_data = { + statement_descriptor?: string | undefined +} + +export type t_source_mandate_notification_bacs_debit_data = { + last4?: string | undefined +} + +export type t_source_mandate_notification_sepa_debit_data = { + creditor_identifier?: string | undefined + last4?: string | undefined + mandate_reference?: string | undefined +} + +export type t_source_order = { + amount: number + currency: string + email?: string | undefined + items?: (t_source_order_item[] | null) | undefined + shipping?: t_shipping | undefined +} + +export type t_source_order_item = { + amount?: (number | null) | undefined + currency?: (string | null) | undefined + description?: (string | null) | undefined + parent?: (string | null) | undefined + quantity?: number | undefined + type?: (string | null) | undefined +} + +export type t_source_owner = { + address?: (t_address | null) | undefined + email?: (string | null) | undefined + name?: (string | null) | undefined + phone?: (string | null) | undefined + verified_address?: (t_address | null) | undefined + verified_email?: (string | null) | undefined + verified_name?: (string | null) | undefined + verified_phone?: (string | null) | undefined +} + +export type t_source_receiver_flow = { + address?: (string | null) | undefined + amount_charged: number + amount_received: number + amount_returned: number + refund_attributes_method: string + refund_attributes_status: string +} + +export type t_source_redirect_flow = { + failure_reason?: (string | null) | undefined + return_url: string + status: string + url: string +} + +export type t_source_transaction = { + ach_credit_transfer?: + | t_source_transaction_ach_credit_transfer_data + | undefined + amount: number + chf_credit_transfer?: + | t_source_transaction_chf_credit_transfer_data + | undefined + created: number + currency: string + gbp_credit_transfer?: + | t_source_transaction_gbp_credit_transfer_data + | undefined + id: string + livemode: boolean + object: "source_transaction" + paper_check?: t_source_transaction_paper_check_data | undefined + sepa_credit_transfer?: + | t_source_transaction_sepa_credit_transfer_data + | undefined + source: string + status: string + type: + | "ach_credit_transfer" + | "ach_debit" + | "alipay" + | "bancontact" + | "card" + | "card_present" + | "eps" + | "giropay" + | "ideal" + | "klarna" + | "multibanco" + | "p24" + | "sepa_debit" + | "sofort" + | "three_d_secure" + | "wechat" +} + +export type t_source_transaction_ach_credit_transfer_data = { + customer_data?: string | undefined + fingerprint?: string | undefined + last4?: string | undefined + routing_number?: string | undefined +} + +export type t_source_transaction_chf_credit_transfer_data = { + reference?: string | undefined + sender_address_country?: string | undefined + sender_address_line1?: string | undefined + sender_iban?: string | undefined + sender_name?: string | undefined +} + +export type t_source_transaction_gbp_credit_transfer_data = { + fingerprint?: string | undefined + funding_method?: string | undefined + last4?: string | undefined + reference?: string | undefined + sender_account_number?: string | undefined + sender_name?: string | undefined + sender_sort_code?: string | undefined +} + +export type t_source_transaction_paper_check_data = { + available_at?: string | undefined + invoices?: string | undefined +} + +export type t_source_transaction_sepa_credit_transfer_data = { + reference?: string | undefined + sender_iban?: string | undefined + sender_name?: string | undefined +} + +export type t_source_type_ach_credit_transfer = { + account_number?: (string | null) | undefined + bank_name?: (string | null) | undefined + fingerprint?: (string | null) | undefined + refund_account_holder_name?: (string | null) | undefined + refund_account_holder_type?: (string | null) | undefined + refund_routing_number?: (string | null) | undefined + routing_number?: (string | null) | undefined + swift_code?: (string | null) | undefined +} + +export type t_source_type_ach_debit = { + bank_name?: (string | null) | undefined + country?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + routing_number?: (string | null) | undefined + type?: (string | null) | undefined +} + +export type t_source_type_acss_debit = { + bank_address_city?: (string | null) | undefined + bank_address_line_1?: (string | null) | undefined + bank_address_line_2?: (string | null) | undefined + bank_address_postal_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + category?: (string | null) | undefined + country?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + routing_number?: (string | null) | undefined +} + +export type t_source_type_alipay = { + data_string?: (string | null) | undefined + native_url?: (string | null) | undefined + statement_descriptor?: (string | null) | undefined +} + +export type t_source_type_au_becs_debit = { + bsb_number?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined +} + +export type t_source_type_bancontact = { + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + bic?: (string | null) | undefined + iban_last4?: (string | null) | undefined + preferred_language?: (string | null) | undefined + statement_descriptor?: (string | null) | undefined +} + +export type t_source_type_card = { + address_line1_check?: (string | null) | undefined + address_zip_check?: (string | null) | undefined + brand?: (string | null) | undefined + country?: (string | null) | undefined + cvc_check?: (string | null) | undefined + dynamic_last4?: (string | null) | undefined + exp_month?: (number | null) | undefined + exp_year?: (number | null) | undefined + fingerprint?: string | undefined + funding?: (string | null) | undefined + last4?: (string | null) | undefined + name?: (string | null) | undefined + three_d_secure?: string | undefined + tokenization_method?: (string | null) | undefined +} + +export type t_source_type_card_present = { + application_cryptogram?: string | undefined + application_preferred_name?: string | undefined + authorization_code?: (string | null) | undefined + authorization_response_code?: string | undefined + brand?: (string | null) | undefined + country?: (string | null) | undefined + cvm_type?: string | undefined + data_type?: (string | null) | undefined + dedicated_file_name?: string | undefined + emv_auth_data?: string | undefined + evidence_customer_signature?: (string | null) | undefined + evidence_transaction_certificate?: (string | null) | undefined + exp_month?: (number | null) | undefined + exp_year?: (number | null) | undefined + fingerprint?: string | undefined + funding?: (string | null) | undefined + last4?: (string | null) | undefined + pos_device_id?: (string | null) | undefined + pos_entry_mode?: string | undefined + read_method?: (string | null) | undefined + reader?: (string | null) | undefined + terminal_verification_results?: string | undefined + transaction_status_information?: string | undefined +} + +export type t_source_type_eps = { + reference?: (string | null) | undefined + statement_descriptor?: (string | null) | undefined +} + +export type t_source_type_giropay = { + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + bic?: (string | null) | undefined + statement_descriptor?: (string | null) | undefined +} + +export type t_source_type_ideal = { + bank?: (string | null) | undefined + bic?: (string | null) | undefined + iban_last4?: (string | null) | undefined + statement_descriptor?: (string | null) | undefined +} + +export type t_source_type_klarna = { + background_image_url?: string | undefined + client_token?: (string | null) | undefined + first_name?: string | undefined + last_name?: string | undefined + locale?: string | undefined + logo_url?: string | undefined + page_title?: string | undefined + pay_later_asset_urls_descriptive?: string | undefined + pay_later_asset_urls_standard?: string | undefined + pay_later_name?: string | undefined + pay_later_redirect_url?: string | undefined + pay_now_asset_urls_descriptive?: string | undefined + pay_now_asset_urls_standard?: string | undefined + pay_now_name?: string | undefined + pay_now_redirect_url?: string | undefined + pay_over_time_asset_urls_descriptive?: string | undefined + pay_over_time_asset_urls_standard?: string | undefined + pay_over_time_name?: string | undefined + pay_over_time_redirect_url?: string | undefined + payment_method_categories?: string | undefined + purchase_country?: string | undefined + purchase_type?: string | undefined + redirect_url?: string | undefined + shipping_delay?: number | undefined + shipping_first_name?: string | undefined + shipping_last_name?: string | undefined +} + +export type t_source_type_multibanco = { + entity?: (string | null) | undefined + reference?: (string | null) | undefined + refund_account_holder_address_city?: (string | null) | undefined + refund_account_holder_address_country?: (string | null) | undefined + refund_account_holder_address_line1?: (string | null) | undefined + refund_account_holder_address_line2?: (string | null) | undefined + refund_account_holder_address_postal_code?: (string | null) | undefined + refund_account_holder_address_state?: (string | null) | undefined + refund_account_holder_name?: (string | null) | undefined + refund_iban?: (string | null) | undefined +} + +export type t_source_type_p24 = { + reference?: (string | null) | undefined +} + +export type t_source_type_sepa_debit = { + bank_code?: (string | null) | undefined + branch_code?: (string | null) | undefined + country?: (string | null) | undefined + fingerprint?: (string | null) | undefined + last4?: (string | null) | undefined + mandate_reference?: (string | null) | undefined + mandate_url?: (string | null) | undefined +} + +export type t_source_type_sofort = { + bank_code?: (string | null) | undefined + bank_name?: (string | null) | undefined + bic?: (string | null) | undefined + country?: (string | null) | undefined + iban_last4?: (string | null) | undefined + preferred_language?: (string | null) | undefined + statement_descriptor?: (string | null) | undefined +} + +export type t_source_type_three_d_secure = { + address_line1_check?: (string | null) | undefined + address_zip_check?: (string | null) | undefined + authenticated?: (boolean | null) | undefined + brand?: (string | null) | undefined + card?: (string | null) | undefined + country?: (string | null) | undefined + customer?: (string | null) | undefined + cvc_check?: (string | null) | undefined + dynamic_last4?: (string | null) | undefined + exp_month?: (number | null) | undefined + exp_year?: (number | null) | undefined + fingerprint?: string | undefined + funding?: (string | null) | undefined + last4?: (string | null) | undefined + name?: (string | null) | undefined + three_d_secure?: string | undefined + tokenization_method?: (string | null) | undefined +} + +export type t_source_type_wechat = { + prepay_id?: string | undefined + qr_code_url?: (string | null) | undefined + statement_descriptor?: string | undefined +} + +export type t_subscription = { + application?: + | (string | t_application | t_deleted_application | null) + | undefined + application_fee_percent?: (number | null) | undefined + automatic_tax: t_subscription_automatic_tax + billing_cycle_anchor: number + billing_cycle_anchor_config?: + | (t_subscriptions_resource_billing_cycle_anchor_config | null) + | undefined + cancel_at?: (number | null) | undefined + cancel_at_period_end?: (boolean | null) | undefined + canceled_at?: (number | null) | undefined + cancellation_details?: (t_cancellation_details | null) | undefined + collection_method: "charge_automatically" | "send_invoice" + created: number + currency: string + customer: string | t_customer | t_deleted_customer + days_until_due?: (number | null) | undefined + default_payment_method?: (string | t_payment_method | null) | undefined + default_source?: + | (string | t_bank_account | t_card | t_source | null) + | undefined + default_tax_rates?: (t_tax_rate[] | null) | undefined + description?: (string | null) | undefined + discounts: (string | t_discount)[] + ended_at?: (number | null) | undefined + id: string + invoice_settings: t_subscriptions_resource_subscription_invoice_settings + items: { + data: t_subscription_item[] + has_more: boolean + object: "list" + url: string + } + latest_invoice?: (string | t_invoice | null) | undefined + livemode: boolean + metadata: { + [key: string]: string | undefined + } + next_pending_invoice_item_invoice?: (number | null) | undefined + object: "subscription" + on_behalf_of?: (string | t_account | null) | undefined + pause_collection?: + | (t_subscriptions_resource_pause_collection | null) + | undefined + payment_settings?: + | (t_subscriptions_resource_payment_settings | null) + | undefined + pending_invoice_item_interval?: + | (t_subscription_pending_invoice_item_interval | null) + | undefined + pending_setup_intent?: (string | t_setup_intent | null) | undefined + pending_update?: (t_subscriptions_resource_pending_update | null) | undefined + schedule?: (string | t_subscription_schedule | null) | undefined + start_date: number + status: + | "active" + | "canceled" + | "incomplete" + | "incomplete_expired" + | "past_due" + | "paused" + | "trialing" + | "unpaid" + test_clock?: (string | t_test_helpers_test_clock | null) | undefined + transfer_data?: (t_subscription_transfer_data | null) | undefined + trial_end?: (number | null) | undefined + trial_settings?: + | (t_subscriptions_trials_resource_trial_settings | null) + | undefined + trial_start?: (number | null) | undefined +} + +export type t_subscription_automatic_tax = { + disabled_reason?: ("requires_location_inputs" | null) | undefined + enabled: boolean + liability?: (t_connect_account_reference | null) | undefined +} + +export type t_subscription_item = { + created: number + current_period_end: number + current_period_start: number + discounts: (string | t_discount)[] + id: string + metadata: { + [key: string]: string | undefined + } + object: "subscription_item" + price: t_price + quantity?: number | undefined + subscription: string + tax_rates?: (t_tax_rate[] | null) | undefined +} + +export type t_subscription_payment_method_options_card = { + mandate_options?: t_invoice_mandate_options_card | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + | null + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge" | null) + | undefined +} + +export type t_subscription_pending_invoice_item_interval = { + interval: "day" | "month" | "week" | "year" + interval_count: number +} + +export type t_subscription_schedule = { + application?: + | (string | t_application | t_deleted_application | null) + | undefined + canceled_at?: (number | null) | undefined + completed_at?: (number | null) | undefined + created: number + current_phase?: (t_subscription_schedule_current_phase | null) | undefined + customer: string | t_customer | t_deleted_customer + default_settings: t_subscription_schedules_resource_default_settings + end_behavior: "cancel" | "none" | "release" | "renew" + id: string + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "subscription_schedule" + phases: t_subscription_schedule_phase_configuration[] + released_at?: (number | null) | undefined + released_subscription?: (string | null) | undefined + status: "active" | "canceled" | "completed" | "not_started" | "released" + subscription?: (string | t_subscription | null) | undefined + test_clock?: (string | t_test_helpers_test_clock | null) | undefined +} + +export type t_subscription_schedule_add_invoice_item = { + discounts: t_discounts_resource_stackable_discount[] + price: string | t_price | t_deleted_price + quantity?: (number | null) | undefined + tax_rates?: (t_tax_rate[] | null) | undefined +} + +export type t_subscription_schedule_configuration_item = { + discounts: t_discounts_resource_stackable_discount[] + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + price: string | t_price | t_deleted_price + quantity?: number | undefined + tax_rates?: (t_tax_rate[] | null) | undefined +} + +export type t_subscription_schedule_current_phase = { + end_date: number + start_date: number +} + +export type t_subscription_schedule_phase_configuration = { + add_invoice_items: t_subscription_schedule_add_invoice_item[] + application_fee_percent?: (number | null) | undefined + automatic_tax?: t_schedules_phase_automatic_tax | undefined + billing_cycle_anchor?: ("automatic" | "phase_start" | null) | undefined + collection_method?: + | ("charge_automatically" | "send_invoice" | null) + | undefined + currency: string + default_payment_method?: (string | t_payment_method | null) | undefined + default_tax_rates?: (t_tax_rate[] | null) | undefined + description?: (string | null) | undefined + discounts: t_discounts_resource_stackable_discount[] + end_date: number + invoice_settings?: + | (t_invoice_setting_subscription_schedule_phase_setting | null) + | undefined + items: t_subscription_schedule_configuration_item[] + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + on_behalf_of?: (string | t_account | null) | undefined + proration_behavior: "always_invoice" | "create_prorations" | "none" + start_date: number + transfer_data?: (t_subscription_transfer_data | null) | undefined + trial_end?: (number | null) | undefined +} + +export type t_subscription_schedules_resource_default_settings = { + application_fee_percent?: (number | null) | undefined + automatic_tax?: + | t_subscription_schedules_resource_default_settings_automatic_tax + | undefined + billing_cycle_anchor: "automatic" | "phase_start" + collection_method?: + | ("charge_automatically" | "send_invoice" | null) + | undefined + default_payment_method?: (string | t_payment_method | null) | undefined + description?: (string | null) | undefined + invoice_settings: t_invoice_setting_subscription_schedule_setting + on_behalf_of?: (string | t_account | null) | undefined + transfer_data?: (t_subscription_transfer_data | null) | undefined +} + +export type t_subscription_schedules_resource_default_settings_automatic_tax = { + disabled_reason?: ("requires_location_inputs" | null) | undefined + enabled: boolean + liability?: (t_connect_account_reference | null) | undefined +} + +export type t_subscription_transfer_data = { + amount_percent?: (number | null) | undefined + destination: string | t_account +} + +export type t_subscriptions_resource_billing_cycle_anchor_config = { + day_of_month: number + hour?: (number | null) | undefined + minute?: (number | null) | undefined + month?: (number | null) | undefined + second?: (number | null) | undefined +} + +export type t_subscriptions_resource_pause_collection = { + behavior: "keep_as_draft" | "mark_uncollectible" | "void" + resumes_at?: (number | null) | undefined +} + +export type t_subscriptions_resource_payment_method_options = { + acss_debit?: (t_invoice_payment_method_options_acss_debit | null) | undefined + bancontact?: (t_invoice_payment_method_options_bancontact | null) | undefined + card?: (t_subscription_payment_method_options_card | null) | undefined + customer_balance?: + | (t_invoice_payment_method_options_customer_balance | null) + | undefined + konbini?: (t_invoice_payment_method_options_konbini | null) | undefined + sepa_debit?: (t_invoice_payment_method_options_sepa_debit | null) | undefined + us_bank_account?: + | (t_invoice_payment_method_options_us_bank_account | null) + | undefined +} + +export type t_subscriptions_resource_payment_settings = { + payment_method_options?: + | (t_subscriptions_resource_payment_method_options | null) + | undefined + payment_method_types?: + | ( + | ( + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "jp_credit_transfer" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "p24" + | "payco" + | "paynow" + | "paypal" + | "promptpay" + | "revolut_pay" + | "sepa_credit_transfer" + | "sepa_debit" + | "sofort" + | "swish" + | "us_bank_account" + | "wechat_pay" + )[] + | null + ) + | undefined + save_default_payment_method?: ("off" | "on_subscription" | null) | undefined +} + +export type t_subscriptions_resource_pending_update = { + billing_cycle_anchor?: (number | null) | undefined + expires_at: number + subscription_items?: (t_subscription_item[] | null) | undefined + trial_end?: (number | null) | undefined + trial_from_plan?: (boolean | null) | undefined +} + +export type t_subscriptions_resource_subscription_invoice_settings = { + account_tax_ids?: + | ((string | t_tax_id | t_deleted_tax_id)[] | null) + | undefined + issuer: t_connect_account_reference +} + +export type t_subscriptions_trials_resource_end_behavior = { + missing_payment_method: "cancel" | "create_invoice" | "pause" +} + +export type t_subscriptions_trials_resource_trial_settings = { + end_behavior: t_subscriptions_trials_resource_end_behavior +} + +export type t_tax_calculation = { + amount_total: number + currency: string + customer?: (string | null) | undefined + customer_details: t_tax_product_resource_customer_details + expires_at?: (number | null) | undefined + id?: (string | null) | undefined + line_items?: + | ({ + data: t_tax_calculation_line_item[] + has_more: boolean + object: "list" + url: string + } | null) + | undefined + livemode: boolean + object: "tax.calculation" + ship_from_details?: + | (t_tax_product_resource_ship_from_details | null) + | undefined + shipping_cost?: + | (t_tax_product_resource_tax_calculation_shipping_cost | null) + | undefined + tax_amount_exclusive: number + tax_amount_inclusive: number + tax_breakdown: t_tax_product_resource_tax_breakdown[] + tax_date: number +} + +export type t_tax_calculation_line_item = { + amount: number + amount_tax: number + id: string + livemode: boolean + object: "tax.calculation_line_item" + product?: (string | null) | undefined + quantity: number + reference?: (string | null) | undefined + tax_behavior: "exclusive" | "inclusive" + tax_breakdown?: + | (t_tax_product_resource_line_item_tax_breakdown[] | null) + | undefined + tax_code: string +} + +export type t_tax_registration = { + active_from: number + country: string + country_options: t_tax_product_registrations_resource_country_options + created: number + expires_at?: (number | null) | undefined + id: string + livemode: boolean + object: "tax.registration" + status: "active" | "expired" | "scheduled" +} + +export type t_tax_settings = { + defaults: t_tax_product_resource_tax_settings_defaults + head_office?: + | (t_tax_product_resource_tax_settings_head_office | null) + | undefined + livemode: boolean + object: "tax.settings" + status: "active" | "pending" + status_details: t_tax_product_resource_tax_settings_status_details +} + +export type t_tax_transaction = { + created: number + currency: string + customer?: (string | null) | undefined + customer_details: t_tax_product_resource_customer_details + id: string + line_items?: + | ({ + data: t_tax_transaction_line_item[] + has_more: boolean + object: "list" + url: string + } | null) + | undefined + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "tax.transaction" + posted_at: number + reference: string + reversal?: + | (t_tax_product_resource_tax_transaction_resource_reversal | null) + | undefined + ship_from_details?: + | (t_tax_product_resource_ship_from_details | null) + | undefined + shipping_cost?: + | (t_tax_product_resource_tax_transaction_shipping_cost | null) + | undefined + tax_date: number + type: "reversal" | "transaction" +} + +export type t_tax_transaction_line_item = { + amount: number + amount_tax: number + id: string + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "tax.transaction_line_item" + product?: (string | null) | undefined + quantity: number + reference: string + reversal?: + | (t_tax_product_resource_tax_transaction_line_item_resource_reversal | null) + | undefined + tax_behavior: "exclusive" | "inclusive" + tax_code: string + type: "reversal" | "transaction" +} + +export type t_tax_code = { + description: string + id: string + name: string + object: "tax_code" +} + +export type t_tax_deducted_at_source = { + id: string + object: "tax_deducted_at_source" + period_end: number + period_start: number + tax_deduction_account_number: string +} + +export type t_tax_i_ds_owner = { + account?: (string | t_account) | undefined + application?: (string | t_application) | undefined + customer?: (string | t_customer) | undefined + type: "account" | "application" | "customer" | "self" +} + +export type t_tax_id = { + country?: (string | null) | undefined + created: number + customer?: (string | t_customer | null) | undefined + id: string + livemode: boolean + object: "tax_id" + owner?: (t_tax_i_ds_owner | null) | undefined + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "unknown" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value: string + verification?: (t_tax_id_verification | null) | undefined +} + +export type t_tax_id_verification = { + status: "pending" | "unavailable" | "unverified" | "verified" + verified_address?: (string | null) | undefined + verified_name?: (string | null) | undefined +} + +export type t_tax_product_registrations_resource_country_options = { + ae?: + | t_tax_product_registrations_resource_country_options_default_inbound_goods + | undefined + al?: t_tax_product_registrations_resource_country_options_default | undefined + am?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + ao?: t_tax_product_registrations_resource_country_options_default | undefined + at?: t_tax_product_registrations_resource_country_options_europe | undefined + au?: + | t_tax_product_registrations_resource_country_options_default_inbound_goods + | undefined + ba?: t_tax_product_registrations_resource_country_options_default | undefined + bb?: t_tax_product_registrations_resource_country_options_default | undefined + be?: t_tax_product_registrations_resource_country_options_europe | undefined + bg?: t_tax_product_registrations_resource_country_options_europe | undefined + bh?: t_tax_product_registrations_resource_country_options_default | undefined + bs?: t_tax_product_registrations_resource_country_options_default | undefined + by?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + ca?: t_tax_product_registrations_resource_country_options_canada | undefined + cd?: t_tax_product_registrations_resource_country_options_default | undefined + ch?: + | t_tax_product_registrations_resource_country_options_default_inbound_goods + | undefined + cl?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + co?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + cr?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + cy?: t_tax_product_registrations_resource_country_options_europe | undefined + cz?: t_tax_product_registrations_resource_country_options_europe | undefined + de?: t_tax_product_registrations_resource_country_options_europe | undefined + dk?: t_tax_product_registrations_resource_country_options_europe | undefined + ec?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + ee?: t_tax_product_registrations_resource_country_options_europe | undefined + eg?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + es?: t_tax_product_registrations_resource_country_options_europe | undefined + fi?: t_tax_product_registrations_resource_country_options_europe | undefined + fr?: t_tax_product_registrations_resource_country_options_europe | undefined + gb?: + | t_tax_product_registrations_resource_country_options_default_inbound_goods + | undefined + ge?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + gn?: t_tax_product_registrations_resource_country_options_default | undefined + gr?: t_tax_product_registrations_resource_country_options_europe | undefined + hr?: t_tax_product_registrations_resource_country_options_europe | undefined + hu?: t_tax_product_registrations_resource_country_options_europe | undefined + id?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + ie?: t_tax_product_registrations_resource_country_options_europe | undefined + is?: t_tax_product_registrations_resource_country_options_default | undefined + it?: t_tax_product_registrations_resource_country_options_europe | undefined + jp?: + | t_tax_product_registrations_resource_country_options_default_inbound_goods + | undefined + ke?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + kh?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + kr?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + kz?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + lt?: t_tax_product_registrations_resource_country_options_europe | undefined + lu?: t_tax_product_registrations_resource_country_options_europe | undefined + lv?: t_tax_product_registrations_resource_country_options_europe | undefined + ma?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + md?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + me?: t_tax_product_registrations_resource_country_options_default | undefined + mk?: t_tax_product_registrations_resource_country_options_default | undefined + mr?: t_tax_product_registrations_resource_country_options_default | undefined + mt?: t_tax_product_registrations_resource_country_options_europe | undefined + mx?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + my?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + ng?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + nl?: t_tax_product_registrations_resource_country_options_europe | undefined + no?: + | t_tax_product_registrations_resource_country_options_default_inbound_goods + | undefined + np?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + nz?: + | t_tax_product_registrations_resource_country_options_default_inbound_goods + | undefined + om?: t_tax_product_registrations_resource_country_options_default | undefined + pe?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + pl?: t_tax_product_registrations_resource_country_options_europe | undefined + pt?: t_tax_product_registrations_resource_country_options_europe | undefined + ro?: t_tax_product_registrations_resource_country_options_europe | undefined + rs?: t_tax_product_registrations_resource_country_options_default | undefined + ru?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + sa?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + se?: t_tax_product_registrations_resource_country_options_europe | undefined + sg?: + | t_tax_product_registrations_resource_country_options_default_inbound_goods + | undefined + si?: t_tax_product_registrations_resource_country_options_europe | undefined + sk?: t_tax_product_registrations_resource_country_options_europe | undefined + sn?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + sr?: t_tax_product_registrations_resource_country_options_default | undefined + th?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + tj?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + tr?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + tz?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + ug?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + us?: + | t_tax_product_registrations_resource_country_options_united_states + | undefined + uy?: t_tax_product_registrations_resource_country_options_default | undefined + uz?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + vn?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + za?: t_tax_product_registrations_resource_country_options_default | undefined + zm?: + | t_tax_product_registrations_resource_country_options_simplified + | undefined + zw?: t_tax_product_registrations_resource_country_options_default | undefined +} + +export type t_tax_product_registrations_resource_country_options_ca_province_standard = + { + province: string + } + +export type t_tax_product_registrations_resource_country_options_canada = { + province_standard?: + | t_tax_product_registrations_resource_country_options_ca_province_standard + | undefined + type: "province_standard" | "simplified" | "standard" +} + +export type t_tax_product_registrations_resource_country_options_default = { + type: "standard" +} + +export type t_tax_product_registrations_resource_country_options_default_inbound_goods = + { + type: "standard" + } + +export type t_tax_product_registrations_resource_country_options_eu_standard = { + place_of_supply_scheme: "small_seller" | "standard" +} + +export type t_tax_product_registrations_resource_country_options_europe = { + standard?: + | t_tax_product_registrations_resource_country_options_eu_standard + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" +} + +export type t_tax_product_registrations_resource_country_options_simplified = { + type: "simplified" +} + +export type t_tax_product_registrations_resource_country_options_united_states = + { + local_amusement_tax?: + | t_tax_product_registrations_resource_country_options_us_local_amusement_tax + | undefined + local_lease_tax?: + | t_tax_product_registrations_resource_country_options_us_local_lease_tax + | undefined + state: string + state_sales_tax?: + | t_tax_product_registrations_resource_country_options_us_state_sales_tax + | undefined + type: + | "local_amusement_tax" + | "local_lease_tax" + | "state_communications_tax" + | "state_retail_delivery_fee" + | "state_sales_tax" + } + +export type t_tax_product_registrations_resource_country_options_us_local_amusement_tax = + { + jurisdiction: string + } + +export type t_tax_product_registrations_resource_country_options_us_local_lease_tax = + { + jurisdiction: string + } + +export type t_tax_product_registrations_resource_country_options_us_state_sales_tax = + { + elections?: + | t_tax_product_registrations_resource_country_options_us_state_sales_tax_election[] + | undefined + } + +export type t_tax_product_registrations_resource_country_options_us_state_sales_tax_election = + { + jurisdiction?: string | undefined + type: + | "local_use_tax" + | "simplified_sellers_use_tax" + | "single_local_use_tax" + } + +export type t_tax_product_resource_customer_details = { + address?: (t_tax_product_resource_postal_address | null) | undefined + address_source?: ("billing" | "shipping" | null) | undefined + ip_address?: (string | null) | undefined + tax_ids: t_tax_product_resource_customer_details_resource_tax_id[] + taxability_override: "customer_exempt" | "none" | "reverse_charge" +} + +export type t_tax_product_resource_customer_details_resource_tax_id = { + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "unknown" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value: string +} + +export type t_tax_product_resource_jurisdiction = { + country: string + display_name: string + level: "city" | "country" | "county" | "district" | "state" + state?: (string | null) | undefined +} + +export type t_tax_product_resource_line_item_tax_breakdown = { + amount: number + jurisdiction: t_tax_product_resource_jurisdiction + sourcing: "destination" | "origin" + tax_rate_details?: + | (t_tax_product_resource_line_item_tax_rate_details | null) + | undefined + taxability_reason: + | "customer_exempt" + | "not_collecting" + | "not_subject_to_tax" + | "not_supported" + | "portion_product_exempt" + | "portion_reduced_rated" + | "portion_standard_rated" + | "product_exempt" + | "product_exempt_holiday" + | "proportionally_rated" + | "reduced_rated" + | "reverse_charge" + | "standard_rated" + | "taxable_basis_reduced" + | "zero_rated" + taxable_amount: number +} + +export type t_tax_product_resource_line_item_tax_rate_details = { + display_name: string + percentage_decimal: string + tax_type: + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "retail_delivery_fee" + | "rst" + | "sales_tax" + | "service_tax" + | "vat" +} + +export type t_tax_product_resource_postal_address = { + city?: (string | null) | undefined + country: string + line1?: (string | null) | undefined + line2?: (string | null) | undefined + postal_code?: (string | null) | undefined + state?: (string | null) | undefined +} + +export type t_tax_product_resource_ship_from_details = { + address: t_tax_product_resource_postal_address +} + +export type t_tax_product_resource_tax_breakdown = { + amount: number + inclusive: boolean + tax_rate_details: t_tax_product_resource_tax_rate_details + taxability_reason: + | "customer_exempt" + | "not_collecting" + | "not_subject_to_tax" + | "not_supported" + | "portion_product_exempt" + | "portion_reduced_rated" + | "portion_standard_rated" + | "product_exempt" + | "product_exempt_holiday" + | "proportionally_rated" + | "reduced_rated" + | "reverse_charge" + | "standard_rated" + | "taxable_basis_reduced" + | "zero_rated" + taxable_amount: number +} + +export type t_tax_product_resource_tax_calculation_shipping_cost = { + amount: number + amount_tax: number + shipping_rate?: string | undefined + tax_behavior: "exclusive" | "inclusive" + tax_breakdown?: t_tax_product_resource_line_item_tax_breakdown[] | undefined + tax_code: string +} + +export type t_tax_product_resource_tax_rate_details = { + country?: (string | null) | undefined + flat_amount?: (t_tax_rate_flat_amount | null) | undefined + percentage_decimal: string + rate_type?: ("flat_amount" | "percentage" | null) | undefined + state?: (string | null) | undefined + tax_type?: + | ( + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "retail_delivery_fee" + | "rst" + | "sales_tax" + | "service_tax" + | "vat" + | null + ) + | undefined +} + +export type t_tax_product_resource_tax_settings_defaults = { + tax_behavior?: + | ("exclusive" | "inclusive" | "inferred_by_currency" | null) + | undefined + tax_code?: (string | null) | undefined +} + +export type t_tax_product_resource_tax_settings_head_office = { + address: t_address +} + +export type t_tax_product_resource_tax_settings_status_details = { + active?: + | t_tax_product_resource_tax_settings_status_details_resource_active + | undefined + pending?: + | t_tax_product_resource_tax_settings_status_details_resource_pending + | undefined +} + +export type t_tax_product_resource_tax_settings_status_details_resource_active = + EmptyObject + +export type t_tax_product_resource_tax_settings_status_details_resource_pending = + { + missing_fields?: (string[] | null) | undefined + } + +export type t_tax_product_resource_tax_transaction_line_item_resource_reversal = + { + original_line_item: string + } + +export type t_tax_product_resource_tax_transaction_resource_reversal = { + original_transaction?: (string | null) | undefined +} + +export type t_tax_product_resource_tax_transaction_shipping_cost = { + amount: number + amount_tax: number + shipping_rate?: string | undefined + tax_behavior: "exclusive" | "inclusive" + tax_code: string +} + +export type t_tax_rate = { + active: boolean + country?: (string | null) | undefined + created: number + description?: (string | null) | undefined + display_name: string + effective_percentage?: (number | null) | undefined + flat_amount?: (t_tax_rate_flat_amount | null) | undefined + id: string + inclusive: boolean + jurisdiction?: (string | null) | undefined + jurisdiction_level?: + | ("city" | "country" | "county" | "district" | "multiple" | "state" | null) + | undefined + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "tax_rate" + percentage: number + rate_type?: ("flat_amount" | "percentage" | null) | undefined + state?: (string | null) | undefined + tax_type?: + | ( + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "retail_delivery_fee" + | "rst" + | "sales_tax" + | "service_tax" + | "vat" + | null + ) + | undefined +} + +export type t_tax_rate_flat_amount = { + amount: number + currency: string +} + +export type t_terminal_configuration = { + bbpos_wisepos_e?: + | t_terminal_configuration_configuration_resource_device_type_specific_config + | undefined + id: string + is_account_default?: (boolean | null) | undefined + livemode: boolean + name?: (string | null) | undefined + object: "terminal.configuration" + offline?: + | t_terminal_configuration_configuration_resource_offline_config + | undefined + reboot_window?: + | t_terminal_configuration_configuration_resource_reboot_window + | undefined + stripe_s700?: + | t_terminal_configuration_configuration_resource_device_type_specific_config + | undefined + tipping?: t_terminal_configuration_configuration_resource_tipping | undefined + verifone_p400?: + | t_terminal_configuration_configuration_resource_device_type_specific_config + | undefined + wifi?: t_terminal_configuration_configuration_resource_wifi_config | undefined +} + +export type t_terminal_connection_token = { + location?: string | undefined + object: "terminal.connection_token" + secret: string +} + +export type t_terminal_location = { + address: t_address + configuration_overrides?: string | undefined + display_name: string + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "terminal.location" +} + +export type t_terminal_reader = { + action?: (t_terminal_reader_reader_resource_reader_action | null) | undefined + device_sw_version?: (string | null) | undefined + device_type: + | "bbpos_chipper2x" + | "bbpos_wisepad3" + | "bbpos_wisepos_e" + | "mobile_phone_reader" + | "simulated_wisepos_e" + | "stripe_m2" + | "stripe_s700" + | "verifone_P400" + id: string + ip_address?: (string | null) | undefined + label: string + livemode: boolean + location?: (string | t_terminal_location | null) | undefined + metadata: { + [key: string]: string | undefined + } + object: "terminal.reader" + serial_number: string + status?: ("offline" | "online" | null) | undefined +} + +export type t_terminal_configuration_configuration_resource_currency_specific_config = + { + fixed_amounts?: (number[] | null) | undefined + percentages?: (number[] | null) | undefined + smart_tip_threshold?: number | undefined + } + +export type t_terminal_configuration_configuration_resource_device_type_specific_config = + { + splashscreen?: (string | t_file) | undefined + } + +export type t_terminal_configuration_configuration_resource_enterprise_peap_wifi = + { + ca_certificate_file?: string | undefined + password: string + ssid: string + username: string + } + +export type t_terminal_configuration_configuration_resource_enterprise_tls_wifi = + { + ca_certificate_file?: string | undefined + client_certificate_file: string + private_key_file: string + private_key_file_password?: string | undefined + ssid: string + } + +export type t_terminal_configuration_configuration_resource_offline_config = { + enabled?: (boolean | null) | undefined +} + +export type t_terminal_configuration_configuration_resource_personal_psk_wifi = + { + password: string + ssid: string + } + +export type t_terminal_configuration_configuration_resource_reboot_window = { + end_hour: number + start_hour: number +} + +export type t_terminal_configuration_configuration_resource_tipping = { + aud?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + cad?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + chf?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + czk?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + dkk?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + eur?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + gbp?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + hkd?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + jpy?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + myr?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + nok?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + nzd?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + pln?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + sek?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + sgd?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined + usd?: + | t_terminal_configuration_configuration_resource_currency_specific_config + | undefined +} + +export type t_terminal_configuration_configuration_resource_wifi_config = { + enterprise_eap_peap?: + | t_terminal_configuration_configuration_resource_enterprise_peap_wifi + | undefined + enterprise_eap_tls?: + | t_terminal_configuration_configuration_resource_enterprise_tls_wifi + | undefined + personal_psk?: + | t_terminal_configuration_configuration_resource_personal_psk_wifi + | undefined + type: "enterprise_eap_peap" | "enterprise_eap_tls" | "personal_psk" +} + +export type t_terminal_reader_reader_resource_cart = { + currency: string + line_items: t_terminal_reader_reader_resource_line_item[] + tax?: (number | null) | undefined + total: number +} + +export type t_terminal_reader_reader_resource_line_item = { + amount: number + description: string + quantity: number +} + +export type t_terminal_reader_reader_resource_process_config = { + enable_customer_cancellation?: boolean | undefined + skip_tipping?: boolean | undefined + tipping?: t_terminal_reader_reader_resource_tipping_config | undefined +} + +export type t_terminal_reader_reader_resource_process_payment_intent_action = { + payment_intent: string | t_payment_intent + process_config?: t_terminal_reader_reader_resource_process_config | undefined +} + +export type t_terminal_reader_reader_resource_process_setup_config = { + enable_customer_cancellation?: boolean | undefined +} + +export type t_terminal_reader_reader_resource_process_setup_intent_action = { + generated_card?: string | undefined + process_config?: + | t_terminal_reader_reader_resource_process_setup_config + | undefined + setup_intent: string | t_setup_intent +} + +export type t_terminal_reader_reader_resource_reader_action = { + failure_code?: (string | null) | undefined + failure_message?: (string | null) | undefined + process_payment_intent?: + | t_terminal_reader_reader_resource_process_payment_intent_action + | undefined + process_setup_intent?: + | t_terminal_reader_reader_resource_process_setup_intent_action + | undefined + refund_payment?: + | t_terminal_reader_reader_resource_refund_payment_action + | undefined + set_reader_display?: + | t_terminal_reader_reader_resource_set_reader_display_action + | undefined + status: "failed" | "in_progress" | "succeeded" + type: + | "process_payment_intent" + | "process_setup_intent" + | "refund_payment" + | "set_reader_display" +} + +export type t_terminal_reader_reader_resource_refund_payment_action = { + amount?: number | undefined + charge?: (string | t_charge) | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + payment_intent?: (string | t_payment_intent) | undefined + reason?: ("duplicate" | "fraudulent" | "requested_by_customer") | undefined + refund?: (string | t_refund) | undefined + refund_application_fee?: boolean | undefined + refund_payment_config?: + | t_terminal_reader_reader_resource_refund_payment_config + | undefined + reverse_transfer?: boolean | undefined +} + +export type t_terminal_reader_reader_resource_refund_payment_config = { + enable_customer_cancellation?: boolean | undefined +} + +export type t_terminal_reader_reader_resource_set_reader_display_action = { + cart?: (t_terminal_reader_reader_resource_cart | null) | undefined + type: "cart" +} + +export type t_terminal_reader_reader_resource_tipping_config = { + amount_eligible?: number | undefined +} + +export type t_test_helpers_test_clock = { + created: number + deletes_after: number + frozen_time: number + id: string + livemode: boolean + name?: (string | null) | undefined + object: "test_helpers.test_clock" + status: "advancing" | "internal_failure" | "ready" + status_details: t_billing_clocks_resource_status_details_status_details +} + +export type t_three_d_secure_details = { + authentication_flow?: ("challenge" | "frictionless" | null) | undefined + electronic_commerce_indicator?: + | ("01" | "02" | "05" | "06" | "07" | null) + | undefined + result?: + | ( + | "attempt_acknowledged" + | "authenticated" + | "exempted" + | "failed" + | "not_supported" + | "processing_error" + | null + ) + | undefined + result_reason?: + | ( + | "abandoned" + | "bypassed" + | "canceled" + | "card_not_enrolled" + | "network_not_supported" + | "protocol_error" + | "rejected" + | null + ) + | undefined + transaction_id?: (string | null) | undefined + version?: ("1.0.2" | "2.1.0" | "2.2.0" | null) | undefined +} + +export type t_three_d_secure_details_charge = { + authentication_flow?: ("challenge" | "frictionless" | null) | undefined + electronic_commerce_indicator?: + | ("01" | "02" | "05" | "06" | "07" | null) + | undefined + exemption_indicator?: ("low_risk" | "none" | null) | undefined + exemption_indicator_applied?: boolean | undefined + result?: + | ( + | "attempt_acknowledged" + | "authenticated" + | "exempted" + | "failed" + | "not_supported" + | "processing_error" + | null + ) + | undefined + result_reason?: + | ( + | "abandoned" + | "bypassed" + | "canceled" + | "card_not_enrolled" + | "network_not_supported" + | "protocol_error" + | "rejected" + | null + ) + | undefined + transaction_id?: (string | null) | undefined + version?: ("1.0.2" | "2.1.0" | "2.2.0" | null) | undefined +} + +export type t_three_d_secure_usage = { + supported: boolean +} + +export type t_thresholds_resource_usage_alert_filter = { + customer?: (string | t_customer | null) | undefined + type: "customer" +} + +export type t_thresholds_resource_usage_threshold_config = { + filters?: (t_thresholds_resource_usage_alert_filter[] | null) | undefined + gte: number + meter: string | t_billing_meter + recurrence: "one_time" +} + +export type t_token = { + bank_account?: t_bank_account | undefined + card?: t_card | undefined + client_ip?: (string | null) | undefined + created: number + id: string + livemode: boolean + object: "token" + type: string + used: boolean +} + +export type t_token_card_networks = { + preferred?: (string | null) | undefined +} + +export type t_topup = { + amount: number + balance_transaction?: (string | t_balance_transaction | null) | undefined + created: number + currency: string + description?: (string | null) | undefined + expected_availability_date?: (number | null) | undefined + failure_code?: (string | null) | undefined + failure_message?: (string | null) | undefined + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "topup" + source?: (t_source | null) | undefined + statement_descriptor?: (string | null) | undefined + status: "canceled" | "failed" | "pending" | "reversed" | "succeeded" + transfer_group?: (string | null) | undefined +} + +export type t_transfer = { + amount: number + amount_reversed: number + balance_transaction?: (string | t_balance_transaction | null) | undefined + created: number + currency: string + description?: (string | null) | undefined + destination?: (string | t_account | null) | undefined + destination_payment?: (string | t_charge) | undefined + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "transfer" + reversals: { + data: t_transfer_reversal[] + has_more: boolean + object: "list" + url: string + } + reversed: boolean + source_transaction?: (string | t_charge | null) | undefined + source_type?: string | undefined + transfer_group?: (string | null) | undefined +} + +export type t_transfer_data = { + amount?: number | undefined + destination: string | t_account +} + +export type t_transfer_reversal = { + amount: number + balance_transaction?: (string | t_balance_transaction | null) | undefined + created: number + currency: string + destination_payment_refund?: (string | t_refund | null) | undefined + id: string + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + object: "transfer_reversal" + source_refund?: (string | t_refund | null) | undefined + transfer: string | t_transfer +} + +export type t_transfer_schedule = { + delay_days: number + interval: string + monthly_anchor?: number | undefined + weekly_anchor?: string | undefined +} + +export type t_transform_quantity = { + divide_by: number + round: "down" | "up" +} + +export type t_transform_usage = { + divide_by: number + round: "down" | "up" +} + +export type t_treasury_credit_reversal = { + amount: number + created: number + currency: string + financial_account: string + hosted_regulatory_receipt_url?: (string | null) | undefined + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + network: "ach" | "stripe" + object: "treasury.credit_reversal" + received_credit: string + status: "canceled" | "posted" | "processing" + status_transitions: t_treasury_received_credits_resource_status_transitions + transaction?: (string | t_treasury_transaction | null) | undefined +} + +export type t_treasury_debit_reversal = { + amount: number + created: number + currency: string + financial_account?: (string | null) | undefined + hosted_regulatory_receipt_url?: (string | null) | undefined + id: string + linked_flows?: + | (t_treasury_received_debits_resource_debit_reversal_linked_flows | null) + | undefined + livemode: boolean + metadata: { + [key: string]: string | undefined + } + network: "ach" | "card" + object: "treasury.debit_reversal" + received_debit: string + status: "failed" | "processing" | "succeeded" + status_transitions: t_treasury_received_debits_resource_status_transitions + transaction?: (string | t_treasury_transaction | null) | undefined +} + +export type t_treasury_financial_account = { + active_features?: + | ( + | "card_issuing" + | "deposit_insurance" + | "financial_addresses.aba" + | "financial_addresses.aba.forwarding" + | "inbound_transfers.ach" + | "intra_stripe_flows" + | "outbound_payments.ach" + | "outbound_payments.us_domestic_wire" + | "outbound_transfers.ach" + | "outbound_transfers.us_domestic_wire" + | "remote_deposit_capture" + )[] + | undefined + balance: t_treasury_financial_accounts_resource_balance + country: string + created: number + features?: t_treasury_financial_account_features | undefined + financial_addresses: t_treasury_financial_accounts_resource_financial_address[] + id: string + is_default?: boolean | undefined + livemode: boolean + metadata?: + | ({ + [key: string]: string | undefined + } | null) + | undefined + nickname?: (string | null) | undefined + object: "treasury.financial_account" + pending_features?: + | ( + | "card_issuing" + | "deposit_insurance" + | "financial_addresses.aba" + | "financial_addresses.aba.forwarding" + | "inbound_transfers.ach" + | "intra_stripe_flows" + | "outbound_payments.ach" + | "outbound_payments.us_domestic_wire" + | "outbound_transfers.ach" + | "outbound_transfers.us_domestic_wire" + | "remote_deposit_capture" + )[] + | undefined + platform_restrictions?: + | (t_treasury_financial_accounts_resource_platform_restrictions | null) + | undefined + restricted_features?: + | ( + | "card_issuing" + | "deposit_insurance" + | "financial_addresses.aba" + | "financial_addresses.aba.forwarding" + | "inbound_transfers.ach" + | "intra_stripe_flows" + | "outbound_payments.ach" + | "outbound_payments.us_domestic_wire" + | "outbound_transfers.ach" + | "outbound_transfers.us_domestic_wire" + | "remote_deposit_capture" + )[] + | undefined + status: "closed" | "open" + status_details: t_treasury_financial_accounts_resource_status_details + supported_currencies: string[] +} + +export type t_treasury_financial_account_features = { + card_issuing?: + | t_treasury_financial_accounts_resource_toggle_settings + | undefined + deposit_insurance?: + | t_treasury_financial_accounts_resource_toggle_settings + | undefined + financial_addresses?: + | t_treasury_financial_accounts_resource_financial_addresses_features + | undefined + inbound_transfers?: + | t_treasury_financial_accounts_resource_inbound_transfers + | undefined + intra_stripe_flows?: + | t_treasury_financial_accounts_resource_toggle_settings + | undefined + object: "treasury.financial_account_features" + outbound_payments?: + | t_treasury_financial_accounts_resource_outbound_payments + | undefined + outbound_transfers?: + | t_treasury_financial_accounts_resource_outbound_transfers + | undefined +} + +export type t_treasury_inbound_transfer = { + amount: number + cancelable: boolean + created: number + currency: string + description?: (string | null) | undefined + failure_details?: + | (t_treasury_inbound_transfers_resource_failure_details | null) + | undefined + financial_account: string + hosted_regulatory_receipt_url?: (string | null) | undefined + id: string + linked_flows: t_treasury_inbound_transfers_resource_inbound_transfer_resource_linked_flows + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "treasury.inbound_transfer" + origin_payment_method?: (string | null) | undefined + origin_payment_method_details?: (t_inbound_transfers | null) | undefined + returned?: (boolean | null) | undefined + statement_descriptor: string + status: "canceled" | "failed" | "processing" | "succeeded" + status_transitions: t_treasury_inbound_transfers_resource_inbound_transfer_resource_status_transitions + transaction?: (string | t_treasury_transaction | null) | undefined +} + +export type t_treasury_outbound_payment = { + amount: number + cancelable: boolean + created: number + currency: string + customer?: (string | null) | undefined + description?: (string | null) | undefined + destination_payment_method?: (string | null) | undefined + destination_payment_method_details?: + | (t_outbound_payments_payment_method_details | null) + | undefined + end_user_details?: + | (t_treasury_outbound_payments_resource_outbound_payment_resource_end_user_details | null) + | undefined + expected_arrival_date: number + financial_account: string + hosted_regulatory_receipt_url?: (string | null) | undefined + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "treasury.outbound_payment" + returned_details?: + | (t_treasury_outbound_payments_resource_returned_status | null) + | undefined + statement_descriptor: string + status: "canceled" | "failed" | "posted" | "processing" | "returned" + status_transitions: t_treasury_outbound_payments_resource_outbound_payment_resource_status_transitions + tracking_details?: + | (t_treasury_outbound_payments_resource_outbound_payment_resource_tracking_details | null) + | undefined + transaction: string | t_treasury_transaction +} + +export type t_treasury_outbound_transfer = { + amount: number + cancelable: boolean + created: number + currency: string + description?: (string | null) | undefined + destination_payment_method?: (string | null) | undefined + destination_payment_method_details: t_outbound_transfers_payment_method_details + expected_arrival_date: number + financial_account: string + hosted_regulatory_receipt_url?: (string | null) | undefined + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "treasury.outbound_transfer" + returned_details?: + | (t_treasury_outbound_transfers_resource_returned_details | null) + | undefined + statement_descriptor: string + status: "canceled" | "failed" | "posted" | "processing" | "returned" + status_transitions: t_treasury_outbound_transfers_resource_status_transitions + tracking_details?: + | (t_treasury_outbound_transfers_resource_outbound_transfer_resource_tracking_details | null) + | undefined + transaction: string | t_treasury_transaction +} + +export type t_treasury_received_credit = { + amount: number + created: number + currency: string + description: string + failure_code?: + | ( + | "account_closed" + | "account_frozen" + | "international_transaction" + | "other" + | null + ) + | undefined + financial_account?: (string | null) | undefined + hosted_regulatory_receipt_url?: (string | null) | undefined + id: string + initiating_payment_method_details: t_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details + linked_flows: t_treasury_received_credits_resource_linked_flows + livemode: boolean + network: "ach" | "card" | "stripe" | "us_domestic_wire" + object: "treasury.received_credit" + reversal_details?: + | (t_treasury_received_credits_resource_reversal_details | null) + | undefined + status: "failed" | "succeeded" + transaction?: (string | t_treasury_transaction | null) | undefined +} + +export type t_treasury_received_debit = { + amount: number + created: number + currency: string + description: string + failure_code?: + | ( + | "account_closed" + | "account_frozen" + | "insufficient_funds" + | "international_transaction" + | "other" + | null + ) + | undefined + financial_account?: (string | null) | undefined + hosted_regulatory_receipt_url?: (string | null) | undefined + id: string + initiating_payment_method_details?: + | t_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details + | undefined + linked_flows: t_treasury_received_debits_resource_linked_flows + livemode: boolean + network: "ach" | "card" | "stripe" + object: "treasury.received_debit" + reversal_details?: + | (t_treasury_received_debits_resource_reversal_details | null) + | undefined + status: "failed" | "succeeded" + transaction?: (string | t_treasury_transaction | null) | undefined +} + +export type t_treasury_transaction = { + amount: number + balance_impact: t_treasury_transactions_resource_balance_impact + created: number + currency: string + description: string + entries?: + | ({ + data: t_treasury_transaction_entry[] + has_more: boolean + object: "list" + url: string + } | null) + | undefined + financial_account: string + flow?: (string | null) | undefined + flow_details?: + | (t_treasury_transactions_resource_flow_details | null) + | undefined + flow_type: + | "credit_reversal" + | "debit_reversal" + | "inbound_transfer" + | "issuing_authorization" + | "other" + | "outbound_payment" + | "outbound_transfer" + | "received_credit" + | "received_debit" + id: string + livemode: boolean + object: "treasury.transaction" + status: "open" | "posted" | "void" + status_transitions: t_treasury_transactions_resource_abstract_transaction_resource_status_transitions +} + +export type t_treasury_transaction_entry = { + balance_impact: t_treasury_transactions_resource_balance_impact + created: number + currency: string + effective_at: number + financial_account: string + flow?: (string | null) | undefined + flow_details?: + | (t_treasury_transactions_resource_flow_details | null) + | undefined + flow_type: + | "credit_reversal" + | "debit_reversal" + | "inbound_transfer" + | "issuing_authorization" + | "other" + | "outbound_payment" + | "outbound_transfer" + | "received_credit" + | "received_debit" + id: string + livemode: boolean + object: "treasury.transaction_entry" + transaction: string | t_treasury_transaction + type: + | "credit_reversal" + | "credit_reversal_posting" + | "debit_reversal" + | "inbound_transfer" + | "inbound_transfer_return" + | "issuing_authorization_hold" + | "issuing_authorization_release" + | "other" + | "outbound_payment" + | "outbound_payment_cancellation" + | "outbound_payment_failure" + | "outbound_payment_posting" + | "outbound_payment_return" + | "outbound_transfer" + | "outbound_transfer_cancellation" + | "outbound_transfer_failure" + | "outbound_transfer_posting" + | "outbound_transfer_return" + | "received_credit" + | "received_debit" +} + +export type t_treasury_financial_accounts_resource_aba_record = { + account_holder_name: string + account_number?: (string | null) | undefined + account_number_last4: string + bank_name: string + routing_number: string +} + +export type t_treasury_financial_accounts_resource_aba_toggle_settings = { + requested: boolean + status: "active" | "pending" | "restricted" + status_details: t_treasury_financial_accounts_resource_toggles_setting_status_details[] +} + +export type t_treasury_financial_accounts_resource_balance = { + cash: { + [key: string]: number | undefined + } + inbound_pending: { + [key: string]: number | undefined + } + outbound_pending: { + [key: string]: number | undefined + } +} + +export type t_treasury_financial_accounts_resource_closed_status_details = { + reasons: ("account_rejected" | "closed_by_platform" | "other")[] +} + +export type t_treasury_financial_accounts_resource_financial_address = { + aba?: t_treasury_financial_accounts_resource_aba_record | undefined + supported_networks?: ("ach" | "us_domestic_wire")[] | undefined + type: "aba" +} + +export type t_treasury_financial_accounts_resource_financial_addresses_features = + { + aba?: t_treasury_financial_accounts_resource_aba_toggle_settings | undefined + } + +export type t_treasury_financial_accounts_resource_inbound_ach_toggle_settings = + { + requested: boolean + status: "active" | "pending" | "restricted" + status_details: t_treasury_financial_accounts_resource_toggles_setting_status_details[] + } + +export type t_treasury_financial_accounts_resource_inbound_transfers = { + ach?: + | t_treasury_financial_accounts_resource_inbound_ach_toggle_settings + | undefined +} + +export type t_treasury_financial_accounts_resource_outbound_ach_toggle_settings = + { + requested: boolean + status: "active" | "pending" | "restricted" + status_details: t_treasury_financial_accounts_resource_toggles_setting_status_details[] + } + +export type t_treasury_financial_accounts_resource_outbound_payments = { + ach?: + | t_treasury_financial_accounts_resource_outbound_ach_toggle_settings + | undefined + us_domestic_wire?: + | t_treasury_financial_accounts_resource_toggle_settings + | undefined +} + +export type t_treasury_financial_accounts_resource_outbound_transfers = { + ach?: + | t_treasury_financial_accounts_resource_outbound_ach_toggle_settings + | undefined + us_domestic_wire?: + | t_treasury_financial_accounts_resource_toggle_settings + | undefined +} + +export type t_treasury_financial_accounts_resource_platform_restrictions = { + inbound_flows?: ("restricted" | "unrestricted" | null) | undefined + outbound_flows?: ("restricted" | "unrestricted" | null) | undefined +} + +export type t_treasury_financial_accounts_resource_status_details = { + closed?: + | (t_treasury_financial_accounts_resource_closed_status_details | null) + | undefined +} + +export type t_treasury_financial_accounts_resource_toggle_settings = { + requested: boolean + status: "active" | "pending" | "restricted" + status_details: t_treasury_financial_accounts_resource_toggles_setting_status_details[] +} + +export type t_treasury_financial_accounts_resource_toggles_setting_status_details = + { + code: + | "activating" + | "capability_not_requested" + | "financial_account_closed" + | "rejected_other" + | "rejected_unsupported_business" + | "requirements_past_due" + | "requirements_pending_verification" + | "restricted_by_platform" + | "restricted_other" + resolution?: + | ("contact_stripe" | "provide_information" | "remove_restriction" | null) + | undefined + restriction?: ("inbound_flows" | "outbound_flows") | undefined + } + +export type t_treasury_inbound_transfers_resource_failure_details = { + code: + | "account_closed" + | "account_frozen" + | "bank_account_restricted" + | "bank_ownership_changed" + | "debit_not_authorized" + | "incorrect_account_holder_address" + | "incorrect_account_holder_name" + | "incorrect_account_holder_tax_id" + | "insufficient_funds" + | "invalid_account_number" + | "invalid_currency" + | "no_account" + | "other" +} + +export type t_treasury_inbound_transfers_resource_inbound_transfer_resource_linked_flows = + { + received_debit?: (string | null) | undefined + } + +export type t_treasury_inbound_transfers_resource_inbound_transfer_resource_status_transitions = + { + canceled_at?: (number | null) | undefined + failed_at?: (number | null) | undefined + succeeded_at?: (number | null) | undefined + } + +export type t_treasury_outbound_payments_resource_ach_tracking_details = { + trace_id: string +} + +export type t_treasury_outbound_payments_resource_outbound_payment_resource_end_user_details = + { + ip_address?: (string | null) | undefined + present: boolean + } + +export type t_treasury_outbound_payments_resource_outbound_payment_resource_status_transitions = + { + canceled_at?: (number | null) | undefined + failed_at?: (number | null) | undefined + posted_at?: (number | null) | undefined + returned_at?: (number | null) | undefined + } + +export type t_treasury_outbound_payments_resource_outbound_payment_resource_tracking_details = + { + ach?: t_treasury_outbound_payments_resource_ach_tracking_details | undefined + type: "ach" | "us_domestic_wire" + us_domestic_wire?: + | t_treasury_outbound_payments_resource_us_domestic_wire_tracking_details + | undefined + } + +export type t_treasury_outbound_payments_resource_returned_status = { + code: + | "account_closed" + | "account_frozen" + | "bank_account_restricted" + | "bank_ownership_changed" + | "declined" + | "incorrect_account_holder_name" + | "invalid_account_number" + | "invalid_currency" + | "no_account" + | "other" + transaction: string | t_treasury_transaction +} + +export type t_treasury_outbound_payments_resource_us_domestic_wire_tracking_details = + { + chips?: (string | null) | undefined + imad?: (string | null) | undefined + omad?: (string | null) | undefined + } + +export type t_treasury_outbound_transfers_resource_ach_tracking_details = { + trace_id: string +} + +export type t_treasury_outbound_transfers_resource_outbound_transfer_resource_tracking_details = + { + ach?: + | t_treasury_outbound_transfers_resource_ach_tracking_details + | undefined + type: "ach" | "us_domestic_wire" + us_domestic_wire?: + | t_treasury_outbound_transfers_resource_us_domestic_wire_tracking_details + | undefined + } + +export type t_treasury_outbound_transfers_resource_returned_details = { + code: + | "account_closed" + | "account_frozen" + | "bank_account_restricted" + | "bank_ownership_changed" + | "declined" + | "incorrect_account_holder_name" + | "invalid_account_number" + | "invalid_currency" + | "no_account" + | "other" + transaction: string | t_treasury_transaction +} + +export type t_treasury_outbound_transfers_resource_status_transitions = { + canceled_at?: (number | null) | undefined + failed_at?: (number | null) | undefined + posted_at?: (number | null) | undefined + returned_at?: (number | null) | undefined +} + +export type t_treasury_outbound_transfers_resource_us_domestic_wire_tracking_details = + { + chips?: (string | null) | undefined + imad?: (string | null) | undefined + omad?: (string | null) | undefined + } + +export type t_treasury_received_credits_resource_linked_flows = { + credit_reversal?: (string | null) | undefined + issuing_authorization?: (string | null) | undefined + issuing_transaction?: (string | null) | undefined + source_flow?: (string | null) | undefined + source_flow_details?: + | (t_treasury_received_credits_resource_source_flows_details | null) + | undefined + source_flow_type?: (string | null) | undefined +} + +export type t_treasury_received_credits_resource_reversal_details = { + deadline?: (number | null) | undefined + restricted_reason?: + | ( + | "already_reversed" + | "deadline_passed" + | "network_restricted" + | "other" + | "source_flow_restricted" + | null + ) + | undefined +} + +export type t_treasury_received_credits_resource_source_flows_details = { + credit_reversal?: t_treasury_credit_reversal | undefined + outbound_payment?: t_treasury_outbound_payment | undefined + outbound_transfer?: t_treasury_outbound_transfer | undefined + payout?: t_payout | undefined + type: + | "credit_reversal" + | "other" + | "outbound_payment" + | "outbound_transfer" + | "payout" +} + +export type t_treasury_received_credits_resource_status_transitions = { + posted_at?: (number | null) | undefined +} + +export type t_treasury_received_debits_resource_debit_reversal_linked_flows = { + issuing_dispute?: (string | null) | undefined +} + +export type t_treasury_received_debits_resource_linked_flows = { + debit_reversal?: (string | null) | undefined + inbound_transfer?: (string | null) | undefined + issuing_authorization?: (string | null) | undefined + issuing_transaction?: (string | null) | undefined + payout?: (string | null) | undefined +} + +export type t_treasury_received_debits_resource_reversal_details = { + deadline?: (number | null) | undefined + restricted_reason?: + | ( + | "already_reversed" + | "deadline_passed" + | "network_restricted" + | "other" + | "source_flow_restricted" + | null + ) + | undefined +} + +export type t_treasury_received_debits_resource_status_transitions = { + completed_at?: (number | null) | undefined +} + +export type t_treasury_shared_resource_billing_details = { + address: t_address + email?: (string | null) | undefined + name?: (string | null) | undefined +} + +export type t_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details = + { + balance?: "payments" | undefined + billing_details: t_treasury_shared_resource_billing_details + financial_account?: + | t_received_payment_method_details_financial_account + | undefined + issuing_card?: string | undefined + type: + | "balance" + | "financial_account" + | "issuing_card" + | "stripe" + | "us_bank_account" + us_bank_account?: + | t_treasury_shared_resource_initiating_payment_method_details_us_bank_account + | undefined + } + +export type t_treasury_shared_resource_initiating_payment_method_details_us_bank_account = + { + bank_name?: (string | null) | undefined + last4?: (string | null) | undefined + routing_number?: (string | null) | undefined + } + +export type t_treasury_transactions_resource_abstract_transaction_resource_status_transitions = + { + posted_at?: (number | null) | undefined + void_at?: (number | null) | undefined + } + +export type t_treasury_transactions_resource_balance_impact = { + cash: number + inbound_pending: number + outbound_pending: number +} + +export type t_treasury_transactions_resource_flow_details = { + credit_reversal?: t_treasury_credit_reversal | undefined + debit_reversal?: t_treasury_debit_reversal | undefined + inbound_transfer?: t_treasury_inbound_transfer | undefined + issuing_authorization?: t_issuing_authorization | undefined + outbound_payment?: t_treasury_outbound_payment | undefined + outbound_transfer?: t_treasury_outbound_transfer | undefined + received_credit?: t_treasury_received_credit | undefined + received_debit?: t_treasury_received_debit | undefined + type: + | "credit_reversal" + | "debit_reversal" + | "inbound_transfer" + | "issuing_authorization" + | "other" + | "outbound_payment" + | "outbound_transfer" + | "received_credit" + | "received_debit" +} + +export type t_us_bank_account_networks = { + preferred?: (string | null) | undefined + supported: ("ach" | "us_domestic_wire")[] +} + +export type t_verification_session_redaction = { + status: "processing" | "redacted" +} + +export type t_webhook_endpoint = { + api_version?: (string | null) | undefined + application?: (string | null) | undefined + created: number + description?: (string | null) | undefined + enabled_events: string[] + id: string + livemode: boolean + metadata: { + [key: string]: string | undefined + } + object: "webhook_endpoint" + secret?: string | undefined + status: string + url: string +} + +export type t_DeleteAccountsAccountParamSchema = { + account: string +} + +export type t_DeleteAccountsAccountRequestBodySchema = EmptyObject + +export type t_DeleteAccountsAccountBankAccountsIdParamSchema = { + account: string + id: string +} + +export type t_DeleteAccountsAccountBankAccountsIdRequestBodySchema = EmptyObject + +export type t_DeleteAccountsAccountExternalAccountsIdParamSchema = { + account: string + id: string +} + +export type t_DeleteAccountsAccountExternalAccountsIdRequestBodySchema = + EmptyObject + +export type t_DeleteAccountsAccountPeoplePersonParamSchema = { + account: string + person: string +} + +export type t_DeleteAccountsAccountPeoplePersonRequestBodySchema = EmptyObject + +export type t_DeleteAccountsAccountPersonsPersonParamSchema = { + account: string + person: string +} + +export type t_DeleteAccountsAccountPersonsPersonRequestBodySchema = EmptyObject + +export type t_DeleteApplePayDomainsDomainParamSchema = { + domain: string +} + +export type t_DeleteApplePayDomainsDomainRequestBodySchema = EmptyObject + +export type t_DeleteCouponsCouponParamSchema = { + coupon: string +} + +export type t_DeleteCouponsCouponRequestBodySchema = EmptyObject + +export type t_DeleteCustomersCustomerParamSchema = { + customer: string +} + +export type t_DeleteCustomersCustomerRequestBodySchema = EmptyObject + +export type t_DeleteCustomersCustomerBankAccountsIdParamSchema = { + customer: string + id: string +} + +export type t_DeleteCustomersCustomerBankAccountsIdRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_DeleteCustomersCustomerCardsIdParamSchema = { + customer: string + id: string +} + +export type t_DeleteCustomersCustomerCardsIdRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_DeleteCustomersCustomerDiscountParamSchema = { + customer: string +} + +export type t_DeleteCustomersCustomerDiscountRequestBodySchema = EmptyObject + +export type t_DeleteCustomersCustomerSourcesIdParamSchema = { + customer: string + id: string +} + +export type t_DeleteCustomersCustomerSourcesIdRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema = + { + customer: string + subscription_exposed_id: string + } + +export type t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema = + { + expand?: string[] | undefined + invoice_now?: boolean | undefined + prorate?: boolean | undefined + } + +export type t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema = + { + customer: string + subscription_exposed_id: string + } + +export type t_DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema = + EmptyObject + +export type t_DeleteCustomersCustomerTaxIdsIdParamSchema = { + customer: string + id: string +} + +export type t_DeleteCustomersCustomerTaxIdsIdRequestBodySchema = EmptyObject + +export type t_DeleteEphemeralKeysKeyParamSchema = { + key: string +} + +export type t_DeleteEphemeralKeysKeyRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_DeleteInvoiceitemsInvoiceitemParamSchema = { + invoiceitem: string +} + +export type t_DeleteInvoiceitemsInvoiceitemRequestBodySchema = EmptyObject + +export type t_DeleteInvoicesInvoiceParamSchema = { + invoice: string +} + +export type t_DeleteInvoicesInvoiceRequestBodySchema = EmptyObject + +export type t_DeletePlansPlanParamSchema = { + plan: string +} + +export type t_DeletePlansPlanRequestBodySchema = EmptyObject + +export type t_DeleteProductsIdParamSchema = { + id: string +} + +export type t_DeleteProductsIdRequestBodySchema = EmptyObject + +export type t_DeleteProductsProductFeaturesIdParamSchema = { + id: string + product: string +} + +export type t_DeleteProductsProductFeaturesIdRequestBodySchema = EmptyObject + +export type t_DeleteRadarValueListItemsItemParamSchema = { + item: string +} + +export type t_DeleteRadarValueListItemsItemRequestBodySchema = EmptyObject + +export type t_DeleteRadarValueListsValueListParamSchema = { + value_list: string +} + +export type t_DeleteRadarValueListsValueListRequestBodySchema = EmptyObject + +export type t_DeleteSubscriptionItemsItemParamSchema = { + item: string +} + +export type t_DeleteSubscriptionItemsItemRequestBodySchema = { + clear_usage?: boolean | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + proration_date?: number | undefined +} + +export type t_DeleteSubscriptionsSubscriptionExposedIdParamSchema = { + subscription_exposed_id: string +} + +export type t_DeleteSubscriptionsSubscriptionExposedIdRequestBodySchema = { + cancellation_details?: + | { + comment?: (string | "") | undefined + feedback?: + | ( + | "" + | "customer_service" + | "low_quality" + | "missing_features" + | "other" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + ) + | undefined + } + | undefined + expand?: string[] | undefined + invoice_now?: boolean | undefined + prorate?: boolean | undefined +} + +export type t_DeleteSubscriptionsSubscriptionExposedIdDiscountParamSchema = { + subscription_exposed_id: string +} + +export type t_DeleteSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema = + EmptyObject + +export type t_DeleteTaxIdsIdParamSchema = { + id: string +} + +export type t_DeleteTaxIdsIdRequestBodySchema = EmptyObject + +export type t_DeleteTerminalConfigurationsConfigurationParamSchema = { + configuration: string +} + +export type t_DeleteTerminalConfigurationsConfigurationRequestBodySchema = + EmptyObject + +export type t_DeleteTerminalLocationsLocationParamSchema = { + location: string +} + +export type t_DeleteTerminalLocationsLocationRequestBodySchema = EmptyObject + +export type t_DeleteTerminalReadersReaderParamSchema = { + reader: string +} + +export type t_DeleteTerminalReadersReaderRequestBodySchema = EmptyObject + +export type t_DeleteTestHelpersTestClocksTestClockParamSchema = { + test_clock: string +} + +export type t_DeleteTestHelpersTestClocksTestClockRequestBodySchema = + EmptyObject + +export type t_DeleteWebhookEndpointsWebhookEndpointParamSchema = { + webhook_endpoint: string +} + +export type t_DeleteWebhookEndpointsWebhookEndpointRequestBodySchema = + EmptyObject + +export type t_GetAccountQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetAccountRequestBodySchema = EmptyObject + +export type t_GetAccountsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetAccountsRequestBodySchema = EmptyObject + +export type t_GetAccountsAccountParamSchema = { + account: string +} + +export type t_GetAccountsAccountQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetAccountsAccountRequestBodySchema = EmptyObject + +export type t_GetAccountsAccountBankAccountsIdParamSchema = { + account: string + id: string +} + +export type t_GetAccountsAccountBankAccountsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetAccountsAccountBankAccountsIdRequestBodySchema = EmptyObject + +export type t_GetAccountsAccountCapabilitiesParamSchema = { + account: string +} + +export type t_GetAccountsAccountCapabilitiesQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetAccountsAccountCapabilitiesRequestBodySchema = EmptyObject + +export type t_GetAccountsAccountCapabilitiesCapabilityParamSchema = { + account: string + capability: string +} + +export type t_GetAccountsAccountCapabilitiesCapabilityQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetAccountsAccountCapabilitiesCapabilityRequestBodySchema = + EmptyObject + +export type t_GetAccountsAccountExternalAccountsParamSchema = { + account: string +} + +export type t_GetAccountsAccountExternalAccountsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + object?: ("bank_account" | "card") | undefined + starting_after?: string | undefined +} + +export type t_GetAccountsAccountExternalAccountsRequestBodySchema = EmptyObject + +export type t_GetAccountsAccountExternalAccountsIdParamSchema = { + account: string + id: string +} + +export type t_GetAccountsAccountExternalAccountsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetAccountsAccountExternalAccountsIdRequestBodySchema = + EmptyObject + +export type t_GetAccountsAccountPeopleParamSchema = { + account: string +} + +export type t_GetAccountsAccountPeopleQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + relationship?: + | { + authorizer?: boolean | undefined + director?: boolean | undefined + executive?: boolean | undefined + legal_guardian?: boolean | undefined + owner?: boolean | undefined + representative?: boolean | undefined + } + | undefined + starting_after?: string | undefined +} + +export type t_GetAccountsAccountPeopleRequestBodySchema = EmptyObject + +export type t_GetAccountsAccountPeoplePersonParamSchema = { + account: string + person: string +} + +export type t_GetAccountsAccountPeoplePersonQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetAccountsAccountPeoplePersonRequestBodySchema = EmptyObject + +export type t_GetAccountsAccountPersonsParamSchema = { + account: string +} + +export type t_GetAccountsAccountPersonsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + relationship?: + | { + authorizer?: boolean | undefined + director?: boolean | undefined + executive?: boolean | undefined + legal_guardian?: boolean | undefined + owner?: boolean | undefined + representative?: boolean | undefined + } + | undefined + starting_after?: string | undefined +} + +export type t_GetAccountsAccountPersonsRequestBodySchema = EmptyObject + +export type t_GetAccountsAccountPersonsPersonParamSchema = { + account: string + person: string +} + +export type t_GetAccountsAccountPersonsPersonQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetAccountsAccountPersonsPersonRequestBodySchema = EmptyObject + +export type t_GetApplePayDomainsQuerySchema = { + domain_name?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetApplePayDomainsRequestBodySchema = EmptyObject + +export type t_GetApplePayDomainsDomainParamSchema = { + domain: string +} + +export type t_GetApplePayDomainsDomainQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetApplePayDomainsDomainRequestBodySchema = EmptyObject + +export type t_GetApplicationFeesQuerySchema = { + charge?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetApplicationFeesRequestBodySchema = EmptyObject + +export type t_GetApplicationFeesFeeRefundsIdParamSchema = { + fee: string + id: string +} + +export type t_GetApplicationFeesFeeRefundsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetApplicationFeesFeeRefundsIdRequestBodySchema = EmptyObject + +export type t_GetApplicationFeesIdParamSchema = { + id: string +} + +export type t_GetApplicationFeesIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetApplicationFeesIdRequestBodySchema = EmptyObject + +export type t_GetApplicationFeesIdRefundsParamSchema = { + id: string +} + +export type t_GetApplicationFeesIdRefundsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetApplicationFeesIdRefundsRequestBodySchema = EmptyObject + +export type t_GetAppsSecretsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + scope: { + type: "account" | "user" + user?: string | undefined + } + starting_after?: string | undefined +} + +export type t_GetAppsSecretsRequestBodySchema = EmptyObject + +export type t_GetAppsSecretsFindQuerySchema = { + expand?: string[] | undefined + name: string + scope: { + type: "account" | "user" + user?: string | undefined + } +} + +export type t_GetAppsSecretsFindRequestBodySchema = EmptyObject + +export type t_GetBalanceQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetBalanceRequestBodySchema = EmptyObject + +export type t_GetBalanceHistoryQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + currency?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + payout?: string | undefined + source?: string | undefined + starting_after?: string | undefined + type?: string | undefined +} + +export type t_GetBalanceHistoryRequestBodySchema = EmptyObject + +export type t_GetBalanceHistoryIdParamSchema = { + id: string +} + +export type t_GetBalanceHistoryIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetBalanceHistoryIdRequestBodySchema = EmptyObject + +export type t_GetBalanceTransactionsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + currency?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + payout?: string | undefined + source?: string | undefined + starting_after?: string | undefined + type?: string | undefined +} + +export type t_GetBalanceTransactionsRequestBodySchema = EmptyObject + +export type t_GetBalanceTransactionsIdParamSchema = { + id: string +} + +export type t_GetBalanceTransactionsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetBalanceTransactionsIdRequestBodySchema = EmptyObject + +export type t_GetBillingAlertsQuerySchema = { + alert_type?: "usage_threshold" | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + meter?: string | undefined + starting_after?: string | undefined +} + +export type t_GetBillingAlertsRequestBodySchema = EmptyObject + +export type t_GetBillingAlertsIdParamSchema = { + id: string +} + +export type t_GetBillingAlertsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetBillingAlertsIdRequestBodySchema = EmptyObject + +export type t_GetBillingCreditBalanceSummaryQuerySchema = { + customer: string + expand?: string[] | undefined + filter: { + applicability_scope?: + | { + price_type?: "metered" | undefined + prices?: + | { + id: string + }[] + | undefined + } + | undefined + credit_grant?: string | undefined + type: "applicability_scope" | "credit_grant" + } +} + +export type t_GetBillingCreditBalanceSummaryRequestBodySchema = EmptyObject + +export type t_GetBillingCreditBalanceTransactionsQuerySchema = { + credit_grant?: string | undefined + customer: string + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetBillingCreditBalanceTransactionsRequestBodySchema = EmptyObject + +export type t_GetBillingCreditBalanceTransactionsIdParamSchema = { + id: string +} + +export type t_GetBillingCreditBalanceTransactionsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetBillingCreditBalanceTransactionsIdRequestBodySchema = + EmptyObject + +export type t_GetBillingCreditGrantsQuerySchema = { + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetBillingCreditGrantsRequestBodySchema = EmptyObject + +export type t_GetBillingCreditGrantsIdParamSchema = { + id: string +} + +export type t_GetBillingCreditGrantsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetBillingCreditGrantsIdRequestBodySchema = EmptyObject + +export type t_GetBillingMetersQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("active" | "inactive") | undefined +} + +export type t_GetBillingMetersRequestBodySchema = EmptyObject + +export type t_GetBillingMetersIdParamSchema = { + id: string +} + +export type t_GetBillingMetersIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetBillingMetersIdRequestBodySchema = EmptyObject + +export type t_GetBillingMetersIdEventSummariesParamSchema = { + id: string +} + +export type t_GetBillingMetersIdEventSummariesQuerySchema = { + customer: string + end_time: number + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + start_time: number + starting_after?: string | undefined + value_grouping_window?: ("day" | "hour") | undefined +} + +export type t_GetBillingMetersIdEventSummariesRequestBodySchema = EmptyObject + +export type t_GetBillingPortalConfigurationsQuerySchema = { + active?: boolean | undefined + ending_before?: string | undefined + expand?: string[] | undefined + is_default?: boolean | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetBillingPortalConfigurationsRequestBodySchema = EmptyObject + +export type t_GetBillingPortalConfigurationsConfigurationParamSchema = { + configuration: string +} + +export type t_GetBillingPortalConfigurationsConfigurationQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetBillingPortalConfigurationsConfigurationRequestBodySchema = + EmptyObject + +export type t_GetChargesQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + payment_intent?: string | undefined + starting_after?: string | undefined + transfer_group?: string | undefined +} + +export type t_GetChargesRequestBodySchema = EmptyObject + +export type t_GetChargesChargeParamSchema = { + charge: string +} + +export type t_GetChargesChargeQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetChargesChargeRequestBodySchema = EmptyObject + +export type t_GetChargesChargeDisputeParamSchema = { + charge: string +} + +export type t_GetChargesChargeDisputeQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetChargesChargeDisputeRequestBodySchema = EmptyObject + +export type t_GetChargesChargeRefundsParamSchema = { + charge: string +} + +export type t_GetChargesChargeRefundsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetChargesChargeRefundsRequestBodySchema = EmptyObject + +export type t_GetChargesChargeRefundsRefundParamSchema = { + charge: string + refund: string +} + +export type t_GetChargesChargeRefundsRefundQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetChargesChargeRefundsRefundRequestBodySchema = EmptyObject + +export type t_GetChargesSearchQuerySchema = { + expand?: string[] | undefined + limit?: number | undefined + page?: string | undefined + query: string +} + +export type t_GetChargesSearchRequestBodySchema = EmptyObject + +export type t_GetCheckoutSessionsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + customer_details?: + | { + email: string + } + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + payment_intent?: string | undefined + payment_link?: string | undefined + starting_after?: string | undefined + status?: ("complete" | "expired" | "open") | undefined + subscription?: string | undefined +} + +export type t_GetCheckoutSessionsRequestBodySchema = EmptyObject + +export type t_GetCheckoutSessionsSessionParamSchema = { + session: string +} + +export type t_GetCheckoutSessionsSessionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCheckoutSessionsSessionRequestBodySchema = EmptyObject + +export type t_GetCheckoutSessionsSessionLineItemsParamSchema = { + session: string +} + +export type t_GetCheckoutSessionsSessionLineItemsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCheckoutSessionsSessionLineItemsRequestBodySchema = EmptyObject + +export type t_GetClimateOrdersQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetClimateOrdersRequestBodySchema = EmptyObject + +export type t_GetClimateOrdersOrderParamSchema = { + order: string +} + +export type t_GetClimateOrdersOrderQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetClimateOrdersOrderRequestBodySchema = EmptyObject + +export type t_GetClimateProductsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetClimateProductsRequestBodySchema = EmptyObject + +export type t_GetClimateProductsProductParamSchema = { + product: string +} + +export type t_GetClimateProductsProductQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetClimateProductsProductRequestBodySchema = EmptyObject + +export type t_GetClimateSuppliersQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetClimateSuppliersRequestBodySchema = EmptyObject + +export type t_GetClimateSuppliersSupplierParamSchema = { + supplier: string +} + +export type t_GetClimateSuppliersSupplierQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetClimateSuppliersSupplierRequestBodySchema = EmptyObject + +export type t_GetConfirmationTokensConfirmationTokenParamSchema = { + confirmation_token: string +} + +export type t_GetConfirmationTokensConfirmationTokenQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetConfirmationTokensConfirmationTokenRequestBodySchema = + EmptyObject + +export type t_GetCountrySpecsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCountrySpecsRequestBodySchema = EmptyObject + +export type t_GetCountrySpecsCountryParamSchema = { + country: string +} + +export type t_GetCountrySpecsCountryQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCountrySpecsCountryRequestBodySchema = EmptyObject + +export type t_GetCouponsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCouponsRequestBodySchema = EmptyObject + +export type t_GetCouponsCouponParamSchema = { + coupon: string +} + +export type t_GetCouponsCouponQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCouponsCouponRequestBodySchema = EmptyObject + +export type t_GetCreditNotesQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + invoice?: string | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCreditNotesRequestBodySchema = EmptyObject + +export type t_GetCreditNotesCreditNoteLinesParamSchema = { + credit_note: string +} + +export type t_GetCreditNotesCreditNoteLinesQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCreditNotesCreditNoteLinesRequestBodySchema = EmptyObject + +export type t_GetCreditNotesIdParamSchema = { + id: string +} + +export type t_GetCreditNotesIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCreditNotesIdRequestBodySchema = EmptyObject + +export type t_GetCreditNotesPreviewQuerySchema = { + amount?: number | undefined + credit_amount?: number | undefined + effective_at?: number | undefined + email_type?: ("credit_note" | "none") | undefined + expand?: string[] | undefined + invoice: string + lines?: + | { + amount?: number | undefined + description?: string | undefined + invoice_line_item?: string | undefined + quantity?: number | undefined + tax_amounts?: + | ( + | { + amount: number + tax_rate: string + taxable_amount: number + }[] + | "" + ) + | undefined + tax_rates?: (string[] | "") | undefined + type: "custom_line_item" | "invoice_line_item" + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + }[] + | undefined + memo?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + out_of_band_amount?: number | undefined + reason?: + | ("duplicate" | "fraudulent" | "order_change" | "product_unsatisfactory") + | undefined + refund_amount?: number | undefined + refunds?: + | { + amount_refunded?: number | undefined + refund?: string | undefined + }[] + | undefined + shipping_cost?: + | { + shipping_rate?: string | undefined + } + | undefined +} + +export type t_GetCreditNotesPreviewRequestBodySchema = EmptyObject + +export type t_GetCreditNotesPreviewLinesQuerySchema = { + amount?: number | undefined + credit_amount?: number | undefined + effective_at?: number | undefined + email_type?: ("credit_note" | "none") | undefined + ending_before?: string | undefined + expand?: string[] | undefined + invoice: string + limit?: number | undefined + lines?: + | { + amount?: number | undefined + description?: string | undefined + invoice_line_item?: string | undefined + quantity?: number | undefined + tax_amounts?: + | ( + | { + amount: number + tax_rate: string + taxable_amount: number + }[] + | "" + ) + | undefined + tax_rates?: (string[] | "") | undefined + type: "custom_line_item" | "invoice_line_item" + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + }[] + | undefined + memo?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + out_of_band_amount?: number | undefined + reason?: + | ("duplicate" | "fraudulent" | "order_change" | "product_unsatisfactory") + | undefined + refund_amount?: number | undefined + refunds?: + | { + amount_refunded?: number | undefined + refund?: string | undefined + }[] + | undefined + shipping_cost?: + | { + shipping_rate?: string | undefined + } + | undefined + starting_after?: string | undefined +} + +export type t_GetCreditNotesPreviewLinesRequestBodySchema = EmptyObject + +export type t_GetCustomersQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + email?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + test_clock?: string | undefined +} + +export type t_GetCustomersRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerBalanceTransactionsParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerBalanceTransactionsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCustomersCustomerBalanceTransactionsRequestBodySchema = + EmptyObject + +export type t_GetCustomersCustomerBalanceTransactionsTransactionParamSchema = { + customer: string + transaction: string +} + +export type t_GetCustomersCustomerBalanceTransactionsTransactionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerBalanceTransactionsTransactionRequestBodySchema = + EmptyObject + +export type t_GetCustomersCustomerBankAccountsParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerBankAccountsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCustomersCustomerBankAccountsRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerBankAccountsIdParamSchema = { + customer: string + id: string +} + +export type t_GetCustomersCustomerBankAccountsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerBankAccountsIdRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerCardsParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerCardsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCustomersCustomerCardsRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerCardsIdParamSchema = { + customer: string + id: string +} + +export type t_GetCustomersCustomerCardsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerCardsIdRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerCashBalanceParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerCashBalanceQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerCashBalanceRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerCashBalanceTransactionsParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerCashBalanceTransactionsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCustomersCustomerCashBalanceTransactionsRequestBodySchema = + EmptyObject + +export type t_GetCustomersCustomerCashBalanceTransactionsTransactionParamSchema = + { + customer: string + transaction: string + } + +export type t_GetCustomersCustomerCashBalanceTransactionsTransactionQuerySchema = + { + expand?: string[] | undefined + } + +export type t_GetCustomersCustomerCashBalanceTransactionsTransactionRequestBodySchema = + EmptyObject + +export type t_GetCustomersCustomerDiscountParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerDiscountQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerDiscountRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerPaymentMethodsParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerPaymentMethodsQuerySchema = { + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + type?: + | ( + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + ) + | undefined +} + +export type t_GetCustomersCustomerPaymentMethodsRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerPaymentMethodsPaymentMethodParamSchema = { + customer: string + payment_method: string +} + +export type t_GetCustomersCustomerPaymentMethodsPaymentMethodQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerPaymentMethodsPaymentMethodRequestBodySchema = + EmptyObject + +export type t_GetCustomersCustomerSourcesParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerSourcesQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + object?: string | undefined + starting_after?: string | undefined +} + +export type t_GetCustomersCustomerSourcesRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerSourcesIdParamSchema = { + customer: string + id: string +} + +export type t_GetCustomersCustomerSourcesIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerSourcesIdRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerSubscriptionsParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerSubscriptionsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCustomersCustomerSubscriptionsRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema = + { + customer: string + subscription_exposed_id: string + } + +export type t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdQuerySchema = + { + expand?: string[] | undefined + } + +export type t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema = + EmptyObject + +export type t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountParamSchema = + { + customer: string + subscription_exposed_id: string + } + +export type t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountQuerySchema = + { + expand?: string[] | undefined + } + +export type t_GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscountRequestBodySchema = + EmptyObject + +export type t_GetCustomersCustomerTaxIdsParamSchema = { + customer: string +} + +export type t_GetCustomersCustomerTaxIdsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetCustomersCustomerTaxIdsRequestBodySchema = EmptyObject + +export type t_GetCustomersCustomerTaxIdsIdParamSchema = { + customer: string + id: string +} + +export type t_GetCustomersCustomerTaxIdsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetCustomersCustomerTaxIdsIdRequestBodySchema = EmptyObject + +export type t_GetCustomersSearchQuerySchema = { + expand?: string[] | undefined + limit?: number | undefined + page?: string | undefined + query: string +} + +export type t_GetCustomersSearchRequestBodySchema = EmptyObject + +export type t_GetDisputesQuerySchema = { + charge?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + payment_intent?: string | undefined + starting_after?: string | undefined +} + +export type t_GetDisputesRequestBodySchema = EmptyObject + +export type t_GetDisputesDisputeParamSchema = { + dispute: string +} + +export type t_GetDisputesDisputeQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetDisputesDisputeRequestBodySchema = EmptyObject + +export type t_GetEntitlementsActiveEntitlementsQuerySchema = { + customer: string + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetEntitlementsActiveEntitlementsRequestBodySchema = EmptyObject + +export type t_GetEntitlementsActiveEntitlementsIdParamSchema = { + id: string +} + +export type t_GetEntitlementsActiveEntitlementsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetEntitlementsActiveEntitlementsIdRequestBodySchema = EmptyObject + +export type t_GetEntitlementsFeaturesQuerySchema = { + archived?: boolean | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + lookup_key?: string | undefined + starting_after?: string | undefined +} + +export type t_GetEntitlementsFeaturesRequestBodySchema = EmptyObject + +export type t_GetEntitlementsFeaturesIdParamSchema = { + id: string +} + +export type t_GetEntitlementsFeaturesIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetEntitlementsFeaturesIdRequestBodySchema = EmptyObject + +export type t_GetEventsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + delivery_success?: boolean | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + type?: string | undefined + types?: string[] | undefined +} + +export type t_GetEventsRequestBodySchema = EmptyObject + +export type t_GetEventsIdParamSchema = { + id: string +} + +export type t_GetEventsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetEventsIdRequestBodySchema = EmptyObject + +export type t_GetExchangeRatesQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetExchangeRatesRequestBodySchema = EmptyObject + +export type t_GetExchangeRatesRateIdParamSchema = { + rate_id: string +} + +export type t_GetExchangeRatesRateIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetExchangeRatesRateIdRequestBodySchema = EmptyObject + +export type t_GetFileLinksQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + expired?: boolean | undefined + file?: string | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetFileLinksRequestBodySchema = EmptyObject + +export type t_GetFileLinksLinkParamSchema = { + link: string +} + +export type t_GetFileLinksLinkQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetFileLinksLinkRequestBodySchema = EmptyObject + +export type t_GetFilesQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + purpose?: + | ( + | "account_requirement" + | "additional_verification" + | "business_icon" + | "business_logo" + | "customer_signature" + | "dispute_evidence" + | "document_provider_identity_document" + | "finance_report_run" + | "financial_account_statement" + | "identity_document" + | "identity_document_downloadable" + | "issuing_regulatory_reporting" + | "pci_document" + | "selfie" + | "sigma_scheduled_query" + | "tax_document_user_upload" + | "terminal_reader_splashscreen" + ) + | undefined + starting_after?: string | undefined +} + +export type t_GetFilesRequestBodySchema = EmptyObject + +export type t_GetFilesFileParamSchema = { + file: string +} + +export type t_GetFilesFileQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetFilesFileRequestBodySchema = EmptyObject + +export type t_GetFinancialConnectionsAccountsQuerySchema = { + account_holder?: + | { + account?: string | undefined + customer?: string | undefined + } + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + session?: string | undefined + starting_after?: string | undefined +} + +export type t_GetFinancialConnectionsAccountsRequestBodySchema = EmptyObject + +export type t_GetFinancialConnectionsAccountsAccountParamSchema = { + account: string +} + +export type t_GetFinancialConnectionsAccountsAccountQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetFinancialConnectionsAccountsAccountRequestBodySchema = + EmptyObject + +export type t_GetFinancialConnectionsAccountsAccountOwnersParamSchema = { + account: string +} + +export type t_GetFinancialConnectionsAccountsAccountOwnersQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + ownership: string + starting_after?: string | undefined +} + +export type t_GetFinancialConnectionsAccountsAccountOwnersRequestBodySchema = + EmptyObject + +export type t_GetFinancialConnectionsSessionsSessionParamSchema = { + session: string +} + +export type t_GetFinancialConnectionsSessionsSessionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetFinancialConnectionsSessionsSessionRequestBodySchema = + EmptyObject + +export type t_GetFinancialConnectionsTransactionsQuerySchema = { + account: string + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + transacted_at?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + transaction_refresh?: + | { + after: string + } + | undefined +} + +export type t_GetFinancialConnectionsTransactionsRequestBodySchema = EmptyObject + +export type t_GetFinancialConnectionsTransactionsTransactionParamSchema = { + transaction: string +} + +export type t_GetFinancialConnectionsTransactionsTransactionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetFinancialConnectionsTransactionsTransactionRequestBodySchema = + EmptyObject + +export type t_GetForwardingRequestsQuerySchema = { + created?: + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetForwardingRequestsRequestBodySchema = EmptyObject + +export type t_GetForwardingRequestsIdParamSchema = { + id: string +} + +export type t_GetForwardingRequestsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetForwardingRequestsIdRequestBodySchema = EmptyObject + +export type t_GetIdentityVerificationReportsQuerySchema = { + client_reference_id?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + type?: ("document" | "id_number") | undefined + verification_session?: string | undefined +} + +export type t_GetIdentityVerificationReportsRequestBodySchema = EmptyObject + +export type t_GetIdentityVerificationReportsReportParamSchema = { + report: string +} + +export type t_GetIdentityVerificationReportsReportQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIdentityVerificationReportsReportRequestBodySchema = + EmptyObject + +export type t_GetIdentityVerificationSessionsQuerySchema = { + client_reference_id?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + related_customer?: string | undefined + starting_after?: string | undefined + status?: + | ("canceled" | "processing" | "requires_input" | "verified") + | undefined +} + +export type t_GetIdentityVerificationSessionsRequestBodySchema = EmptyObject + +export type t_GetIdentityVerificationSessionsSessionParamSchema = { + session: string +} + +export type t_GetIdentityVerificationSessionsSessionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIdentityVerificationSessionsSessionRequestBodySchema = + EmptyObject + +export type t_GetInvoicePaymentsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + invoice?: string | undefined + limit?: number | undefined + payment?: + | { + payment_intent?: string | undefined + type: "payment_intent" + } + | undefined + starting_after?: string | undefined + status?: ("canceled" | "open" | "paid") | undefined +} + +export type t_GetInvoicePaymentsRequestBodySchema = EmptyObject + +export type t_GetInvoicePaymentsInvoicePaymentParamSchema = { + invoice_payment: string +} + +export type t_GetInvoicePaymentsInvoicePaymentQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetInvoicePaymentsInvoicePaymentRequestBodySchema = EmptyObject + +export type t_GetInvoiceRenderingTemplatesQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("active" | "archived") | undefined +} + +export type t_GetInvoiceRenderingTemplatesRequestBodySchema = EmptyObject + +export type t_GetInvoiceRenderingTemplatesTemplateParamSchema = { + template: string +} + +export type t_GetInvoiceRenderingTemplatesTemplateQuerySchema = { + expand?: string[] | undefined + version?: number | undefined +} + +export type t_GetInvoiceRenderingTemplatesTemplateRequestBodySchema = + EmptyObject + +export type t_GetInvoiceitemsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + invoice?: string | undefined + limit?: number | undefined + pending?: boolean | undefined + starting_after?: string | undefined +} + +export type t_GetInvoiceitemsRequestBodySchema = EmptyObject + +export type t_GetInvoiceitemsInvoiceitemParamSchema = { + invoiceitem: string +} + +export type t_GetInvoiceitemsInvoiceitemQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetInvoiceitemsInvoiceitemRequestBodySchema = EmptyObject + +export type t_GetInvoicesQuerySchema = { + collection_method?: ("charge_automatically" | "send_invoice") | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + due_date?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("draft" | "open" | "paid" | "uncollectible" | "void") | undefined + subscription?: string | undefined +} + +export type t_GetInvoicesRequestBodySchema = EmptyObject + +export type t_GetInvoicesInvoiceParamSchema = { + invoice: string +} + +export type t_GetInvoicesInvoiceQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetInvoicesInvoiceRequestBodySchema = EmptyObject + +export type t_GetInvoicesInvoiceLinesParamSchema = { + invoice: string +} + +export type t_GetInvoicesInvoiceLinesQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetInvoicesInvoiceLinesRequestBodySchema = EmptyObject + +export type t_GetInvoicesSearchQuerySchema = { + expand?: string[] | undefined + limit?: number | undefined + page?: string | undefined + query: string +} + +export type t_GetInvoicesSearchRequestBodySchema = EmptyObject + +export type t_GetIssuingAuthorizationsQuerySchema = { + card?: string | undefined + cardholder?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("closed" | "expired" | "pending" | "reversed") | undefined +} + +export type t_GetIssuingAuthorizationsRequestBodySchema = EmptyObject + +export type t_GetIssuingAuthorizationsAuthorizationParamSchema = { + authorization: string +} + +export type t_GetIssuingAuthorizationsAuthorizationQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIssuingAuthorizationsAuthorizationRequestBodySchema = + EmptyObject + +export type t_GetIssuingCardholdersQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + email?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + phone_number?: string | undefined + starting_after?: string | undefined + status?: ("active" | "blocked" | "inactive") | undefined + type?: ("company" | "individual") | undefined +} + +export type t_GetIssuingCardholdersRequestBodySchema = EmptyObject + +export type t_GetIssuingCardholdersCardholderParamSchema = { + cardholder: string +} + +export type t_GetIssuingCardholdersCardholderQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIssuingCardholdersCardholderRequestBodySchema = EmptyObject + +export type t_GetIssuingCardsQuerySchema = { + cardholder?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + exp_month?: number | undefined + exp_year?: number | undefined + expand?: string[] | undefined + last4?: string | undefined + limit?: number | undefined + personalization_design?: string | undefined + starting_after?: string | undefined + status?: ("active" | "canceled" | "inactive") | undefined + type?: ("physical" | "virtual") | undefined +} + +export type t_GetIssuingCardsRequestBodySchema = EmptyObject + +export type t_GetIssuingCardsCardParamSchema = { + card: string +} + +export type t_GetIssuingCardsCardQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIssuingCardsCardRequestBodySchema = EmptyObject + +export type t_GetIssuingDisputesQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: + | ("expired" | "lost" | "submitted" | "unsubmitted" | "won") + | undefined + transaction?: string | undefined +} + +export type t_GetIssuingDisputesRequestBodySchema = EmptyObject + +export type t_GetIssuingDisputesDisputeParamSchema = { + dispute: string +} + +export type t_GetIssuingDisputesDisputeQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIssuingDisputesDisputeRequestBodySchema = EmptyObject + +export type t_GetIssuingPersonalizationDesignsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + lookup_keys?: string[] | undefined + preferences?: + | { + is_default?: boolean | undefined + is_platform_default?: boolean | undefined + } + | undefined + starting_after?: string | undefined + status?: ("active" | "inactive" | "rejected" | "review") | undefined +} + +export type t_GetIssuingPersonalizationDesignsRequestBodySchema = EmptyObject + +export type t_GetIssuingPersonalizationDesignsPersonalizationDesignParamSchema = + { + personalization_design: string + } + +export type t_GetIssuingPersonalizationDesignsPersonalizationDesignQuerySchema = + { + expand?: string[] | undefined + } + +export type t_GetIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema = + EmptyObject + +export type t_GetIssuingPhysicalBundlesQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("active" | "inactive" | "review") | undefined + type?: ("custom" | "standard") | undefined +} + +export type t_GetIssuingPhysicalBundlesRequestBodySchema = EmptyObject + +export type t_GetIssuingPhysicalBundlesPhysicalBundleParamSchema = { + physical_bundle: string +} + +export type t_GetIssuingPhysicalBundlesPhysicalBundleQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIssuingPhysicalBundlesPhysicalBundleRequestBodySchema = + EmptyObject + +export type t_GetIssuingSettlementsSettlementParamSchema = { + settlement: string +} + +export type t_GetIssuingSettlementsSettlementQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIssuingSettlementsSettlementRequestBodySchema = EmptyObject + +export type t_GetIssuingTokensQuerySchema = { + card: string + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("active" | "deleted" | "requested" | "suspended") | undefined +} + +export type t_GetIssuingTokensRequestBodySchema = EmptyObject + +export type t_GetIssuingTokensTokenParamSchema = { + token: string +} + +export type t_GetIssuingTokensTokenQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIssuingTokensTokenRequestBodySchema = EmptyObject + +export type t_GetIssuingTransactionsQuerySchema = { + card?: string | undefined + cardholder?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + type?: ("capture" | "refund") | undefined +} + +export type t_GetIssuingTransactionsRequestBodySchema = EmptyObject + +export type t_GetIssuingTransactionsTransactionParamSchema = { + transaction: string +} + +export type t_GetIssuingTransactionsTransactionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetIssuingTransactionsTransactionRequestBodySchema = EmptyObject + +export type t_GetLinkAccountSessionsSessionParamSchema = { + session: string +} + +export type t_GetLinkAccountSessionsSessionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetLinkAccountSessionsSessionRequestBodySchema = EmptyObject + +export type t_GetLinkedAccountsQuerySchema = { + account_holder?: + | { + account?: string | undefined + customer?: string | undefined + } + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + session?: string | undefined + starting_after?: string | undefined +} + +export type t_GetLinkedAccountsRequestBodySchema = EmptyObject + +export type t_GetLinkedAccountsAccountParamSchema = { + account: string +} + +export type t_GetLinkedAccountsAccountQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetLinkedAccountsAccountRequestBodySchema = EmptyObject + +export type t_GetLinkedAccountsAccountOwnersParamSchema = { + account: string +} + +export type t_GetLinkedAccountsAccountOwnersQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + ownership: string + starting_after?: string | undefined +} + +export type t_GetLinkedAccountsAccountOwnersRequestBodySchema = EmptyObject + +export type t_GetMandatesMandateParamSchema = { + mandate: string +} + +export type t_GetMandatesMandateQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetMandatesMandateRequestBodySchema = EmptyObject + +export type t_GetPaymentIntentsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetPaymentIntentsRequestBodySchema = EmptyObject + +export type t_GetPaymentIntentsIntentParamSchema = { + intent: string +} + +export type t_GetPaymentIntentsIntentQuerySchema = { + client_secret?: string | undefined + expand?: string[] | undefined +} + +export type t_GetPaymentIntentsIntentRequestBodySchema = EmptyObject + +export type t_GetPaymentIntentsSearchQuerySchema = { + expand?: string[] | undefined + limit?: number | undefined + page?: string | undefined + query: string +} + +export type t_GetPaymentIntentsSearchRequestBodySchema = EmptyObject + +export type t_GetPaymentLinksQuerySchema = { + active?: boolean | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetPaymentLinksRequestBodySchema = EmptyObject + +export type t_GetPaymentLinksPaymentLinkParamSchema = { + payment_link: string +} + +export type t_GetPaymentLinksPaymentLinkQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetPaymentLinksPaymentLinkRequestBodySchema = EmptyObject + +export type t_GetPaymentLinksPaymentLinkLineItemsParamSchema = { + payment_link: string +} + +export type t_GetPaymentLinksPaymentLinkLineItemsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetPaymentLinksPaymentLinkLineItemsRequestBodySchema = EmptyObject + +export type t_GetPaymentMethodConfigurationsQuerySchema = { + application?: (string | "") | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetPaymentMethodConfigurationsRequestBodySchema = EmptyObject + +export type t_GetPaymentMethodConfigurationsConfigurationParamSchema = { + configuration: string +} + +export type t_GetPaymentMethodConfigurationsConfigurationQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetPaymentMethodConfigurationsConfigurationRequestBodySchema = + EmptyObject + +export type t_GetPaymentMethodDomainsQuerySchema = { + domain_name?: string | undefined + enabled?: boolean | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetPaymentMethodDomainsRequestBodySchema = EmptyObject + +export type t_GetPaymentMethodDomainsPaymentMethodDomainParamSchema = { + payment_method_domain: string +} + +export type t_GetPaymentMethodDomainsPaymentMethodDomainQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetPaymentMethodDomainsPaymentMethodDomainRequestBodySchema = + EmptyObject + +export type t_GetPaymentMethodsQuerySchema = { + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + type?: + | ( + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + ) + | undefined +} + +export type t_GetPaymentMethodsRequestBodySchema = EmptyObject + +export type t_GetPaymentMethodsPaymentMethodParamSchema = { + payment_method: string +} + +export type t_GetPaymentMethodsPaymentMethodQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetPaymentMethodsPaymentMethodRequestBodySchema = EmptyObject + +export type t_GetPayoutsQuerySchema = { + arrival_date?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + destination?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: string | undefined +} + +export type t_GetPayoutsRequestBodySchema = EmptyObject + +export type t_GetPayoutsPayoutParamSchema = { + payout: string +} + +export type t_GetPayoutsPayoutQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetPayoutsPayoutRequestBodySchema = EmptyObject + +export type t_GetPlansQuerySchema = { + active?: boolean | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + product?: string | undefined + starting_after?: string | undefined +} + +export type t_GetPlansRequestBodySchema = EmptyObject + +export type t_GetPlansPlanParamSchema = { + plan: string +} + +export type t_GetPlansPlanQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetPlansPlanRequestBodySchema = EmptyObject + +export type t_GetPricesQuerySchema = { + active?: boolean | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + currency?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + lookup_keys?: string[] | undefined + product?: string | undefined + recurring?: + | { + interval?: ("day" | "month" | "week" | "year") | undefined + meter?: string | undefined + usage_type?: ("licensed" | "metered") | undefined + } + | undefined + starting_after?: string | undefined + type?: ("one_time" | "recurring") | undefined +} + +export type t_GetPricesRequestBodySchema = EmptyObject + +export type t_GetPricesPriceParamSchema = { + price: string +} + +export type t_GetPricesPriceQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetPricesPriceRequestBodySchema = EmptyObject + +export type t_GetPricesSearchQuerySchema = { + expand?: string[] | undefined + limit?: number | undefined + page?: string | undefined + query: string +} + +export type t_GetPricesSearchRequestBodySchema = EmptyObject + +export type t_GetProductsQuerySchema = { + active?: boolean | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + ids?: string[] | undefined + limit?: number | undefined + shippable?: boolean | undefined + starting_after?: string | undefined + url?: string | undefined +} + +export type t_GetProductsRequestBodySchema = EmptyObject + +export type t_GetProductsIdParamSchema = { + id: string +} + +export type t_GetProductsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetProductsIdRequestBodySchema = EmptyObject + +export type t_GetProductsProductFeaturesParamSchema = { + product: string +} + +export type t_GetProductsProductFeaturesQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetProductsProductFeaturesRequestBodySchema = EmptyObject + +export type t_GetProductsProductFeaturesIdParamSchema = { + id: string + product: string +} + +export type t_GetProductsProductFeaturesIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetProductsProductFeaturesIdRequestBodySchema = EmptyObject + +export type t_GetProductsSearchQuerySchema = { + expand?: string[] | undefined + limit?: number | undefined + page?: string | undefined + query: string +} + +export type t_GetProductsSearchRequestBodySchema = EmptyObject + +export type t_GetPromotionCodesQuerySchema = { + active?: boolean | undefined + code?: string | undefined + coupon?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetPromotionCodesRequestBodySchema = EmptyObject + +export type t_GetPromotionCodesPromotionCodeParamSchema = { + promotion_code: string +} + +export type t_GetPromotionCodesPromotionCodeQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetPromotionCodesPromotionCodeRequestBodySchema = EmptyObject + +export type t_GetQuotesQuerySchema = { + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("accepted" | "canceled" | "draft" | "open") | undefined + test_clock?: string | undefined +} + +export type t_GetQuotesRequestBodySchema = EmptyObject + +export type t_GetQuotesQuoteParamSchema = { + quote: string +} + +export type t_GetQuotesQuoteQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetQuotesQuoteRequestBodySchema = EmptyObject + +export type t_GetQuotesQuoteComputedUpfrontLineItemsParamSchema = { + quote: string +} + +export type t_GetQuotesQuoteComputedUpfrontLineItemsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetQuotesQuoteComputedUpfrontLineItemsRequestBodySchema = + EmptyObject + +export type t_GetQuotesQuoteLineItemsParamSchema = { + quote: string +} + +export type t_GetQuotesQuoteLineItemsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetQuotesQuoteLineItemsRequestBodySchema = EmptyObject + +export type t_GetQuotesQuotePdfParamSchema = { + quote: string +} + +export type t_GetQuotesQuotePdfQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetQuotesQuotePdfRequestBodySchema = EmptyObject + +export type t_GetRadarEarlyFraudWarningsQuerySchema = { + charge?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + payment_intent?: string | undefined + starting_after?: string | undefined +} + +export type t_GetRadarEarlyFraudWarningsRequestBodySchema = EmptyObject + +export type t_GetRadarEarlyFraudWarningsEarlyFraudWarningParamSchema = { + early_fraud_warning: string +} + +export type t_GetRadarEarlyFraudWarningsEarlyFraudWarningQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetRadarEarlyFraudWarningsEarlyFraudWarningRequestBodySchema = + EmptyObject + +export type t_GetRadarValueListItemsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + value?: string | undefined + value_list: string +} + +export type t_GetRadarValueListItemsRequestBodySchema = EmptyObject + +export type t_GetRadarValueListItemsItemParamSchema = { + item: string +} + +export type t_GetRadarValueListItemsItemQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetRadarValueListItemsItemRequestBodySchema = EmptyObject + +export type t_GetRadarValueListsQuerySchema = { + alias?: string | undefined + contains?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetRadarValueListsRequestBodySchema = EmptyObject + +export type t_GetRadarValueListsValueListParamSchema = { + value_list: string +} + +export type t_GetRadarValueListsValueListQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetRadarValueListsValueListRequestBodySchema = EmptyObject + +export type t_GetRefundsQuerySchema = { + charge?: string | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + payment_intent?: string | undefined + starting_after?: string | undefined +} + +export type t_GetRefundsRequestBodySchema = EmptyObject + +export type t_GetRefundsRefundParamSchema = { + refund: string +} + +export type t_GetRefundsRefundQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetRefundsRefundRequestBodySchema = EmptyObject + +export type t_GetReportingReportRunsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetReportingReportRunsRequestBodySchema = EmptyObject + +export type t_GetReportingReportRunsReportRunParamSchema = { + report_run: string +} + +export type t_GetReportingReportRunsReportRunQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetReportingReportRunsReportRunRequestBodySchema = EmptyObject + +export type t_GetReportingReportTypesQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetReportingReportTypesRequestBodySchema = EmptyObject + +export type t_GetReportingReportTypesReportTypeParamSchema = { + report_type: string +} + +export type t_GetReportingReportTypesReportTypeQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetReportingReportTypesReportTypeRequestBodySchema = EmptyObject + +export type t_GetReviewsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetReviewsRequestBodySchema = EmptyObject + +export type t_GetReviewsReviewParamSchema = { + review: string +} + +export type t_GetReviewsReviewQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetReviewsReviewRequestBodySchema = EmptyObject + +export type t_GetSetupAttemptsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + setup_intent: string + starting_after?: string | undefined +} + +export type t_GetSetupAttemptsRequestBodySchema = EmptyObject + +export type t_GetSetupIntentsQuerySchema = { + attach_to_self?: boolean | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + payment_method?: string | undefined + starting_after?: string | undefined +} + +export type t_GetSetupIntentsRequestBodySchema = EmptyObject + +export type t_GetSetupIntentsIntentParamSchema = { + intent: string +} + +export type t_GetSetupIntentsIntentQuerySchema = { + client_secret?: string | undefined + expand?: string[] | undefined +} + +export type t_GetSetupIntentsIntentRequestBodySchema = EmptyObject + +export type t_GetShippingRatesQuerySchema = { + active?: boolean | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + currency?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetShippingRatesRequestBodySchema = EmptyObject + +export type t_GetShippingRatesShippingRateTokenParamSchema = { + shipping_rate_token: string +} + +export type t_GetShippingRatesShippingRateTokenQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetShippingRatesShippingRateTokenRequestBodySchema = EmptyObject + +export type t_GetSigmaScheduledQueryRunsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetSigmaScheduledQueryRunsRequestBodySchema = EmptyObject + +export type t_GetSigmaScheduledQueryRunsScheduledQueryRunParamSchema = { + scheduled_query_run: string +} + +export type t_GetSigmaScheduledQueryRunsScheduledQueryRunQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetSigmaScheduledQueryRunsScheduledQueryRunRequestBodySchema = + EmptyObject + +export type t_GetSourcesSourceParamSchema = { + source: string +} + +export type t_GetSourcesSourceQuerySchema = { + client_secret?: string | undefined + expand?: string[] | undefined +} + +export type t_GetSourcesSourceRequestBodySchema = EmptyObject + +export type t_GetSourcesSourceMandateNotificationsMandateNotificationParamSchema = + { + mandate_notification: string + source: string + } + +export type t_GetSourcesSourceMandateNotificationsMandateNotificationQuerySchema = + { + expand?: string[] | undefined + } + +export type t_GetSourcesSourceMandateNotificationsMandateNotificationRequestBodySchema = + EmptyObject + +export type t_GetSourcesSourceSourceTransactionsParamSchema = { + source: string +} + +export type t_GetSourcesSourceSourceTransactionsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetSourcesSourceSourceTransactionsRequestBodySchema = EmptyObject + +export type t_GetSourcesSourceSourceTransactionsSourceTransactionParamSchema = { + source: string + source_transaction: string +} + +export type t_GetSourcesSourceSourceTransactionsSourceTransactionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetSourcesSourceSourceTransactionsSourceTransactionRequestBodySchema = + EmptyObject + +export type t_GetSubscriptionItemsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + subscription: string +} + +export type t_GetSubscriptionItemsRequestBodySchema = EmptyObject + +export type t_GetSubscriptionItemsItemParamSchema = { + item: string +} + +export type t_GetSubscriptionItemsItemQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetSubscriptionItemsItemRequestBodySchema = EmptyObject + +export type t_GetSubscriptionSchedulesQuerySchema = { + canceled_at?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + completed_at?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + released_at?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + scheduled?: boolean | undefined + starting_after?: string | undefined +} + +export type t_GetSubscriptionSchedulesRequestBodySchema = EmptyObject + +export type t_GetSubscriptionSchedulesScheduleParamSchema = { + schedule: string +} + +export type t_GetSubscriptionSchedulesScheduleQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetSubscriptionSchedulesScheduleRequestBodySchema = EmptyObject + +export type t_GetSubscriptionsQuerySchema = { + automatic_tax?: + | { + enabled: boolean + } + | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + current_period_end?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + current_period_start?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + price?: string | undefined + starting_after?: string | undefined + status?: + | ( + | "active" + | "all" + | "canceled" + | "ended" + | "incomplete" + | "incomplete_expired" + | "past_due" + | "paused" + | "trialing" + | "unpaid" + ) + | undefined + test_clock?: string | undefined +} + +export type t_GetSubscriptionsRequestBodySchema = EmptyObject + +export type t_GetSubscriptionsSearchQuerySchema = { + expand?: string[] | undefined + limit?: number | undefined + page?: string | undefined + query: string +} + +export type t_GetSubscriptionsSearchRequestBodySchema = EmptyObject + +export type t_GetSubscriptionsSubscriptionExposedIdParamSchema = { + subscription_exposed_id: string +} + +export type t_GetSubscriptionsSubscriptionExposedIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetSubscriptionsSubscriptionExposedIdRequestBodySchema = + EmptyObject + +export type t_GetTaxCalculationsCalculationParamSchema = { + calculation: string +} + +export type t_GetTaxCalculationsCalculationQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTaxCalculationsCalculationRequestBodySchema = EmptyObject + +export type t_GetTaxCalculationsCalculationLineItemsParamSchema = { + calculation: string +} + +export type t_GetTaxCalculationsCalculationLineItemsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTaxCalculationsCalculationLineItemsRequestBodySchema = + EmptyObject + +export type t_GetTaxCodesQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTaxCodesRequestBodySchema = EmptyObject + +export type t_GetTaxCodesIdParamSchema = { + id: string +} + +export type t_GetTaxCodesIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTaxCodesIdRequestBodySchema = EmptyObject + +export type t_GetTaxIdsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + owner?: + | { + account?: string | undefined + customer?: string | undefined + type: "account" | "application" | "customer" | "self" + } + | undefined + starting_after?: string | undefined +} + +export type t_GetTaxIdsRequestBodySchema = EmptyObject + +export type t_GetTaxIdsIdParamSchema = { + id: string +} + +export type t_GetTaxIdsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTaxIdsIdRequestBodySchema = EmptyObject + +export type t_GetTaxRatesQuerySchema = { + active?: boolean | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + inclusive?: boolean | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTaxRatesRequestBodySchema = EmptyObject + +export type t_GetTaxRatesTaxRateParamSchema = { + tax_rate: string +} + +export type t_GetTaxRatesTaxRateQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTaxRatesTaxRateRequestBodySchema = EmptyObject + +export type t_GetTaxRegistrationsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("active" | "all" | "expired" | "scheduled") | undefined +} + +export type t_GetTaxRegistrationsRequestBodySchema = EmptyObject + +export type t_GetTaxRegistrationsIdParamSchema = { + id: string +} + +export type t_GetTaxRegistrationsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTaxRegistrationsIdRequestBodySchema = EmptyObject + +export type t_GetTaxSettingsQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTaxSettingsRequestBodySchema = EmptyObject + +export type t_GetTaxTransactionsTransactionParamSchema = { + transaction: string +} + +export type t_GetTaxTransactionsTransactionQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTaxTransactionsTransactionRequestBodySchema = EmptyObject + +export type t_GetTaxTransactionsTransactionLineItemsParamSchema = { + transaction: string +} + +export type t_GetTaxTransactionsTransactionLineItemsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTaxTransactionsTransactionLineItemsRequestBodySchema = + EmptyObject + +export type t_GetTerminalConfigurationsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + is_account_default?: boolean | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTerminalConfigurationsRequestBodySchema = EmptyObject + +export type t_GetTerminalConfigurationsConfigurationParamSchema = { + configuration: string +} + +export type t_GetTerminalConfigurationsConfigurationQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTerminalConfigurationsConfigurationRequestBodySchema = + EmptyObject + +export type t_GetTerminalLocationsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTerminalLocationsRequestBodySchema = EmptyObject + +export type t_GetTerminalLocationsLocationParamSchema = { + location: string +} + +export type t_GetTerminalLocationsLocationQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTerminalLocationsLocationRequestBodySchema = EmptyObject + +export type t_GetTerminalReadersQuerySchema = { + device_type?: + | ( + | "bbpos_chipper2x" + | "bbpos_wisepad3" + | "bbpos_wisepos_e" + | "mobile_phone_reader" + | "simulated_wisepos_e" + | "stripe_m2" + | "stripe_s700" + | "verifone_P400" + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + location?: string | undefined + serial_number?: string | undefined + starting_after?: string | undefined + status?: ("offline" | "online") | undefined +} + +export type t_GetTerminalReadersRequestBodySchema = EmptyObject + +export type t_GetTerminalReadersReaderParamSchema = { + reader: string +} + +export type t_GetTerminalReadersReaderQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTerminalReadersReaderRequestBodySchema = EmptyObject + +export type t_GetTestHelpersTestClocksQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTestHelpersTestClocksRequestBodySchema = EmptyObject + +export type t_GetTestHelpersTestClocksTestClockParamSchema = { + test_clock: string +} + +export type t_GetTestHelpersTestClocksTestClockQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTestHelpersTestClocksTestClockRequestBodySchema = EmptyObject + +export type t_GetTokensTokenParamSchema = { + token: string +} + +export type t_GetTokensTokenQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTokensTokenRequestBodySchema = EmptyObject + +export type t_GetTopupsQuerySchema = { + amount?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + status?: ("canceled" | "failed" | "pending" | "succeeded") | undefined +} + +export type t_GetTopupsRequestBodySchema = EmptyObject + +export type t_GetTopupsTopupParamSchema = { + topup: string +} + +export type t_GetTopupsTopupQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTopupsTopupRequestBodySchema = EmptyObject + +export type t_GetTransfersQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + destination?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined + transfer_group?: string | undefined +} + +export type t_GetTransfersRequestBodySchema = EmptyObject + +export type t_GetTransfersIdReversalsParamSchema = { + id: string +} + +export type t_GetTransfersIdReversalsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTransfersIdReversalsRequestBodySchema = EmptyObject + +export type t_GetTransfersTransferParamSchema = { + transfer: string +} + +export type t_GetTransfersTransferQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTransfersTransferRequestBodySchema = EmptyObject + +export type t_GetTransfersTransferReversalsIdParamSchema = { + id: string + transfer: string +} + +export type t_GetTransfersTransferReversalsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTransfersTransferReversalsIdRequestBodySchema = EmptyObject + +export type t_GetTreasuryCreditReversalsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + received_credit?: string | undefined + starting_after?: string | undefined + status?: ("canceled" | "posted" | "processing") | undefined +} + +export type t_GetTreasuryCreditReversalsRequestBodySchema = EmptyObject + +export type t_GetTreasuryCreditReversalsCreditReversalParamSchema = { + credit_reversal: string +} + +export type t_GetTreasuryCreditReversalsCreditReversalQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryCreditReversalsCreditReversalRequestBodySchema = + EmptyObject + +export type t_GetTreasuryDebitReversalsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + received_debit?: string | undefined + resolution?: ("lost" | "won") | undefined + starting_after?: string | undefined + status?: ("canceled" | "completed" | "processing") | undefined +} + +export type t_GetTreasuryDebitReversalsRequestBodySchema = EmptyObject + +export type t_GetTreasuryDebitReversalsDebitReversalParamSchema = { + debit_reversal: string +} + +export type t_GetTreasuryDebitReversalsDebitReversalQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryDebitReversalsDebitReversalRequestBodySchema = + EmptyObject + +export type t_GetTreasuryFinancialAccountsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetTreasuryFinancialAccountsRequestBodySchema = EmptyObject + +export type t_GetTreasuryFinancialAccountsFinancialAccountParamSchema = { + financial_account: string +} + +export type t_GetTreasuryFinancialAccountsFinancialAccountQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryFinancialAccountsFinancialAccountRequestBodySchema = + EmptyObject + +export type t_GetTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema = + { + financial_account: string + } + +export type t_GetTreasuryFinancialAccountsFinancialAccountFeaturesQuerySchema = + { + expand?: string[] | undefined + } + +export type t_GetTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema = + EmptyObject + +export type t_GetTreasuryInboundTransfersQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + starting_after?: string | undefined + status?: ("canceled" | "failed" | "processing" | "succeeded") | undefined +} + +export type t_GetTreasuryInboundTransfersRequestBodySchema = EmptyObject + +export type t_GetTreasuryInboundTransfersIdParamSchema = { + id: string +} + +export type t_GetTreasuryInboundTransfersIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryInboundTransfersIdRequestBodySchema = EmptyObject + +export type t_GetTreasuryOutboundPaymentsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + customer?: string | undefined + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + starting_after?: string | undefined + status?: + | ("canceled" | "failed" | "posted" | "processing" | "returned") + | undefined +} + +export type t_GetTreasuryOutboundPaymentsRequestBodySchema = EmptyObject + +export type t_GetTreasuryOutboundPaymentsIdParamSchema = { + id: string +} + +export type t_GetTreasuryOutboundPaymentsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryOutboundPaymentsIdRequestBodySchema = EmptyObject + +export type t_GetTreasuryOutboundTransfersQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + starting_after?: string | undefined + status?: + | ("canceled" | "failed" | "posted" | "processing" | "returned") + | undefined +} + +export type t_GetTreasuryOutboundTransfersRequestBodySchema = EmptyObject + +export type t_GetTreasuryOutboundTransfersOutboundTransferParamSchema = { + outbound_transfer: string +} + +export type t_GetTreasuryOutboundTransfersOutboundTransferQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryOutboundTransfersOutboundTransferRequestBodySchema = + EmptyObject + +export type t_GetTreasuryReceivedCreditsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + linked_flows?: + | { + source_flow_type: + | "credit_reversal" + | "other" + | "outbound_payment" + | "outbound_transfer" + | "payout" + } + | undefined + starting_after?: string | undefined + status?: ("failed" | "succeeded") | undefined +} + +export type t_GetTreasuryReceivedCreditsRequestBodySchema = EmptyObject + +export type t_GetTreasuryReceivedCreditsIdParamSchema = { + id: string +} + +export type t_GetTreasuryReceivedCreditsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryReceivedCreditsIdRequestBodySchema = EmptyObject + +export type t_GetTreasuryReceivedDebitsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + starting_after?: string | undefined + status?: ("failed" | "succeeded") | undefined +} + +export type t_GetTreasuryReceivedDebitsRequestBodySchema = EmptyObject + +export type t_GetTreasuryReceivedDebitsIdParamSchema = { + id: string +} + +export type t_GetTreasuryReceivedDebitsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryReceivedDebitsIdRequestBodySchema = EmptyObject + +export type t_GetTreasuryTransactionEntriesQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + effective_at?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + order_by?: ("created" | "effective_at") | undefined + starting_after?: string | undefined + transaction?: string | undefined +} + +export type t_GetTreasuryTransactionEntriesRequestBodySchema = EmptyObject + +export type t_GetTreasuryTransactionEntriesIdParamSchema = { + id: string +} + +export type t_GetTreasuryTransactionEntriesIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryTransactionEntriesIdRequestBodySchema = EmptyObject + +export type t_GetTreasuryTransactionsQuerySchema = { + created?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + ending_before?: string | undefined + expand?: string[] | undefined + financial_account: string + limit?: number | undefined + order_by?: ("created" | "posted_at") | undefined + starting_after?: string | undefined + status?: ("open" | "posted" | "void") | undefined + status_transitions?: + | { + posted_at?: + | ( + | { + gt?: number | undefined + gte?: number | undefined + lt?: number | undefined + lte?: number | undefined + } + | number + ) + | undefined + } + | undefined +} + +export type t_GetTreasuryTransactionsRequestBodySchema = EmptyObject + +export type t_GetTreasuryTransactionsIdParamSchema = { + id: string +} + +export type t_GetTreasuryTransactionsIdQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetTreasuryTransactionsIdRequestBodySchema = EmptyObject + +export type t_GetWebhookEndpointsQuerySchema = { + ending_before?: string | undefined + expand?: string[] | undefined + limit?: number | undefined + starting_after?: string | undefined +} + +export type t_GetWebhookEndpointsRequestBodySchema = EmptyObject + +export type t_GetWebhookEndpointsWebhookEndpointParamSchema = { + webhook_endpoint: string +} + +export type t_GetWebhookEndpointsWebhookEndpointQuerySchema = { + expand?: string[] | undefined +} + +export type t_GetWebhookEndpointsWebhookEndpointRequestBodySchema = EmptyObject + +export type t_PostAccountLinksRequestBodySchema = { + account: string + collect?: ("currently_due" | "eventually_due") | undefined + collection_options?: + | { + fields?: ("currently_due" | "eventually_due") | undefined + future_requirements?: ("include" | "omit") | undefined + } + | undefined + expand?: string[] | undefined + refresh_url?: string | undefined + return_url?: string | undefined + type: "account_onboarding" | "account_update" +} + +export type t_PostAccountSessionsRequestBodySchema = { + account: string + components: { + account_management?: + | { + enabled: boolean + features?: + | { + disable_stripe_user_authentication?: boolean | undefined + external_account_collection?: boolean | undefined + } + | undefined + } + | undefined + account_onboarding?: + | { + enabled: boolean + features?: + | { + disable_stripe_user_authentication?: boolean | undefined + external_account_collection?: boolean | undefined + } + | undefined + } + | undefined + balances?: + | { + enabled: boolean + features?: + | { + disable_stripe_user_authentication?: boolean | undefined + edit_payout_schedule?: boolean | undefined + external_account_collection?: boolean | undefined + instant_payouts?: boolean | undefined + standard_payouts?: boolean | undefined + } + | undefined + } + | undefined + documents?: + | { + enabled: boolean + features?: EmptyObject | undefined + } + | undefined + financial_account?: + | { + enabled: boolean + features?: + | { + disable_stripe_user_authentication?: boolean | undefined + external_account_collection?: boolean | undefined + send_money?: boolean | undefined + transfer_balance?: boolean | undefined + } + | undefined + } + | undefined + financial_account_transactions?: + | { + enabled: boolean + features?: + | { + card_spend_dispute_management?: boolean | undefined + } + | undefined + } + | undefined + issuing_card?: + | { + enabled: boolean + features?: + | { + card_management?: boolean | undefined + card_spend_dispute_management?: boolean | undefined + cardholder_management?: boolean | undefined + spend_control_management?: boolean | undefined + } + | undefined + } + | undefined + issuing_cards_list?: + | { + enabled: boolean + features?: + | { + card_management?: boolean | undefined + card_spend_dispute_management?: boolean | undefined + cardholder_management?: boolean | undefined + disable_stripe_user_authentication?: boolean | undefined + spend_control_management?: boolean | undefined + } + | undefined + } + | undefined + notification_banner?: + | { + enabled: boolean + features?: + | { + disable_stripe_user_authentication?: boolean | undefined + external_account_collection?: boolean | undefined + } + | undefined + } + | undefined + payment_details?: + | { + enabled: boolean + features?: + | { + capture_payments?: boolean | undefined + destination_on_behalf_of_charge_management?: boolean | undefined + dispute_management?: boolean | undefined + refund_management?: boolean | undefined + } + | undefined + } + | undefined + payments?: + | { + enabled: boolean + features?: + | { + capture_payments?: boolean | undefined + destination_on_behalf_of_charge_management?: boolean | undefined + dispute_management?: boolean | undefined + refund_management?: boolean | undefined + } + | undefined + } + | undefined + payouts?: + | { + enabled: boolean + features?: + | { + disable_stripe_user_authentication?: boolean | undefined + edit_payout_schedule?: boolean | undefined + external_account_collection?: boolean | undefined + instant_payouts?: boolean | undefined + standard_payouts?: boolean | undefined + } + | undefined + } + | undefined + payouts_list?: + | { + enabled: boolean + features?: EmptyObject | undefined + } + | undefined + tax_registrations?: + | { + enabled: boolean + features?: EmptyObject | undefined + } + | undefined + tax_settings?: + | { + enabled: boolean + features?: EmptyObject | undefined + } + | undefined + } + expand?: string[] | undefined +} + +export type t_PostAccountsRequestBodySchema = { + account_token?: string | undefined + bank_account?: + | ( + | { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + account_number: string + account_type?: + | ("checking" | "futsu" | "savings" | "toza") + | undefined + country: string + currency?: string | undefined + documents?: + | { + bank_account_ownership_verification?: + | { + files?: string[] | undefined + } + | undefined + } + | undefined + object?: "bank_account" | undefined + routing_number?: string | undefined + } + | string + ) + | undefined + business_profile?: + | { + annual_revenue?: + | { + amount: number + currency: string + fiscal_year_end: string + } + | undefined + estimated_worker_count?: number | undefined + mcc?: string | undefined + monthly_estimated_revenue?: + | { + amount: number + currency: string + } + | undefined + name?: string | undefined + product_description?: string | undefined + support_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + support_email?: string | undefined + support_phone?: string | undefined + support_url?: (string | "") | undefined + url?: string | undefined + } + | undefined + business_type?: + | ("company" | "government_entity" | "individual" | "non_profit") + | undefined + capabilities?: + | { + acss_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + affirm_payments?: + | { + requested?: boolean | undefined + } + | undefined + afterpay_clearpay_payments?: + | { + requested?: boolean | undefined + } + | undefined + alma_payments?: + | { + requested?: boolean | undefined + } + | undefined + amazon_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + au_becs_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + bacs_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + bancontact_payments?: + | { + requested?: boolean | undefined + } + | undefined + bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + billie_payments?: + | { + requested?: boolean | undefined + } + | undefined + blik_payments?: + | { + requested?: boolean | undefined + } + | undefined + boleto_payments?: + | { + requested?: boolean | undefined + } + | undefined + card_issuing?: + | { + requested?: boolean | undefined + } + | undefined + card_payments?: + | { + requested?: boolean | undefined + } + | undefined + cartes_bancaires_payments?: + | { + requested?: boolean | undefined + } + | undefined + cashapp_payments?: + | { + requested?: boolean | undefined + } + | undefined + eps_payments?: + | { + requested?: boolean | undefined + } + | undefined + fpx_payments?: + | { + requested?: boolean | undefined + } + | undefined + gb_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + giropay_payments?: + | { + requested?: boolean | undefined + } + | undefined + grabpay_payments?: + | { + requested?: boolean | undefined + } + | undefined + ideal_payments?: + | { + requested?: boolean | undefined + } + | undefined + india_international_payments?: + | { + requested?: boolean | undefined + } + | undefined + jcb_payments?: + | { + requested?: boolean | undefined + } + | undefined + jp_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + kakao_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + klarna_payments?: + | { + requested?: boolean | undefined + } + | undefined + konbini_payments?: + | { + requested?: boolean | undefined + } + | undefined + kr_card_payments?: + | { + requested?: boolean | undefined + } + | undefined + legacy_payments?: + | { + requested?: boolean | undefined + } + | undefined + link_payments?: + | { + requested?: boolean | undefined + } + | undefined + mobilepay_payments?: + | { + requested?: boolean | undefined + } + | undefined + multibanco_payments?: + | { + requested?: boolean | undefined + } + | undefined + mx_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + naver_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + nz_bank_account_becs_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + oxxo_payments?: + | { + requested?: boolean | undefined + } + | undefined + p24_payments?: + | { + requested?: boolean | undefined + } + | undefined + pay_by_bank_payments?: + | { + requested?: boolean | undefined + } + | undefined + payco_payments?: + | { + requested?: boolean | undefined + } + | undefined + paynow_payments?: + | { + requested?: boolean | undefined + } + | undefined + promptpay_payments?: + | { + requested?: boolean | undefined + } + | undefined + revolut_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + samsung_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + satispay_payments?: + | { + requested?: boolean | undefined + } + | undefined + sepa_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + sepa_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + sofort_payments?: + | { + requested?: boolean | undefined + } + | undefined + swish_payments?: + | { + requested?: boolean | undefined + } + | undefined + tax_reporting_us_1099_k?: + | { + requested?: boolean | undefined + } + | undefined + tax_reporting_us_1099_misc?: + | { + requested?: boolean | undefined + } + | undefined + transfers?: + | { + requested?: boolean | undefined + } + | undefined + treasury?: + | { + requested?: boolean | undefined + } + | undefined + twint_payments?: + | { + requested?: boolean | undefined + } + | undefined + us_bank_account_ach_payments?: + | { + requested?: boolean | undefined + } + | undefined + us_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + zip_payments?: + | { + requested?: boolean | undefined + } + | undefined + } + | undefined + company?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + directors_provided?: boolean | undefined + directorship_declaration?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: string | undefined + } + | undefined + executives_provided?: boolean | undefined + export_license_id?: string | undefined + export_purpose_code?: string | undefined + name?: string | undefined + name_kana?: string | undefined + name_kanji?: string | undefined + owners_provided?: boolean | undefined + ownership_declaration?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: string | undefined + } + | undefined + ownership_exemption_reason?: + | ( + | "" + | "qualified_entity_exceeds_ownership_threshold" + | "qualifies_as_financial_institution" + ) + | undefined + phone?: string | undefined + registration_number?: string | undefined + structure?: + | ( + | "" + | "free_zone_establishment" + | "free_zone_llc" + | "government_instrumentality" + | "governmental_unit" + | "incorporated_non_profit" + | "incorporated_partnership" + | "limited_liability_partnership" + | "llc" + | "multi_member_llc" + | "private_company" + | "private_corporation" + | "private_partnership" + | "public_company" + | "public_corporation" + | "public_partnership" + | "registered_charity" + | "single_member_llc" + | "sole_establishment" + | "sole_proprietorship" + | "tax_exempt_government_instrumentality" + | "unincorporated_association" + | "unincorporated_non_profit" + | "unincorporated_partnership" + ) + | undefined + tax_id?: string | undefined + tax_id_registrar?: string | undefined + vat_id?: string | undefined + verification?: + | { + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + controller?: + | { + fees?: + | { + payer?: ("account" | "application") | undefined + } + | undefined + losses?: + | { + payments?: ("application" | "stripe") | undefined + } + | undefined + requirement_collection?: ("application" | "stripe") | undefined + stripe_dashboard?: + | { + type?: ("express" | "full" | "none") | undefined + } + | undefined + } + | undefined + country?: string | undefined + default_currency?: string | undefined + documents?: + | { + bank_account_ownership_verification?: + | { + files?: string[] | undefined + } + | undefined + company_license?: + | { + files?: string[] | undefined + } + | undefined + company_memorandum_of_association?: + | { + files?: string[] | undefined + } + | undefined + company_ministerial_decree?: + | { + files?: string[] | undefined + } + | undefined + company_registration_verification?: + | { + files?: string[] | undefined + } + | undefined + company_tax_id_verification?: + | { + files?: string[] | undefined + } + | undefined + proof_of_registration?: + | { + files?: string[] | undefined + } + | undefined + proof_of_ultimate_beneficial_ownership?: + | { + files?: string[] | undefined + } + | undefined + } + | undefined + email?: string | undefined + expand?: string[] | undefined + external_account?: string | undefined + groups?: + | { + payments_pricing?: (string | "") | undefined + } + | undefined + individual?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + dob?: + | ( + | { + day: number + month: number + year: number + } + | "" + ) + | undefined + email?: string | undefined + first_name?: string | undefined + first_name_kana?: string | undefined + first_name_kanji?: string | undefined + full_name_aliases?: (string[] | "") | undefined + gender?: string | undefined + id_number?: string | undefined + id_number_secondary?: string | undefined + last_name?: string | undefined + last_name_kana?: string | undefined + last_name_kanji?: string | undefined + maiden_name?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + phone?: string | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + relationship?: + | { + director?: boolean | undefined + executive?: boolean | undefined + owner?: boolean | undefined + percent_ownership?: (number | "") | undefined + title?: string | undefined + } + | undefined + ssn_last_4?: string | undefined + verification?: + | { + additional_document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + settings?: + | { + bacs_debit_payments?: + | { + display_name?: string | undefined + } + | undefined + branding?: + | { + icon?: string | undefined + logo?: string | undefined + primary_color?: string | undefined + secondary_color?: string | undefined + } + | undefined + card_issuing?: + | { + tos_acceptance?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + card_payments?: + | { + decline_on?: + | { + avs_failure?: boolean | undefined + cvc_failure?: boolean | undefined + } + | undefined + statement_descriptor_prefix?: string | undefined + statement_descriptor_prefix_kana?: (string | "") | undefined + statement_descriptor_prefix_kanji?: (string | "") | undefined + } + | undefined + invoices?: + | { + hosted_payment_method_save?: + | ("always" | "never" | "offer") + | undefined + } + | undefined + payments?: + | { + statement_descriptor?: string | undefined + statement_descriptor_kana?: string | undefined + statement_descriptor_kanji?: string | undefined + } + | undefined + payouts?: + | { + debit_negative_balances?: boolean | undefined + schedule?: + | { + delay_days?: ("minimum" | number) | undefined + interval?: + | ("daily" | "manual" | "monthly" | "weekly") + | undefined + monthly_anchor?: number | undefined + weekly_anchor?: + | ( + | "friday" + | "monday" + | "saturday" + | "sunday" + | "thursday" + | "tuesday" + | "wednesday" + ) + | undefined + } + | undefined + statement_descriptor?: string | undefined + } + | undefined + treasury?: + | { + tos_acceptance?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + } + | undefined + tos_acceptance?: + | { + date?: number | undefined + ip?: string | undefined + service_agreement?: string | undefined + user_agent?: string | undefined + } + | undefined + type?: ("custom" | "express" | "standard") | undefined +} + +export type t_PostAccountsAccountParamSchema = { + account: string +} + +export type t_PostAccountsAccountRequestBodySchema = { + account_token?: string | undefined + business_profile?: + | { + annual_revenue?: + | { + amount: number + currency: string + fiscal_year_end: string + } + | undefined + estimated_worker_count?: number | undefined + mcc?: string | undefined + monthly_estimated_revenue?: + | { + amount: number + currency: string + } + | undefined + name?: string | undefined + product_description?: string | undefined + support_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + support_email?: string | undefined + support_phone?: string | undefined + support_url?: (string | "") | undefined + url?: string | undefined + } + | undefined + business_type?: + | ("company" | "government_entity" | "individual" | "non_profit") + | undefined + capabilities?: + | { + acss_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + affirm_payments?: + | { + requested?: boolean | undefined + } + | undefined + afterpay_clearpay_payments?: + | { + requested?: boolean | undefined + } + | undefined + alma_payments?: + | { + requested?: boolean | undefined + } + | undefined + amazon_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + au_becs_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + bacs_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + bancontact_payments?: + | { + requested?: boolean | undefined + } + | undefined + bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + billie_payments?: + | { + requested?: boolean | undefined + } + | undefined + blik_payments?: + | { + requested?: boolean | undefined + } + | undefined + boleto_payments?: + | { + requested?: boolean | undefined + } + | undefined + card_issuing?: + | { + requested?: boolean | undefined + } + | undefined + card_payments?: + | { + requested?: boolean | undefined + } + | undefined + cartes_bancaires_payments?: + | { + requested?: boolean | undefined + } + | undefined + cashapp_payments?: + | { + requested?: boolean | undefined + } + | undefined + eps_payments?: + | { + requested?: boolean | undefined + } + | undefined + fpx_payments?: + | { + requested?: boolean | undefined + } + | undefined + gb_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + giropay_payments?: + | { + requested?: boolean | undefined + } + | undefined + grabpay_payments?: + | { + requested?: boolean | undefined + } + | undefined + ideal_payments?: + | { + requested?: boolean | undefined + } + | undefined + india_international_payments?: + | { + requested?: boolean | undefined + } + | undefined + jcb_payments?: + | { + requested?: boolean | undefined + } + | undefined + jp_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + kakao_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + klarna_payments?: + | { + requested?: boolean | undefined + } + | undefined + konbini_payments?: + | { + requested?: boolean | undefined + } + | undefined + kr_card_payments?: + | { + requested?: boolean | undefined + } + | undefined + legacy_payments?: + | { + requested?: boolean | undefined + } + | undefined + link_payments?: + | { + requested?: boolean | undefined + } + | undefined + mobilepay_payments?: + | { + requested?: boolean | undefined + } + | undefined + multibanco_payments?: + | { + requested?: boolean | undefined + } + | undefined + mx_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + naver_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + nz_bank_account_becs_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + oxxo_payments?: + | { + requested?: boolean | undefined + } + | undefined + p24_payments?: + | { + requested?: boolean | undefined + } + | undefined + pay_by_bank_payments?: + | { + requested?: boolean | undefined + } + | undefined + payco_payments?: + | { + requested?: boolean | undefined + } + | undefined + paynow_payments?: + | { + requested?: boolean | undefined + } + | undefined + promptpay_payments?: + | { + requested?: boolean | undefined + } + | undefined + revolut_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + samsung_pay_payments?: + | { + requested?: boolean | undefined + } + | undefined + satispay_payments?: + | { + requested?: boolean | undefined + } + | undefined + sepa_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + sepa_debit_payments?: + | { + requested?: boolean | undefined + } + | undefined + sofort_payments?: + | { + requested?: boolean | undefined + } + | undefined + swish_payments?: + | { + requested?: boolean | undefined + } + | undefined + tax_reporting_us_1099_k?: + | { + requested?: boolean | undefined + } + | undefined + tax_reporting_us_1099_misc?: + | { + requested?: boolean | undefined + } + | undefined + transfers?: + | { + requested?: boolean | undefined + } + | undefined + treasury?: + | { + requested?: boolean | undefined + } + | undefined + twint_payments?: + | { + requested?: boolean | undefined + } + | undefined + us_bank_account_ach_payments?: + | { + requested?: boolean | undefined + } + | undefined + us_bank_transfer_payments?: + | { + requested?: boolean | undefined + } + | undefined + zip_payments?: + | { + requested?: boolean | undefined + } + | undefined + } + | undefined + company?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + directors_provided?: boolean | undefined + directorship_declaration?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: string | undefined + } + | undefined + executives_provided?: boolean | undefined + export_license_id?: string | undefined + export_purpose_code?: string | undefined + name?: string | undefined + name_kana?: string | undefined + name_kanji?: string | undefined + owners_provided?: boolean | undefined + ownership_declaration?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: string | undefined + } + | undefined + ownership_exemption_reason?: + | ( + | "" + | "qualified_entity_exceeds_ownership_threshold" + | "qualifies_as_financial_institution" + ) + | undefined + phone?: string | undefined + registration_number?: string | undefined + structure?: + | ( + | "" + | "free_zone_establishment" + | "free_zone_llc" + | "government_instrumentality" + | "governmental_unit" + | "incorporated_non_profit" + | "incorporated_partnership" + | "limited_liability_partnership" + | "llc" + | "multi_member_llc" + | "private_company" + | "private_corporation" + | "private_partnership" + | "public_company" + | "public_corporation" + | "public_partnership" + | "registered_charity" + | "single_member_llc" + | "sole_establishment" + | "sole_proprietorship" + | "tax_exempt_government_instrumentality" + | "unincorporated_association" + | "unincorporated_non_profit" + | "unincorporated_partnership" + ) + | undefined + tax_id?: string | undefined + tax_id_registrar?: string | undefined + vat_id?: string | undefined + verification?: + | { + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + default_currency?: string | undefined + documents?: + | { + bank_account_ownership_verification?: + | { + files?: string[] | undefined + } + | undefined + company_license?: + | { + files?: string[] | undefined + } + | undefined + company_memorandum_of_association?: + | { + files?: string[] | undefined + } + | undefined + company_ministerial_decree?: + | { + files?: string[] | undefined + } + | undefined + company_registration_verification?: + | { + files?: string[] | undefined + } + | undefined + company_tax_id_verification?: + | { + files?: string[] | undefined + } + | undefined + proof_of_registration?: + | { + files?: string[] | undefined + } + | undefined + proof_of_ultimate_beneficial_ownership?: + | { + files?: string[] | undefined + } + | undefined + } + | undefined + email?: string | undefined + expand?: string[] | undefined + external_account?: string | undefined + groups?: + | { + payments_pricing?: (string | "") | undefined + } + | undefined + individual?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + dob?: + | ( + | { + day: number + month: number + year: number + } + | "" + ) + | undefined + email?: string | undefined + first_name?: string | undefined + first_name_kana?: string | undefined + first_name_kanji?: string | undefined + full_name_aliases?: (string[] | "") | undefined + gender?: string | undefined + id_number?: string | undefined + id_number_secondary?: string | undefined + last_name?: string | undefined + last_name_kana?: string | undefined + last_name_kanji?: string | undefined + maiden_name?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + phone?: string | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + relationship?: + | { + director?: boolean | undefined + executive?: boolean | undefined + owner?: boolean | undefined + percent_ownership?: (number | "") | undefined + title?: string | undefined + } + | undefined + ssn_last_4?: string | undefined + verification?: + | { + additional_document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + settings?: + | { + bacs_debit_payments?: + | { + display_name?: string | undefined + } + | undefined + branding?: + | { + icon?: string | undefined + logo?: string | undefined + primary_color?: string | undefined + secondary_color?: string | undefined + } + | undefined + card_issuing?: + | { + tos_acceptance?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + card_payments?: + | { + decline_on?: + | { + avs_failure?: boolean | undefined + cvc_failure?: boolean | undefined + } + | undefined + statement_descriptor_prefix?: string | undefined + statement_descriptor_prefix_kana?: (string | "") | undefined + statement_descriptor_prefix_kanji?: (string | "") | undefined + } + | undefined + invoices?: + | { + default_account_tax_ids?: (string[] | "") | undefined + hosted_payment_method_save?: + | ("always" | "never" | "offer") + | undefined + } + | undefined + payments?: + | { + statement_descriptor?: string | undefined + statement_descriptor_kana?: string | undefined + statement_descriptor_kanji?: string | undefined + } + | undefined + payouts?: + | { + debit_negative_balances?: boolean | undefined + schedule?: + | { + delay_days?: ("minimum" | number) | undefined + interval?: + | ("daily" | "manual" | "monthly" | "weekly") + | undefined + monthly_anchor?: number | undefined + weekly_anchor?: + | ( + | "friday" + | "monday" + | "saturday" + | "sunday" + | "thursday" + | "tuesday" + | "wednesday" + ) + | undefined + } + | undefined + statement_descriptor?: string | undefined + } + | undefined + treasury?: + | { + tos_acceptance?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + } + | undefined + tos_acceptance?: + | { + date?: number | undefined + ip?: string | undefined + service_agreement?: string | undefined + user_agent?: string | undefined + } + | undefined +} + +export type t_PostAccountsAccountBankAccountsParamSchema = { + account: string +} + +export type t_PostAccountsAccountBankAccountsRequestBodySchema = { + bank_account?: + | ( + | { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + account_number: string + account_type?: + | ("checking" | "futsu" | "savings" | "toza") + | undefined + country: string + currency?: string | undefined + documents?: + | { + bank_account_ownership_verification?: + | { + files?: string[] | undefined + } + | undefined + } + | undefined + object?: "bank_account" | undefined + routing_number?: string | undefined + } + | string + ) + | undefined + default_for_currency?: boolean | undefined + expand?: string[] | undefined + external_account?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostAccountsAccountBankAccountsIdParamSchema = { + account: string + id: string +} + +export type t_PostAccountsAccountBankAccountsIdRequestBodySchema = { + account_holder_name?: string | undefined + account_holder_type?: ("" | "company" | "individual") | undefined + account_type?: ("checking" | "futsu" | "savings" | "toza") | undefined + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + default_for_currency?: boolean | undefined + documents?: + | { + bank_account_ownership_verification?: + | { + files?: string[] | undefined + } + | undefined + } + | undefined + exp_month?: string | undefined + exp_year?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined +} + +export type t_PostAccountsAccountCapabilitiesCapabilityParamSchema = { + account: string + capability: string +} + +export type t_PostAccountsAccountCapabilitiesCapabilityRequestBodySchema = { + expand?: string[] | undefined + requested?: boolean | undefined +} + +export type t_PostAccountsAccountExternalAccountsParamSchema = { + account: string +} + +export type t_PostAccountsAccountExternalAccountsRequestBodySchema = { + bank_account?: + | ( + | { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + account_number: string + account_type?: + | ("checking" | "futsu" | "savings" | "toza") + | undefined + country: string + currency?: string | undefined + documents?: + | { + bank_account_ownership_verification?: + | { + files?: string[] | undefined + } + | undefined + } + | undefined + object?: "bank_account" | undefined + routing_number?: string | undefined + } + | string + ) + | undefined + default_for_currency?: boolean | undefined + expand?: string[] | undefined + external_account?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostAccountsAccountExternalAccountsIdParamSchema = { + account: string + id: string +} + +export type t_PostAccountsAccountExternalAccountsIdRequestBodySchema = { + account_holder_name?: string | undefined + account_holder_type?: ("" | "company" | "individual") | undefined + account_type?: ("checking" | "futsu" | "savings" | "toza") | undefined + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + default_for_currency?: boolean | undefined + documents?: + | { + bank_account_ownership_verification?: + | { + files?: string[] | undefined + } + | undefined + } + | undefined + exp_month?: string | undefined + exp_year?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined +} + +export type t_PostAccountsAccountLoginLinksParamSchema = { + account: string +} + +export type t_PostAccountsAccountLoginLinksRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostAccountsAccountPeopleParamSchema = { + account: string +} + +export type t_PostAccountsAccountPeopleRequestBodySchema = { + additional_tos_acceptances?: + | { + account?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + dob?: + | ( + | { + day: number + month: number + year: number + } + | "" + ) + | undefined + documents?: + | { + company_authorization?: + | { + files?: (string | "")[] | undefined + } + | undefined + passport?: + | { + files?: (string | "")[] | undefined + } + | undefined + visa?: + | { + files?: (string | "")[] | undefined + } + | undefined + } + | undefined + email?: string | undefined + expand?: string[] | undefined + first_name?: string | undefined + first_name_kana?: string | undefined + first_name_kanji?: string | undefined + full_name_aliases?: (string[] | "") | undefined + gender?: string | undefined + id_number?: string | undefined + id_number_secondary?: string | undefined + last_name?: string | undefined + last_name_kana?: string | undefined + last_name_kanji?: string | undefined + maiden_name?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + nationality?: string | undefined + person_token?: string | undefined + phone?: string | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + relationship?: + | { + authorizer?: boolean | undefined + director?: boolean | undefined + executive?: boolean | undefined + legal_guardian?: boolean | undefined + owner?: boolean | undefined + percent_ownership?: (number | "") | undefined + representative?: boolean | undefined + title?: string | undefined + } + | undefined + ssn_last_4?: string | undefined + verification?: + | { + additional_document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined +} + +export type t_PostAccountsAccountPeoplePersonParamSchema = { + account: string + person: string +} + +export type t_PostAccountsAccountPeoplePersonRequestBodySchema = { + additional_tos_acceptances?: + | { + account?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + dob?: + | ( + | { + day: number + month: number + year: number + } + | "" + ) + | undefined + documents?: + | { + company_authorization?: + | { + files?: (string | "")[] | undefined + } + | undefined + passport?: + | { + files?: (string | "")[] | undefined + } + | undefined + visa?: + | { + files?: (string | "")[] | undefined + } + | undefined + } + | undefined + email?: string | undefined + expand?: string[] | undefined + first_name?: string | undefined + first_name_kana?: string | undefined + first_name_kanji?: string | undefined + full_name_aliases?: (string[] | "") | undefined + gender?: string | undefined + id_number?: string | undefined + id_number_secondary?: string | undefined + last_name?: string | undefined + last_name_kana?: string | undefined + last_name_kanji?: string | undefined + maiden_name?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + nationality?: string | undefined + person_token?: string | undefined + phone?: string | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + relationship?: + | { + authorizer?: boolean | undefined + director?: boolean | undefined + executive?: boolean | undefined + legal_guardian?: boolean | undefined + owner?: boolean | undefined + percent_ownership?: (number | "") | undefined + representative?: boolean | undefined + title?: string | undefined + } + | undefined + ssn_last_4?: string | undefined + verification?: + | { + additional_document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined +} + +export type t_PostAccountsAccountPersonsParamSchema = { + account: string +} + +export type t_PostAccountsAccountPersonsRequestBodySchema = { + additional_tos_acceptances?: + | { + account?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + dob?: + | ( + | { + day: number + month: number + year: number + } + | "" + ) + | undefined + documents?: + | { + company_authorization?: + | { + files?: (string | "")[] | undefined + } + | undefined + passport?: + | { + files?: (string | "")[] | undefined + } + | undefined + visa?: + | { + files?: (string | "")[] | undefined + } + | undefined + } + | undefined + email?: string | undefined + expand?: string[] | undefined + first_name?: string | undefined + first_name_kana?: string | undefined + first_name_kanji?: string | undefined + full_name_aliases?: (string[] | "") | undefined + gender?: string | undefined + id_number?: string | undefined + id_number_secondary?: string | undefined + last_name?: string | undefined + last_name_kana?: string | undefined + last_name_kanji?: string | undefined + maiden_name?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + nationality?: string | undefined + person_token?: string | undefined + phone?: string | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + relationship?: + | { + authorizer?: boolean | undefined + director?: boolean | undefined + executive?: boolean | undefined + legal_guardian?: boolean | undefined + owner?: boolean | undefined + percent_ownership?: (number | "") | undefined + representative?: boolean | undefined + title?: string | undefined + } + | undefined + ssn_last_4?: string | undefined + verification?: + | { + additional_document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined +} + +export type t_PostAccountsAccountPersonsPersonParamSchema = { + account: string + person: string +} + +export type t_PostAccountsAccountPersonsPersonRequestBodySchema = { + additional_tos_acceptances?: + | { + account?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + dob?: + | ( + | { + day: number + month: number + year: number + } + | "" + ) + | undefined + documents?: + | { + company_authorization?: + | { + files?: (string | "")[] | undefined + } + | undefined + passport?: + | { + files?: (string | "")[] | undefined + } + | undefined + visa?: + | { + files?: (string | "")[] | undefined + } + | undefined + } + | undefined + email?: string | undefined + expand?: string[] | undefined + first_name?: string | undefined + first_name_kana?: string | undefined + first_name_kanji?: string | undefined + full_name_aliases?: (string[] | "") | undefined + gender?: string | undefined + id_number?: string | undefined + id_number_secondary?: string | undefined + last_name?: string | undefined + last_name_kana?: string | undefined + last_name_kanji?: string | undefined + maiden_name?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + nationality?: string | undefined + person_token?: string | undefined + phone?: string | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + relationship?: + | { + authorizer?: boolean | undefined + director?: boolean | undefined + executive?: boolean | undefined + legal_guardian?: boolean | undefined + owner?: boolean | undefined + percent_ownership?: (number | "") | undefined + representative?: boolean | undefined + title?: string | undefined + } + | undefined + ssn_last_4?: string | undefined + verification?: + | { + additional_document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined +} + +export type t_PostAccountsAccountRejectParamSchema = { + account: string +} + +export type t_PostAccountsAccountRejectRequestBodySchema = { + expand?: string[] | undefined + reason: string +} + +export type t_PostApplePayDomainsRequestBodySchema = { + domain_name: string + expand?: string[] | undefined +} + +export type t_PostApplicationFeesFeeRefundsIdParamSchema = { + fee: string + id: string +} + +export type t_PostApplicationFeesFeeRefundsIdRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostApplicationFeesIdRefundParamSchema = { + id: string +} + +export type t_PostApplicationFeesIdRefundRequestBodySchema = { + amount?: number | undefined + directive?: string | undefined + expand?: string[] | undefined +} + +export type t_PostApplicationFeesIdRefundsParamSchema = { + id: string +} + +export type t_PostApplicationFeesIdRefundsRequestBodySchema = { + amount?: number | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostAppsSecretsRequestBodySchema = { + expand?: string[] | undefined + expires_at?: number | undefined + name: string + payload: string + scope: { + type: "account" | "user" + user?: string | undefined + } +} + +export type t_PostAppsSecretsDeleteRequestBodySchema = { + expand?: string[] | undefined + name: string + scope: { + type: "account" | "user" + user?: string | undefined + } +} + +export type t_PostBillingAlertsRequestBodySchema = { + alert_type: "usage_threshold" + expand?: string[] | undefined + title: string + usage_threshold?: + | { + filters?: + | { + customer?: string | undefined + type: "customer" + }[] + | undefined + gte: number + meter?: string | undefined + recurrence: "one_time" + } + | undefined +} + +export type t_PostBillingAlertsIdActivateParamSchema = { + id: string +} + +export type t_PostBillingAlertsIdActivateRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostBillingAlertsIdArchiveParamSchema = { + id: string +} + +export type t_PostBillingAlertsIdArchiveRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostBillingAlertsIdDeactivateParamSchema = { + id: string +} + +export type t_PostBillingAlertsIdDeactivateRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostBillingCreditGrantsRequestBodySchema = { + amount: { + monetary?: + | { + currency: string + value: number + } + | undefined + type: "monetary" + } + applicability_config: { + scope: { + price_type?: "metered" | undefined + prices?: + | { + id: string + }[] + | undefined + } + } + category: "paid" | "promotional" + customer: string + effective_at?: number | undefined + expand?: string[] | undefined + expires_at?: number | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: string | undefined + priority?: number | undefined +} + +export type t_PostBillingCreditGrantsIdParamSchema = { + id: string +} + +export type t_PostBillingCreditGrantsIdRequestBodySchema = { + expand?: string[] | undefined + expires_at?: (number | "") | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostBillingCreditGrantsIdExpireParamSchema = { + id: string +} + +export type t_PostBillingCreditGrantsIdExpireRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostBillingCreditGrantsIdVoidParamSchema = { + id: string +} + +export type t_PostBillingCreditGrantsIdVoidRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostBillingMeterEventAdjustmentsRequestBodySchema = { + cancel?: + | { + identifier?: string | undefined + } + | undefined + event_name: string + expand?: string[] | undefined + type: "cancel" +} + +export type t_PostBillingMeterEventsRequestBodySchema = { + event_name: string + expand?: string[] | undefined + identifier?: string | undefined + payload: { + [key: string]: string | undefined + } + timestamp?: number | undefined +} + +export type t_PostBillingMetersRequestBodySchema = { + customer_mapping?: + | { + event_payload_key: string + type: "by_id" + } + | undefined + default_aggregation: { + formula: "count" | "last" | "sum" + } + display_name: string + event_name: string + event_time_window?: ("day" | "hour") | undefined + expand?: string[] | undefined + value_settings?: + | { + event_payload_key: string + } + | undefined +} + +export type t_PostBillingMetersIdParamSchema = { + id: string +} + +export type t_PostBillingMetersIdRequestBodySchema = { + display_name?: string | undefined + expand?: string[] | undefined +} + +export type t_PostBillingMetersIdDeactivateParamSchema = { + id: string +} + +export type t_PostBillingMetersIdDeactivateRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostBillingMetersIdReactivateParamSchema = { + id: string +} + +export type t_PostBillingMetersIdReactivateRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostBillingPortalConfigurationsRequestBodySchema = { + business_profile?: + | { + headline?: (string | "") | undefined + privacy_policy_url?: string | undefined + terms_of_service_url?: string | undefined + } + | undefined + default_return_url?: (string | "") | undefined + expand?: string[] | undefined + features: { + customer_update?: + | { + allowed_updates?: + | ( + | ( + | "address" + | "email" + | "name" + | "phone" + | "shipping" + | "tax_id" + )[] + | "" + ) + | undefined + enabled: boolean + } + | undefined + invoice_history?: + | { + enabled: boolean + } + | undefined + payment_method_update?: + | { + enabled: boolean + } + | undefined + subscription_cancel?: + | { + cancellation_reason?: + | { + enabled: boolean + options: + | ( + | "customer_service" + | "low_quality" + | "missing_features" + | "other" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + )[] + | "" + } + | undefined + enabled: boolean + mode?: ("at_period_end" | "immediately") | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + } + | undefined + subscription_update?: + | { + default_allowed_updates?: + | (("price" | "promotion_code" | "quantity")[] | "") + | undefined + enabled: boolean + products?: + | ( + | { + prices: string[] + product: string + }[] + | "" + ) + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + schedule_at_period_end?: + | { + conditions?: + | { + type: "decreasing_item_amount" | "shortening_interval" + }[] + | undefined + } + | undefined + } + | undefined + } + login_page?: + | { + enabled: boolean + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostBillingPortalConfigurationsConfigurationParamSchema = { + configuration: string +} + +export type t_PostBillingPortalConfigurationsConfigurationRequestBodySchema = { + active?: boolean | undefined + business_profile?: + | { + headline?: (string | "") | undefined + privacy_policy_url?: (string | "") | undefined + terms_of_service_url?: (string | "") | undefined + } + | undefined + default_return_url?: (string | "") | undefined + expand?: string[] | undefined + features?: + | { + customer_update?: + | { + allowed_updates?: + | ( + | ( + | "address" + | "email" + | "name" + | "phone" + | "shipping" + | "tax_id" + )[] + | "" + ) + | undefined + enabled?: boolean | undefined + } + | undefined + invoice_history?: + | { + enabled: boolean + } + | undefined + payment_method_update?: + | { + enabled: boolean + } + | undefined + subscription_cancel?: + | { + cancellation_reason?: + | { + enabled: boolean + options?: + | ( + | ( + | "customer_service" + | "low_quality" + | "missing_features" + | "other" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + )[] + | "" + ) + | undefined + } + | undefined + enabled?: boolean | undefined + mode?: ("at_period_end" | "immediately") | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + } + | undefined + subscription_update?: + | { + default_allowed_updates?: + | (("price" | "promotion_code" | "quantity")[] | "") + | undefined + enabled?: boolean | undefined + products?: + | ( + | { + prices: string[] + product: string + }[] + | "" + ) + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + schedule_at_period_end?: + | { + conditions?: + | ( + | { + type: + | "decreasing_item_amount" + | "shortening_interval" + }[] + | "" + ) + | undefined + } + | undefined + } + | undefined + } + | undefined + login_page?: + | { + enabled: boolean + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostBillingPortalSessionsRequestBodySchema = { + configuration?: string | undefined + customer: string + expand?: string[] | undefined + flow_data?: + | { + after_completion?: + | { + hosted_confirmation?: + | { + custom_message?: string | undefined + } + | undefined + redirect?: + | { + return_url: string + } + | undefined + type: "hosted_confirmation" | "portal_homepage" | "redirect" + } + | undefined + subscription_cancel?: + | { + retention?: + | { + coupon_offer: { + coupon: string + } + type: "coupon_offer" + } + | undefined + subscription: string + } + | undefined + subscription_update?: + | { + subscription: string + } + | undefined + subscription_update_confirm?: + | { + discounts?: + | { + coupon?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + items: { + id: string + price?: string | undefined + quantity?: number | undefined + }[] + subscription: string + } + | undefined + type: + | "payment_method_update" + | "subscription_cancel" + | "subscription_update" + | "subscription_update_confirm" + } + | undefined + locale?: + | ( + | "auto" + | "bg" + | "cs" + | "da" + | "de" + | "el" + | "en" + | "en-AU" + | "en-CA" + | "en-GB" + | "en-IE" + | "en-IN" + | "en-NZ" + | "en-SG" + | "es" + | "es-419" + | "et" + | "fi" + | "fil" + | "fr" + | "fr-CA" + | "hr" + | "hu" + | "id" + | "it" + | "ja" + | "ko" + | "lt" + | "lv" + | "ms" + | "mt" + | "nb" + | "nl" + | "pl" + | "pt" + | "pt-BR" + | "ro" + | "ru" + | "sk" + | "sl" + | "sv" + | "th" + | "tr" + | "vi" + | "zh" + | "zh-HK" + | "zh-TW" + ) + | undefined + on_behalf_of?: string | undefined + return_url?: string | undefined +} + +export type t_PostChargesRequestBodySchema = { + amount?: number | undefined + application_fee?: number | undefined + application_fee_amount?: number | undefined + capture?: boolean | undefined + card?: + | ( + | { + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + cvc?: string | undefined + exp_month: number + exp_year: number + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: string | undefined + number: string + object?: "card" | undefined + } + | string + ) + | undefined + currency?: string | undefined + customer?: string | undefined + description?: string | undefined + destination?: + | ( + | { + account: string + amount?: number | undefined + } + | string + ) + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + on_behalf_of?: string | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + receipt_email?: string | undefined + shipping?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + carrier?: string | undefined + name: string + phone?: string | undefined + tracking_number?: string | undefined + } + | undefined + source?: string | undefined + statement_descriptor?: string | undefined + statement_descriptor_suffix?: string | undefined + transfer_data?: + | { + amount?: number | undefined + destination: string + } + | undefined + transfer_group?: string | undefined +} + +export type t_PostChargesChargeParamSchema = { + charge: string +} + +export type t_PostChargesChargeRequestBodySchema = { + customer?: string | undefined + description?: string | undefined + expand?: string[] | undefined + fraud_details?: + | { + user_report: "" | "fraudulent" | "safe" + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + receipt_email?: string | undefined + shipping?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + carrier?: string | undefined + name: string + phone?: string | undefined + tracking_number?: string | undefined + } + | undefined + transfer_group?: string | undefined +} + +export type t_PostChargesChargeCaptureParamSchema = { + charge: string +} + +export type t_PostChargesChargeCaptureRequestBodySchema = { + amount?: number | undefined + application_fee?: number | undefined + application_fee_amount?: number | undefined + expand?: string[] | undefined + receipt_email?: string | undefined + statement_descriptor?: string | undefined + statement_descriptor_suffix?: string | undefined + transfer_data?: + | { + amount?: number | undefined + } + | undefined + transfer_group?: string | undefined +} + +export type t_PostChargesChargeDisputeParamSchema = { + charge: string +} + +export type t_PostChargesChargeDisputeRequestBodySchema = { + evidence?: + | { + access_activity_log?: string | undefined + billing_address?: string | undefined + cancellation_policy?: string | undefined + cancellation_policy_disclosure?: string | undefined + cancellation_rebuttal?: string | undefined + customer_communication?: string | undefined + customer_email_address?: string | undefined + customer_name?: string | undefined + customer_purchase_ip?: string | undefined + customer_signature?: string | undefined + duplicate_charge_documentation?: string | undefined + duplicate_charge_explanation?: string | undefined + duplicate_charge_id?: string | undefined + enhanced_evidence?: + | ( + | { + visa_compelling_evidence_3?: + | { + disputed_transaction?: + | { + customer_account_id?: (string | "") | undefined + customer_device_fingerprint?: + | (string | "") + | undefined + customer_device_id?: (string | "") | undefined + customer_email_address?: (string | "") | undefined + customer_purchase_ip?: (string | "") | undefined + merchandise_or_services?: + | ("merchandise" | "services") + | undefined + product_description?: (string | "") | undefined + shipping_address?: + | { + city?: (string | "") | undefined + country?: (string | "") | undefined + line1?: (string | "") | undefined + line2?: (string | "") | undefined + postal_code?: (string | "") | undefined + state?: (string | "") | undefined + } + | undefined + } + | undefined + prior_undisputed_transactions?: + | { + charge: string + customer_account_id?: (string | "") | undefined + customer_device_fingerprint?: + | (string | "") + | undefined + customer_device_id?: (string | "") | undefined + customer_email_address?: (string | "") | undefined + customer_purchase_ip?: (string | "") | undefined + product_description?: (string | "") | undefined + shipping_address?: + | { + city?: (string | "") | undefined + country?: (string | "") | undefined + line1?: (string | "") | undefined + line2?: (string | "") | undefined + postal_code?: (string | "") | undefined + state?: (string | "") | undefined + } + | undefined + }[] + | undefined + } + | undefined + visa_compliance?: + | { + fee_acknowledged?: boolean | undefined + } + | undefined + } + | "" + ) + | undefined + product_description?: string | undefined + receipt?: string | undefined + refund_policy?: string | undefined + refund_policy_disclosure?: string | undefined + refund_refusal_explanation?: string | undefined + service_date?: string | undefined + service_documentation?: string | undefined + shipping_address?: string | undefined + shipping_carrier?: string | undefined + shipping_date?: string | undefined + shipping_documentation?: string | undefined + shipping_tracking_number?: string | undefined + uncategorized_file?: string | undefined + uncategorized_text?: string | undefined + } + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + submit?: boolean | undefined +} + +export type t_PostChargesChargeDisputeCloseParamSchema = { + charge: string +} + +export type t_PostChargesChargeDisputeCloseRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostChargesChargeRefundParamSchema = { + charge: string +} + +export type t_PostChargesChargeRefundRequestBodySchema = { + amount?: number | undefined + expand?: string[] | undefined + instructions_email?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + payment_intent?: string | undefined + reason?: ("duplicate" | "fraudulent" | "requested_by_customer") | undefined + refund_application_fee?: boolean | undefined + reverse_transfer?: boolean | undefined +} + +export type t_PostChargesChargeRefundsParamSchema = { + charge: string +} + +export type t_PostChargesChargeRefundsRequestBodySchema = { + amount?: number | undefined + currency?: string | undefined + customer?: string | undefined + expand?: string[] | undefined + instructions_email?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + origin?: "customer_balance" | undefined + payment_intent?: string | undefined + reason?: ("duplicate" | "fraudulent" | "requested_by_customer") | undefined + refund_application_fee?: boolean | undefined + reverse_transfer?: boolean | undefined +} + +export type t_PostChargesChargeRefundsRefundParamSchema = { + charge: string + refund: string +} + +export type t_PostChargesChargeRefundsRefundRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostCheckoutSessionsRequestBodySchema = { + adaptive_pricing?: + | { + enabled?: boolean | undefined + } + | undefined + after_expiration?: + | { + recovery?: + | { + allow_promotion_codes?: boolean | undefined + enabled: boolean + } + | undefined + } + | undefined + allow_promotion_codes?: boolean | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_address_collection?: ("auto" | "required") | undefined + cancel_url?: string | undefined + client_reference_id?: string | undefined + consent_collection?: + | { + payment_method_reuse_agreement?: + | { + position: "auto" | "hidden" + } + | undefined + promotions?: ("auto" | "none") | undefined + terms_of_service?: ("none" | "required") | undefined + } + | undefined + currency?: string | undefined + custom_fields?: + | { + dropdown?: + | { + default_value?: string | undefined + options: { + label: string + value: string + }[] + } + | undefined + key: string + label: { + custom: string + type: "custom" + } + numeric?: + | { + default_value?: string | undefined + maximum_length?: number | undefined + minimum_length?: number | undefined + } + | undefined + optional?: boolean | undefined + text?: + | { + default_value?: string | undefined + maximum_length?: number | undefined + minimum_length?: number | undefined + } + | undefined + type: "dropdown" | "numeric" | "text" + }[] + | undefined + custom_text?: + | { + after_submit?: + | ( + | { + message: string + } + | "" + ) + | undefined + shipping_address?: + | ( + | { + message: string + } + | "" + ) + | undefined + submit?: + | ( + | { + message: string + } + | "" + ) + | undefined + terms_of_service_acceptance?: + | ( + | { + message: string + } + | "" + ) + | undefined + } + | undefined + customer?: string | undefined + customer_creation?: ("always" | "if_required") | undefined + customer_email?: string | undefined + customer_update?: + | { + address?: ("auto" | "never") | undefined + name?: ("auto" | "never") | undefined + shipping?: ("auto" | "never") | undefined + } + | undefined + discounts?: + | { + coupon?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + expand?: string[] | undefined + expires_at?: number | undefined + invoice_creation?: + | { + enabled: boolean + invoice_data?: + | { + account_tax_ids?: (string[] | "") | undefined + custom_fields?: + | ( + | { + name: string + value: string + }[] + | "" + ) + | undefined + description?: string | undefined + footer?: string | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + rendering_options?: + | ( + | { + amount_tax_display?: + | ("" | "exclude_tax" | "include_inclusive_tax") + | undefined + } + | "" + ) + | undefined + } + | undefined + } + | undefined + line_items?: + | { + adjustable_quantity?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + } + | undefined + dynamic_tax_rates?: string[] | undefined + price?: string | undefined + price_data?: + | { + currency: string + product?: string | undefined + product_data?: + | { + description?: string | undefined + images?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string + tax_code?: string | undefined + } + | undefined + recurring?: + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: string[] | undefined + }[] + | undefined + locale?: + | ( + | "auto" + | "bg" + | "cs" + | "da" + | "de" + | "el" + | "en" + | "en-GB" + | "es" + | "es-419" + | "et" + | "fi" + | "fil" + | "fr" + | "fr-CA" + | "hr" + | "hu" + | "id" + | "it" + | "ja" + | "ko" + | "lt" + | "lv" + | "ms" + | "mt" + | "nb" + | "nl" + | "pl" + | "pt" + | "pt-BR" + | "ro" + | "ru" + | "sk" + | "sl" + | "sv" + | "th" + | "tr" + | "vi" + | "zh" + | "zh-HK" + | "zh-TW" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mode?: ("payment" | "setup" | "subscription") | undefined + optional_items?: + | { + adjustable_quantity?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + } + | undefined + price: string + quantity: number + }[] + | undefined + payment_intent_data?: + | { + application_fee_amount?: number | undefined + capture_method?: + | ("automatic" | "automatic_async" | "manual") + | undefined + description?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: string | undefined + receipt_email?: string | undefined + setup_future_usage?: ("off_session" | "on_session") | undefined + shipping?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1: string + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + carrier?: string | undefined + name: string + phone?: string | undefined + tracking_number?: string | undefined + } + | undefined + statement_descriptor?: string | undefined + statement_descriptor_suffix?: string | undefined + transfer_data?: + | { + amount?: number | undefined + destination: string + } + | undefined + transfer_group?: string | undefined + } + | undefined + payment_method_collection?: ("always" | "if_required") | undefined + payment_method_configuration?: string | undefined + payment_method_data?: + | { + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + } + | undefined + payment_method_options?: + | { + acss_debit?: + | { + currency?: ("cad" | "usd") | undefined + mandate_options?: + | { + custom_mandate_url?: (string | "") | undefined + default_for?: ("invoice" | "subscription")[] | undefined + interval_description?: string | undefined + payment_schedule?: + | ("combined" | "interval" | "sporadic") + | undefined + transaction_type?: ("business" | "personal") | undefined + } + | undefined + setup_future_usage?: + | ("none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | undefined + affirm?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + afterpay_clearpay?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + alipay?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + amazon_pay?: + | { + setup_future_usage?: ("none" | "off_session") | undefined + } + | undefined + au_becs_debit?: + | { + setup_future_usage?: "none" | undefined + target_date?: string | undefined + } + | undefined + bacs_debit?: + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + setup_future_usage?: + | ("none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | undefined + bancontact?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + boleto?: + | { + expires_after_days?: number | undefined + setup_future_usage?: + | ("none" | "off_session" | "on_session") + | undefined + } + | undefined + card?: + | { + installments?: + | { + enabled?: boolean | undefined + } + | undefined + request_extended_authorization?: + | ("if_available" | "never") + | undefined + request_incremental_authorization?: + | ("if_available" | "never") + | undefined + request_multicapture?: ("if_available" | "never") | undefined + request_overcapture?: ("if_available" | "never") | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + restrictions?: + | { + brands_blocked?: + | ( + | "american_express" + | "discover_global_network" + | "mastercard" + | "visa" + )[] + | undefined + } + | undefined + setup_future_usage?: ("off_session" | "on_session") | undefined + statement_descriptor_suffix_kana?: string | undefined + statement_descriptor_suffix_kanji?: string | undefined + } + | undefined + cashapp?: + | { + setup_future_usage?: + | ("none" | "off_session" | "on_session") + | undefined + } + | undefined + customer_balance?: + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + requested_address_types?: + | ( + | "aba" + | "iban" + | "sepa" + | "sort_code" + | "spei" + | "swift" + | "zengin" + )[] + | undefined + type: + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" + } + | undefined + funding_type?: "bank_transfer" | undefined + setup_future_usage?: "none" | undefined + } + | undefined + eps?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + fpx?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + giropay?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + grabpay?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + ideal?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + kakao_pay?: + | { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined + } + | undefined + klarna?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + konbini?: + | { + expires_after_days?: number | undefined + setup_future_usage?: "none" | undefined + } + | undefined + kr_card?: + | { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined + } + | undefined + link?: + | { + setup_future_usage?: ("none" | "off_session") | undefined + } + | undefined + mobilepay?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + multibanco?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + naver_pay?: + | { + capture_method?: "manual" | undefined + setup_future_usage?: ("none" | "off_session") | undefined + } + | undefined + oxxo?: + | { + expires_after_days?: number | undefined + setup_future_usage?: "none" | undefined + } + | undefined + p24?: + | { + setup_future_usage?: "none" | undefined + tos_shown_and_accepted?: boolean | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: + | { + capture_method?: "manual" | undefined + } + | undefined + paynow?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + paypal?: + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: + | ( + | "cs-CZ" + | "da-DK" + | "de-AT" + | "de-DE" + | "de-LU" + | "el-GR" + | "en-GB" + | "en-US" + | "es-ES" + | "fi-FI" + | "fr-BE" + | "fr-FR" + | "fr-LU" + | "hu-HU" + | "it-IT" + | "nl-BE" + | "nl-NL" + | "pl-PL" + | "pt-PT" + | "sk-SK" + | "sv-SE" + ) + | undefined + reference?: string | undefined + risk_correlation_id?: string | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | undefined + pix?: + | { + expires_after_seconds?: number | undefined + } + | undefined + revolut_pay?: + | { + setup_future_usage?: ("none" | "off_session") | undefined + } + | undefined + samsung_pay?: + | { + capture_method?: "manual" | undefined + } + | undefined + sepa_debit?: + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + setup_future_usage?: + | ("none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | undefined + sofort?: + | { + setup_future_usage?: "none" | undefined + } + | undefined + swish?: + | { + reference?: string | undefined + } + | undefined + us_bank_account?: + | { + financial_connections?: + | { + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + } + | undefined + setup_future_usage?: + | ("none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + verification_method?: ("automatic" | "instant") | undefined + } + | undefined + wechat_pay?: + | { + app_id?: string | undefined + client: "android" | "ios" | "web" + setup_future_usage?: "none" | undefined + } + | undefined + } + | undefined + payment_method_types?: + | ( + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + )[] + | undefined + permissions?: + | { + update_shipping_details?: ("client_only" | "server_only") | undefined + } + | undefined + phone_number_collection?: + | { + enabled: boolean + } + | undefined + redirect_on_completion?: ("always" | "if_required" | "never") | undefined + return_url?: string | undefined + saved_payment_method_options?: + | { + allow_redisplay_filters?: + | ("always" | "limited" | "unspecified")[] + | undefined + payment_method_save?: ("disabled" | "enabled") | undefined + } + | undefined + setup_intent_data?: + | { + description?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: string | undefined + } + | undefined + shipping_address_collection?: + | { + allowed_countries: ( + | "AC" + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TA" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VN" + | "VU" + | "WF" + | "WS" + | "XK" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | "ZZ" + )[] + } + | undefined + shipping_options?: + | { + shipping_rate?: string | undefined + shipping_rate_data?: + | { + delivery_estimate?: + | { + maximum?: + | { + unit: + | "business_day" + | "day" + | "hour" + | "month" + | "week" + value: number + } + | undefined + minimum?: + | { + unit: + | "business_day" + | "day" + | "hour" + | "month" + | "week" + value: number + } + | undefined + } + | undefined + display_name: string + fixed_amount?: + | { + amount: number + currency: string + currency_options?: + | { + [key: string]: + | { + amount: number + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + tax_code?: string | undefined + type?: "fixed_amount" | undefined + } + | undefined + }[] + | undefined + submit_type?: ("auto" | "book" | "donate" | "pay" | "subscribe") | undefined + subscription_data?: + | { + application_fee_percent?: number | undefined + billing_cycle_anchor?: number | undefined + default_tax_rates?: string[] | undefined + description?: string | undefined + invoice_settings?: + | { + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: string | undefined + proration_behavior?: ("create_prorations" | "none") | undefined + transfer_data?: + | { + amount_percent?: number | undefined + destination: string + } + | undefined + trial_end?: number | undefined + trial_period_days?: number | undefined + trial_settings?: + | { + end_behavior: { + missing_payment_method: "cancel" | "create_invoice" | "pause" + } + } + | undefined + } + | undefined + success_url?: string | undefined + tax_id_collection?: + | { + enabled: boolean + required?: ("if_supported" | "never") | undefined + } + | undefined + ui_mode?: ("custom" | "embedded" | "hosted") | undefined +} + +export type t_PostCheckoutSessionsSessionParamSchema = { + session: string +} + +export type t_PostCheckoutSessionsSessionRequestBodySchema = { + collected_information?: + | { + shipping_details?: + | { + address: { + city?: string | undefined + country: string + line1: string + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + name: string + } + | undefined + } + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + shipping_options?: + | ( + | { + shipping_rate?: string | undefined + shipping_rate_data?: + | { + delivery_estimate?: + | { + maximum?: + | { + unit: + | "business_day" + | "day" + | "hour" + | "month" + | "week" + value: number + } + | undefined + minimum?: + | { + unit: + | "business_day" + | "day" + | "hour" + | "month" + | "week" + value: number + } + | undefined + } + | undefined + display_name: string + fixed_amount?: + | { + amount: number + currency: string + currency_options?: + | { + [key: string]: + | { + amount: number + tax_behavior?: + | ( + | "exclusive" + | "inclusive" + | "unspecified" + ) + | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + tax_code?: string | undefined + type?: "fixed_amount" | undefined + } + | undefined + }[] + | "" + ) + | undefined +} + +export type t_PostCheckoutSessionsSessionExpireParamSchema = { + session: string +} + +export type t_PostCheckoutSessionsSessionExpireRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostClimateOrdersRequestBodySchema = { + amount?: number | undefined + beneficiary?: + | { + public_name: string + } + | undefined + currency?: string | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + metric_tons?: string | undefined + product: string +} + +export type t_PostClimateOrdersOrderParamSchema = { + order: string +} + +export type t_PostClimateOrdersOrderRequestBodySchema = { + beneficiary?: + | ( + | { + public_name: string | "" + } + | "" + ) + | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostClimateOrdersOrderCancelParamSchema = { + order: string +} + +export type t_PostClimateOrdersOrderCancelRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostCouponsRequestBodySchema = { + amount_off?: number | undefined + applies_to?: + | { + products?: string[] | undefined + } + | undefined + currency?: string | undefined + currency_options?: + | { + [key: string]: + | { + amount_off: number + } + | undefined + } + | undefined + duration?: ("forever" | "once" | "repeating") | undefined + duration_in_months?: number | undefined + expand?: string[] | undefined + id?: string | undefined + max_redemptions?: number | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined + percent_off?: number | undefined + redeem_by?: number | undefined +} + +export type t_PostCouponsCouponParamSchema = { + coupon: string +} + +export type t_PostCouponsCouponRequestBodySchema = { + currency_options?: + | { + [key: string]: + | { + amount_off: number + } + | undefined + } + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined +} + +export type t_PostCreditNotesRequestBodySchema = { + amount?: number | undefined + credit_amount?: number | undefined + effective_at?: number | undefined + email_type?: ("credit_note" | "none") | undefined + expand?: string[] | undefined + invoice: string + lines?: + | { + amount?: number | undefined + description?: string | undefined + invoice_line_item?: string | undefined + quantity?: number | undefined + tax_amounts?: + | ( + | { + amount: number + tax_rate: string + taxable_amount: number + }[] + | "" + ) + | undefined + tax_rates?: (string[] | "") | undefined + type: "custom_line_item" | "invoice_line_item" + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + }[] + | undefined + memo?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + out_of_band_amount?: number | undefined + reason?: + | ("duplicate" | "fraudulent" | "order_change" | "product_unsatisfactory") + | undefined + refund_amount?: number | undefined + refunds?: + | { + amount_refunded?: number | undefined + refund?: string | undefined + }[] + | undefined + shipping_cost?: + | { + shipping_rate?: string | undefined + } + | undefined +} + +export type t_PostCreditNotesIdParamSchema = { + id: string +} + +export type t_PostCreditNotesIdRequestBodySchema = { + expand?: string[] | undefined + memo?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostCreditNotesIdVoidParamSchema = { + id: string +} + +export type t_PostCreditNotesIdVoidRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostCustomerSessionsRequestBodySchema = { + components: { + buy_button?: + | { + enabled: boolean + } + | undefined + payment_element?: + | { + enabled: boolean + features?: + | { + payment_method_allow_redisplay_filters?: + | ("always" | "limited" | "unspecified")[] + | undefined + payment_method_redisplay?: ("disabled" | "enabled") | undefined + payment_method_redisplay_limit?: number | undefined + payment_method_remove?: ("disabled" | "enabled") | undefined + payment_method_save?: ("disabled" | "enabled") | undefined + payment_method_save_usage?: + | ("off_session" | "on_session") + | undefined + } + | undefined + } + | undefined + pricing_table?: + | { + enabled: boolean + } + | undefined + } + customer: string + expand?: string[] | undefined +} + +export type t_PostCustomersRequestBodySchema = { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + balance?: number | undefined + cash_balance?: + | { + settings?: + | { + reconciliation_mode?: + | ("automatic" | "manual" | "merchant_default") + | undefined + } + | undefined + } + | undefined + description?: string | undefined + email?: string | undefined + expand?: string[] | undefined + invoice_prefix?: string | undefined + invoice_settings?: + | { + custom_fields?: + | ( + | { + name: string + value: string + }[] + | "" + ) + | undefined + default_payment_method?: string | undefined + footer?: string | undefined + rendering_options?: + | ( + | { + amount_tax_display?: + | ("" | "exclude_tax" | "include_inclusive_tax") + | undefined + template?: string | undefined + } + | "" + ) + | undefined + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined + next_invoice_sequence?: number | undefined + payment_method?: string | undefined + phone?: string | undefined + preferred_locales?: string[] | undefined + shipping?: + | ( + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + name: string + phone?: string | undefined + } + | "" + ) + | undefined + source?: string | undefined + tax?: + | { + ip_address?: (string | "") | undefined + validate_location?: ("deferred" | "immediately") | undefined + } + | undefined + tax_exempt?: ("" | "exempt" | "none" | "reverse") | undefined + tax_id_data?: + | { + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value: string + }[] + | undefined + test_clock?: string | undefined +} + +export type t_PostCustomersCustomerParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerRequestBodySchema = { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + balance?: number | undefined + bank_account?: + | ( + | { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + account_number: string + country: string + currency?: string | undefined + object?: "bank_account" | undefined + routing_number?: string | undefined + } + | string + ) + | undefined + card?: + | ( + | { + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + cvc?: string | undefined + exp_month: number + exp_year: number + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: string | undefined + number: string + object?: "card" | undefined + } + | string + ) + | undefined + cash_balance?: + | { + settings?: + | { + reconciliation_mode?: + | ("automatic" | "manual" | "merchant_default") + | undefined + } + | undefined + } + | undefined + default_alipay_account?: string | undefined + default_bank_account?: string | undefined + default_card?: string | undefined + default_source?: string | undefined + description?: string | undefined + email?: string | undefined + expand?: string[] | undefined + invoice_prefix?: string | undefined + invoice_settings?: + | { + custom_fields?: + | ( + | { + name: string + value: string + }[] + | "" + ) + | undefined + default_payment_method?: string | undefined + footer?: string | undefined + rendering_options?: + | ( + | { + amount_tax_display?: + | ("" | "exclude_tax" | "include_inclusive_tax") + | undefined + template?: string | undefined + } + | "" + ) + | undefined + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined + next_invoice_sequence?: number | undefined + phone?: string | undefined + preferred_locales?: string[] | undefined + shipping?: + | ( + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + name: string + phone?: string | undefined + } + | "" + ) + | undefined + source?: string | undefined + tax?: + | { + ip_address?: (string | "") | undefined + validate_location?: ("auto" | "deferred" | "immediately") | undefined + } + | undefined + tax_exempt?: ("" | "exempt" | "none" | "reverse") | undefined +} + +export type t_PostCustomersCustomerBalanceTransactionsParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerBalanceTransactionsRequestBodySchema = { + amount: number + currency: string + description?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostCustomersCustomerBalanceTransactionsTransactionParamSchema = { + customer: string + transaction: string +} + +export type t_PostCustomersCustomerBalanceTransactionsTransactionRequestBodySchema = + { + description?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + } + +export type t_PostCustomersCustomerBankAccountsParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerBankAccountsRequestBodySchema = { + alipay_account?: string | undefined + bank_account?: + | ( + | { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + account_number: string + country: string + currency?: string | undefined + object?: "bank_account" | undefined + routing_number?: string | undefined + } + | string + ) + | undefined + card?: + | ( + | { + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + cvc?: string | undefined + exp_month: number + exp_year: number + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: string | undefined + number: string + object?: "card" | undefined + } + | string + ) + | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + source?: string | undefined +} + +export type t_PostCustomersCustomerBankAccountsIdParamSchema = { + customer: string + id: string +} + +export type t_PostCustomersCustomerBankAccountsIdRequestBodySchema = { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + exp_month?: string | undefined + exp_year?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined + owner?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + email?: string | undefined + name?: string | undefined + phone?: string | undefined + } + | undefined +} + +export type t_PostCustomersCustomerBankAccountsIdVerifyParamSchema = { + customer: string + id: string +} + +export type t_PostCustomersCustomerBankAccountsIdVerifyRequestBodySchema = { + amounts?: number[] | undefined + expand?: string[] | undefined +} + +export type t_PostCustomersCustomerCardsParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerCardsRequestBodySchema = { + alipay_account?: string | undefined + bank_account?: + | ( + | { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + account_number: string + country: string + currency?: string | undefined + object?: "bank_account" | undefined + routing_number?: string | undefined + } + | string + ) + | undefined + card?: + | ( + | { + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + cvc?: string | undefined + exp_month: number + exp_year: number + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: string | undefined + number: string + object?: "card" | undefined + } + | string + ) + | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + source?: string | undefined +} + +export type t_PostCustomersCustomerCardsIdParamSchema = { + customer: string + id: string +} + +export type t_PostCustomersCustomerCardsIdRequestBodySchema = { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + exp_month?: string | undefined + exp_year?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined + owner?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + email?: string | undefined + name?: string | undefined + phone?: string | undefined + } + | undefined +} + +export type t_PostCustomersCustomerCashBalanceParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerCashBalanceRequestBodySchema = { + expand?: string[] | undefined + settings?: + | { + reconciliation_mode?: + | ("automatic" | "manual" | "merchant_default") + | undefined + } + | undefined +} + +export type t_PostCustomersCustomerFundingInstructionsParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerFundingInstructionsRequestBodySchema = { + bank_transfer: { + eu_bank_transfer?: + | { + country: string + } + | undefined + requested_address_types?: + | ("iban" | "sort_code" | "spei" | "zengin")[] + | undefined + type: + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" + } + currency: string + expand?: string[] | undefined + funding_type: "bank_transfer" +} + +export type t_PostCustomersCustomerSourcesParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerSourcesRequestBodySchema = { + alipay_account?: string | undefined + bank_account?: + | ( + | { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + account_number: string + country: string + currency?: string | undefined + object?: "bank_account" | undefined + routing_number?: string | undefined + } + | string + ) + | undefined + card?: + | ( + | { + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + cvc?: string | undefined + exp_month: number + exp_year: number + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: string | undefined + number: string + object?: "card" | undefined + } + | string + ) + | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + source?: string | undefined +} + +export type t_PostCustomersCustomerSourcesIdParamSchema = { + customer: string + id: string +} + +export type t_PostCustomersCustomerSourcesIdRequestBodySchema = { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + exp_month?: string | undefined + exp_year?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined + owner?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + email?: string | undefined + name?: string | undefined + phone?: string | undefined + } + | undefined +} + +export type t_PostCustomersCustomerSourcesIdVerifyParamSchema = { + customer: string + id: string +} + +export type t_PostCustomersCustomerSourcesIdVerifyRequestBodySchema = { + amounts?: number[] | undefined + expand?: string[] | undefined +} + +export type t_PostCustomersCustomerSubscriptionsParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerSubscriptionsRequestBodySchema = { + add_invoice_items?: + | { + discounts?: + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + application_fee_percent?: (number | "") | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + backdate_start_date?: number | undefined + billing_cycle_anchor?: number | undefined + cancel_at?: number | undefined + cancel_at_period_end?: boolean | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + currency?: string | undefined + days_until_due?: number | undefined + default_payment_method?: string | undefined + default_source?: string | undefined + default_tax_rates?: (string[] | "") | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + items?: + | { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + off_session?: boolean | undefined + payment_behavior?: + | ( + | "allow_incomplete" + | "default_incomplete" + | "error_if_incomplete" + | "pending_if_incomplete" + ) + | undefined + payment_settings?: + | { + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + transaction_type?: + | ("business" | "personal") + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: + | ("de" | "en" | "fr" | "nl") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + mandate_options?: + | { + amount?: number | undefined + amount_type?: ("fixed" | "maximum") | undefined + description?: string | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + type?: string | undefined + } + | undefined + funding_type?: string | undefined + } + | "" + ) + | undefined + konbini?: (EmptyObject | "") | undefined + sepa_debit?: (EmptyObject | "") | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: + | ( + | ( + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "jp_credit_transfer" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "p24" + | "payco" + | "paynow" + | "paypal" + | "promptpay" + | "revolut_pay" + | "sepa_credit_transfer" + | "sepa_debit" + | "sofort" + | "swish" + | "us_bank_account" + | "wechat_pay" + )[] + | "" + ) + | undefined + save_default_payment_method?: ("off" | "on_subscription") | undefined + } + | undefined + pending_invoice_item_interval?: + | ( + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + | "" + ) + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + transfer_data?: + | { + amount_percent?: number | undefined + destination: string + } + | undefined + trial_end?: ("now" | number) | undefined + trial_from_plan?: boolean | undefined + trial_period_days?: number | undefined + trial_settings?: + | { + end_behavior: { + missing_payment_method: "cancel" | "create_invoice" | "pause" + } + } + | undefined +} + +export type t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdParamSchema = + { + customer: string + subscription_exposed_id: string + } + +export type t_PostCustomersCustomerSubscriptionsSubscriptionExposedIdRequestBodySchema = + { + add_invoice_items?: + | { + discounts?: + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + application_fee_percent?: (number | "") | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_cycle_anchor?: ("now" | "unchanged") | undefined + cancel_at?: (number | "") | undefined + cancel_at_period_end?: boolean | undefined + cancellation_details?: + | { + comment?: (string | "") | undefined + feedback?: + | ( + | "" + | "customer_service" + | "low_quality" + | "missing_features" + | "other" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + ) + | undefined + } + | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + days_until_due?: number | undefined + default_payment_method?: string | undefined + default_source?: (string | "") | undefined + default_tax_rates?: (string[] | "") | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + items?: + | { + clear_usage?: boolean | undefined + deleted?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + id?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + off_session?: boolean | undefined + pause_collection?: + | ( + | { + behavior: "keep_as_draft" | "mark_uncollectible" | "void" + resumes_at?: number | undefined + } + | "" + ) + | undefined + payment_behavior?: + | ( + | "allow_incomplete" + | "default_incomplete" + | "error_if_incomplete" + | "pending_if_incomplete" + ) + | undefined + payment_settings?: + | { + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + transaction_type?: + | ("business" | "personal") + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: + | ("de" | "en" | "fr" | "nl") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + mandate_options?: + | { + amount?: number | undefined + amount_type?: ("fixed" | "maximum") | undefined + description?: string | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + type?: string | undefined + } + | undefined + funding_type?: string | undefined + } + | "" + ) + | undefined + konbini?: (EmptyObject | "") | undefined + sepa_debit?: (EmptyObject | "") | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ( + | "balances" + | "ownership" + | "transactions" + )[] + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: + | ( + | ( + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "jp_credit_transfer" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "p24" + | "payco" + | "paynow" + | "paypal" + | "promptpay" + | "revolut_pay" + | "sepa_credit_transfer" + | "sepa_debit" + | "sofort" + | "swish" + | "us_bank_account" + | "wechat_pay" + )[] + | "" + ) + | undefined + save_default_payment_method?: ("off" | "on_subscription") | undefined + } + | undefined + pending_invoice_item_interval?: + | ( + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + | "" + ) + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + proration_date?: number | undefined + transfer_data?: + | ( + | { + amount_percent?: number | undefined + destination: string + } + | "" + ) + | undefined + trial_end?: ("now" | number) | undefined + trial_from_plan?: boolean | undefined + trial_settings?: + | { + end_behavior: { + missing_payment_method: "cancel" | "create_invoice" | "pause" + } + } + | undefined + } + +export type t_PostCustomersCustomerTaxIdsParamSchema = { + customer: string +} + +export type t_PostCustomersCustomerTaxIdsRequestBodySchema = { + expand?: string[] | undefined + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value: string +} + +export type t_PostDisputesDisputeParamSchema = { + dispute: string +} + +export type t_PostDisputesDisputeRequestBodySchema = { + evidence?: + | { + access_activity_log?: string | undefined + billing_address?: string | undefined + cancellation_policy?: string | undefined + cancellation_policy_disclosure?: string | undefined + cancellation_rebuttal?: string | undefined + customer_communication?: string | undefined + customer_email_address?: string | undefined + customer_name?: string | undefined + customer_purchase_ip?: string | undefined + customer_signature?: string | undefined + duplicate_charge_documentation?: string | undefined + duplicate_charge_explanation?: string | undefined + duplicate_charge_id?: string | undefined + enhanced_evidence?: + | ( + | { + visa_compelling_evidence_3?: + | { + disputed_transaction?: + | { + customer_account_id?: (string | "") | undefined + customer_device_fingerprint?: + | (string | "") + | undefined + customer_device_id?: (string | "") | undefined + customer_email_address?: (string | "") | undefined + customer_purchase_ip?: (string | "") | undefined + merchandise_or_services?: + | ("merchandise" | "services") + | undefined + product_description?: (string | "") | undefined + shipping_address?: + | { + city?: (string | "") | undefined + country?: (string | "") | undefined + line1?: (string | "") | undefined + line2?: (string | "") | undefined + postal_code?: (string | "") | undefined + state?: (string | "") | undefined + } + | undefined + } + | undefined + prior_undisputed_transactions?: + | { + charge: string + customer_account_id?: (string | "") | undefined + customer_device_fingerprint?: + | (string | "") + | undefined + customer_device_id?: (string | "") | undefined + customer_email_address?: (string | "") | undefined + customer_purchase_ip?: (string | "") | undefined + product_description?: (string | "") | undefined + shipping_address?: + | { + city?: (string | "") | undefined + country?: (string | "") | undefined + line1?: (string | "") | undefined + line2?: (string | "") | undefined + postal_code?: (string | "") | undefined + state?: (string | "") | undefined + } + | undefined + }[] + | undefined + } + | undefined + visa_compliance?: + | { + fee_acknowledged?: boolean | undefined + } + | undefined + } + | "" + ) + | undefined + product_description?: string | undefined + receipt?: string | undefined + refund_policy?: string | undefined + refund_policy_disclosure?: string | undefined + refund_refusal_explanation?: string | undefined + service_date?: string | undefined + service_documentation?: string | undefined + shipping_address?: string | undefined + shipping_carrier?: string | undefined + shipping_date?: string | undefined + shipping_documentation?: string | undefined + shipping_tracking_number?: string | undefined + uncategorized_file?: string | undefined + uncategorized_text?: string | undefined + } + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + submit?: boolean | undefined +} + +export type t_PostDisputesDisputeCloseParamSchema = { + dispute: string +} + +export type t_PostDisputesDisputeCloseRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostEntitlementsFeaturesRequestBodySchema = { + expand?: string[] | undefined + lookup_key: string + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string +} + +export type t_PostEntitlementsFeaturesIdParamSchema = { + id: string +} + +export type t_PostEntitlementsFeaturesIdRequestBodySchema = { + active?: boolean | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined +} + +export type t_PostEphemeralKeysRequestBodySchema = { + customer?: string | undefined + expand?: string[] | undefined + issuing_card?: string | undefined + nonce?: string | undefined + verification_session?: string | undefined +} + +export type t_PostExternalAccountsIdParamSchema = { + id: string +} + +export type t_PostExternalAccountsIdRequestBodySchema = { + account_holder_name?: string | undefined + account_holder_type?: ("" | "company" | "individual") | undefined + account_type?: ("checking" | "futsu" | "savings" | "toza") | undefined + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + default_for_currency?: boolean | undefined + documents?: + | { + bank_account_ownership_verification?: + | { + files?: string[] | undefined + } + | undefined + } + | undefined + exp_month?: string | undefined + exp_year?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined +} + +export type t_PostFileLinksRequestBodySchema = { + expand?: string[] | undefined + expires_at?: number | undefined + file: string + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostFileLinksLinkParamSchema = { + link: string +} + +export type t_PostFileLinksLinkRequestBodySchema = { + expand?: string[] | undefined + expires_at?: ("now" | number | "") | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostFilesRequestBodySchema = { + expand?: string[] | undefined + file: string + file_link_data?: + | { + create: boolean + expires_at?: number | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + } + | undefined + purpose: + | "account_requirement" + | "additional_verification" + | "business_icon" + | "business_logo" + | "customer_signature" + | "dispute_evidence" + | "identity_document" + | "issuing_regulatory_reporting" + | "pci_document" + | "tax_document_user_upload" + | "terminal_reader_splashscreen" +} + +export type t_PostFinancialConnectionsAccountsAccountDisconnectParamSchema = { + account: string +} + +export type t_PostFinancialConnectionsAccountsAccountDisconnectRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostFinancialConnectionsAccountsAccountRefreshParamSchema = { + account: string +} + +export type t_PostFinancialConnectionsAccountsAccountRefreshRequestBodySchema = + { + expand?: string[] | undefined + features: ("balance" | "ownership" | "transactions")[] + } + +export type t_PostFinancialConnectionsAccountsAccountSubscribeParamSchema = { + account: string +} + +export type t_PostFinancialConnectionsAccountsAccountSubscribeRequestBodySchema = + { + expand?: string[] | undefined + features: "transactions"[] + } + +export type t_PostFinancialConnectionsAccountsAccountUnsubscribeParamSchema = { + account: string +} + +export type t_PostFinancialConnectionsAccountsAccountUnsubscribeRequestBodySchema = + { + expand?: string[] | undefined + features: "transactions"[] + } + +export type t_PostFinancialConnectionsSessionsRequestBodySchema = { + account_holder: { + account?: string | undefined + customer?: string | undefined + type: "account" | "customer" + } + expand?: string[] | undefined + filters?: + | { + account_subcategories?: + | ( + | "checking" + | "credit_card" + | "line_of_credit" + | "mortgage" + | "savings" + )[] + | undefined + countries?: string[] | undefined + } + | undefined + permissions: ("balances" | "ownership" | "payment_method" | "transactions")[] + prefetch?: ("balances" | "ownership" | "transactions")[] | undefined + return_url?: string | undefined +} + +export type t_PostForwardingRequestsRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + payment_method: string + replacements: ( + | "card_cvc" + | "card_expiry" + | "card_number" + | "cardholder_name" + | "request_signature" + )[] + request?: + | { + body?: string | undefined + headers?: + | { + name: string + value: string + }[] + | undefined + } + | undefined + url: string +} + +export type t_PostIdentityVerificationSessionsRequestBodySchema = { + client_reference_id?: string | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + options?: + | { + document?: + | ( + | { + allowed_types?: + | ("driving_license" | "id_card" | "passport")[] + | undefined + require_id_number?: boolean | undefined + require_live_capture?: boolean | undefined + require_matching_selfie?: boolean | undefined + } + | "" + ) + | undefined + } + | undefined + provided_details?: + | { + email?: string | undefined + phone?: string | undefined + } + | undefined + related_customer?: string | undefined + return_url?: string | undefined + type?: ("document" | "id_number") | undefined + verification_flow?: string | undefined +} + +export type t_PostIdentityVerificationSessionsSessionParamSchema = { + session: string +} + +export type t_PostIdentityVerificationSessionsSessionRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + options?: + | { + document?: + | ( + | { + allowed_types?: + | ("driving_license" | "id_card" | "passport")[] + | undefined + require_id_number?: boolean | undefined + require_live_capture?: boolean | undefined + require_matching_selfie?: boolean | undefined + } + | "" + ) + | undefined + } + | undefined + provided_details?: + | { + email?: string | undefined + phone?: string | undefined + } + | undefined + type?: ("document" | "id_number") | undefined +} + +export type t_PostIdentityVerificationSessionsSessionCancelParamSchema = { + session: string +} + +export type t_PostIdentityVerificationSessionsSessionCancelRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostIdentityVerificationSessionsSessionRedactParamSchema = { + session: string +} + +export type t_PostIdentityVerificationSessionsSessionRedactRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostInvoiceRenderingTemplatesTemplateArchiveParamSchema = { + template: string +} + +export type t_PostInvoiceRenderingTemplatesTemplateArchiveRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostInvoiceRenderingTemplatesTemplateUnarchiveParamSchema = { + template: string +} + +export type t_PostInvoiceRenderingTemplatesTemplateUnarchiveRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostInvoiceitemsRequestBodySchema = { + amount?: number | undefined + currency?: string | undefined + customer: string + description?: string | undefined + discountable?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + invoice?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + period?: + | { + end: number + start: number + } + | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + pricing?: + | { + price?: string | undefined + } + | undefined + quantity?: number | undefined + subscription?: string | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + tax_code?: (string | "") | undefined + tax_rates?: string[] | undefined + unit_amount_decimal?: string | undefined +} + +export type t_PostInvoiceitemsInvoiceitemParamSchema = { + invoiceitem: string +} + +export type t_PostInvoiceitemsInvoiceitemRequestBodySchema = { + amount?: number | undefined + description?: string | undefined + discountable?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + period?: + | { + end: number + start: number + } + | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + pricing?: + | { + price?: string | undefined + } + | undefined + quantity?: number | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + tax_code?: (string | "") | undefined + tax_rates?: (string[] | "") | undefined + unit_amount_decimal?: string | undefined +} + +export type t_PostInvoicesRequestBodySchema = { + account_tax_ids?: (string[] | "") | undefined + application_fee_amount?: number | undefined + auto_advance?: boolean | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + automatically_finalizes_at?: number | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + currency?: string | undefined + custom_fields?: + | ( + | { + name: string + value: string + }[] + | "" + ) + | undefined + customer?: string | undefined + days_until_due?: number | undefined + default_payment_method?: string | undefined + default_source?: string | undefined + default_tax_rates?: string[] | undefined + description?: string | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + due_date?: number | undefined + effective_at?: number | undefined + expand?: string[] | undefined + footer?: string | undefined + from_invoice?: + | { + action: "revision" + invoice: string + } + | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + number?: string | undefined + on_behalf_of?: string | undefined + payment_settings?: + | { + default_mandate?: (string | "") | undefined + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + transaction_type?: + | ("business" | "personal") + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: + | ("de" | "en" | "fr" | "nl") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + installments?: + | { + enabled?: boolean | undefined + plan?: + | ( + | { + count?: number | undefined + interval?: "month" | undefined + type: "fixed_count" + } + | "" + ) + | undefined + } + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + type?: string | undefined + } + | undefined + funding_type?: string | undefined + } + | "" + ) + | undefined + konbini?: (EmptyObject | "") | undefined + sepa_debit?: (EmptyObject | "") | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: + | ( + | ( + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "jp_credit_transfer" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "p24" + | "payco" + | "paynow" + | "paypal" + | "promptpay" + | "revolut_pay" + | "sepa_credit_transfer" + | "sepa_debit" + | "sofort" + | "swish" + | "us_bank_account" + | "wechat_pay" + )[] + | "" + ) + | undefined + } + | undefined + pending_invoice_items_behavior?: ("exclude" | "include") | undefined + rendering?: + | { + amount_tax_display?: + | ("" | "exclude_tax" | "include_inclusive_tax") + | undefined + pdf?: + | { + page_size?: ("a4" | "auto" | "letter") | undefined + } + | undefined + template?: string | undefined + template_version?: (number | "") | undefined + } + | undefined + shipping_cost?: + | { + shipping_rate?: string | undefined + shipping_rate_data?: + | { + delivery_estimate?: + | { + maximum?: + | { + unit: + | "business_day" + | "day" + | "hour" + | "month" + | "week" + value: number + } + | undefined + minimum?: + | { + unit: + | "business_day" + | "day" + | "hour" + | "month" + | "week" + value: number + } + | undefined + } + | undefined + display_name: string + fixed_amount?: + | { + amount: number + currency: string + currency_options?: + | { + [key: string]: + | { + amount: number + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + tax_code?: string | undefined + type?: "fixed_amount" | undefined + } + | undefined + } + | undefined + shipping_details?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + name: string + phone?: (string | "") | undefined + } + | undefined + statement_descriptor?: string | undefined + subscription?: string | undefined + transfer_data?: + | { + amount?: number | undefined + destination: string + } + | undefined +} + +export type t_PostInvoicesCreatePreviewRequestBodySchema = { + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + currency?: string | undefined + customer?: string | undefined + customer_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + shipping?: + | ( + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + name: string + phone?: string | undefined + } + | "" + ) + | undefined + tax?: + | { + ip_address?: (string | "") | undefined + } + | undefined + tax_exempt?: ("" | "exempt" | "none" | "reverse") | undefined + tax_ids?: + | { + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value: string + }[] + | undefined + } + | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + invoice_items?: + | { + amount?: number | undefined + currency?: string | undefined + description?: string | undefined + discountable?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + invoiceitem?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + period?: + | { + end: number + start: number + } + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + tax_code?: (string | "") | undefined + tax_rates?: (string[] | "") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + }[] + | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + on_behalf_of?: (string | "") | undefined + preview_mode?: ("next" | "recurring") | undefined + schedule?: string | undefined + schedule_details?: + | { + end_behavior?: ("cancel" | "release") | undefined + phases?: + | { + add_invoice_items?: + | { + discounts?: + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + application_fee_percent?: number | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_cycle_anchor?: ("automatic" | "phase_start") | undefined + collection_method?: + | ("charge_automatically" | "send_invoice") + | undefined + default_payment_method?: string | undefined + default_tax_rates?: (string[] | "") | undefined + description?: (string | "") | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + end_date?: (number | "now") | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + days_until_due?: number | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + items: { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + iterations?: number | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: string | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + start_date?: (number | "now") | undefined + transfer_data?: + | { + amount_percent?: number | undefined + destination: string + } + | undefined + trial?: boolean | undefined + trial_end?: (number | "now") | undefined + }[] + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + } + | undefined + subscription?: string | undefined + subscription_details?: + | { + billing_cycle_anchor?: ("now" | "unchanged" | number) | undefined + cancel_at?: (number | "") | undefined + cancel_at_period_end?: boolean | undefined + cancel_now?: boolean | undefined + default_tax_rates?: (string[] | "") | undefined + items?: + | { + clear_usage?: boolean | undefined + deleted?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + id?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + proration_date?: number | undefined + resume_at?: "now" | undefined + start_date?: number | undefined + trial_end?: ("now" | number) | undefined + } + | undefined +} + +export type t_PostInvoicesInvoiceParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoiceRequestBodySchema = { + account_tax_ids?: (string[] | "") | undefined + application_fee_amount?: number | undefined + auto_advance?: boolean | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + automatically_finalizes_at?: number | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + custom_fields?: + | ( + | { + name: string + value: string + }[] + | "" + ) + | undefined + days_until_due?: number | undefined + default_payment_method?: string | undefined + default_source?: (string | "") | undefined + default_tax_rates?: (string[] | "") | undefined + description?: string | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + due_date?: number | undefined + effective_at?: (number | "") | undefined + expand?: string[] | undefined + footer?: string | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + number?: (string | "") | undefined + on_behalf_of?: (string | "") | undefined + payment_settings?: + | { + default_mandate?: (string | "") | undefined + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + transaction_type?: + | ("business" | "personal") + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: + | ("de" | "en" | "fr" | "nl") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + installments?: + | { + enabled?: boolean | undefined + plan?: + | ( + | { + count?: number | undefined + interval?: "month" | undefined + type: "fixed_count" + } + | "" + ) + | undefined + } + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + type?: string | undefined + } + | undefined + funding_type?: string | undefined + } + | "" + ) + | undefined + konbini?: (EmptyObject | "") | undefined + sepa_debit?: (EmptyObject | "") | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: + | ( + | ( + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "jp_credit_transfer" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "p24" + | "payco" + | "paynow" + | "paypal" + | "promptpay" + | "revolut_pay" + | "sepa_credit_transfer" + | "sepa_debit" + | "sofort" + | "swish" + | "us_bank_account" + | "wechat_pay" + )[] + | "" + ) + | undefined + } + | undefined + rendering?: + | { + amount_tax_display?: + | ("" | "exclude_tax" | "include_inclusive_tax") + | undefined + pdf?: + | { + page_size?: ("a4" | "auto" | "letter") | undefined + } + | undefined + template?: string | undefined + template_version?: (number | "") | undefined + } + | undefined + shipping_cost?: + | ( + | { + shipping_rate?: string | undefined + shipping_rate_data?: + | { + delivery_estimate?: + | { + maximum?: + | { + unit: + | "business_day" + | "day" + | "hour" + | "month" + | "week" + value: number + } + | undefined + minimum?: + | { + unit: + | "business_day" + | "day" + | "hour" + | "month" + | "week" + value: number + } + | undefined + } + | undefined + display_name: string + fixed_amount?: + | { + amount: number + currency: string + currency_options?: + | { + [key: string]: + | { + amount: number + tax_behavior?: + | ( + | "exclusive" + | "inclusive" + | "unspecified" + ) + | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + tax_code?: string | undefined + type?: "fixed_amount" | undefined + } + | undefined + } + | "" + ) + | undefined + shipping_details?: + | ( + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + name: string + phone?: (string | "") | undefined + } + | "" + ) + | undefined + statement_descriptor?: string | undefined + transfer_data?: + | ( + | { + amount?: number | undefined + destination: string + } + | "" + ) + | undefined +} + +export type t_PostInvoicesInvoiceAddLinesParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoiceAddLinesRequestBodySchema = { + expand?: string[] | undefined + invoice_metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + lines: { + amount?: number | undefined + description?: string | undefined + discountable?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + invoice_item?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + period?: + | { + end: number + start: number + } + | undefined + price_data?: + | { + currency: string + product?: string | undefined + product_data?: + | { + description?: string | undefined + images?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string + tax_code?: string | undefined + } + | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + pricing?: + | { + price?: string | undefined + } + | undefined + quantity?: number | undefined + tax_amounts?: + | ( + | { + amount: number + tax_rate_data: { + country?: string | undefined + description?: string | undefined + display_name: string + inclusive: boolean + jurisdiction?: string | undefined + jurisdiction_level?: + | ( + | "city" + | "country" + | "county" + | "district" + | "multiple" + | "state" + ) + | undefined + percentage: number + state?: string | undefined + tax_type?: + | ( + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "retail_delivery_fee" + | "rst" + | "sales_tax" + | "service_tax" + | "vat" + ) + | undefined + } + taxability_reason?: + | ( + | "customer_exempt" + | "not_collecting" + | "not_subject_to_tax" + | "not_supported" + | "portion_product_exempt" + | "portion_reduced_rated" + | "portion_standard_rated" + | "product_exempt" + | "product_exempt_holiday" + | "proportionally_rated" + | "reduced_rated" + | "reverse_charge" + | "standard_rated" + | "taxable_basis_reduced" + | "zero_rated" + ) + | undefined + taxable_amount: number + }[] + | "" + ) + | undefined + tax_rates?: (string[] | "") | undefined + }[] +} + +export type t_PostInvoicesInvoiceFinalizeParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoiceFinalizeRequestBodySchema = { + auto_advance?: boolean | undefined + expand?: string[] | undefined +} + +export type t_PostInvoicesInvoiceLinesLineItemIdParamSchema = { + invoice: string + line_item_id: string +} + +export type t_PostInvoicesInvoiceLinesLineItemIdRequestBodySchema = { + amount?: number | undefined + description?: string | undefined + discountable?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + period?: + | { + end: number + start: number + } + | undefined + price_data?: + | { + currency: string + product?: string | undefined + product_data?: + | { + description?: string | undefined + images?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string + tax_code?: string | undefined + } + | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + pricing?: + | { + price?: string | undefined + } + | undefined + quantity?: number | undefined + tax_amounts?: + | ( + | { + amount: number + tax_rate_data: { + country?: string | undefined + description?: string | undefined + display_name: string + inclusive: boolean + jurisdiction?: string | undefined + jurisdiction_level?: + | ( + | "city" + | "country" + | "county" + | "district" + | "multiple" + | "state" + ) + | undefined + percentage: number + state?: string | undefined + tax_type?: + | ( + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "retail_delivery_fee" + | "rst" + | "sales_tax" + | "service_tax" + | "vat" + ) + | undefined + } + taxability_reason?: + | ( + | "customer_exempt" + | "not_collecting" + | "not_subject_to_tax" + | "not_supported" + | "portion_product_exempt" + | "portion_reduced_rated" + | "portion_standard_rated" + | "product_exempt" + | "product_exempt_holiday" + | "proportionally_rated" + | "reduced_rated" + | "reverse_charge" + | "standard_rated" + | "taxable_basis_reduced" + | "zero_rated" + ) + | undefined + taxable_amount: number + }[] + | "" + ) + | undefined + tax_rates?: (string[] | "") | undefined +} + +export type t_PostInvoicesInvoiceMarkUncollectibleParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoiceMarkUncollectibleRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostInvoicesInvoicePayParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoicePayRequestBodySchema = { + expand?: string[] | undefined + forgive?: boolean | undefined + mandate?: (string | "") | undefined + off_session?: boolean | undefined + paid_out_of_band?: boolean | undefined + payment_method?: string | undefined + source?: string | undefined +} + +export type t_PostInvoicesInvoiceRemoveLinesParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoiceRemoveLinesRequestBodySchema = { + expand?: string[] | undefined + invoice_metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + lines: { + behavior: "delete" | "unassign" + id: string + }[] +} + +export type t_PostInvoicesInvoiceSendParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoiceSendRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostInvoicesInvoiceUpdateLinesParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoiceUpdateLinesRequestBodySchema = { + expand?: string[] | undefined + invoice_metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + lines: { + amount?: number | undefined + description?: string | undefined + discountable?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + id: string + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + period?: + | { + end: number + start: number + } + | undefined + price_data?: + | { + currency: string + product?: string | undefined + product_data?: + | { + description?: string | undefined + images?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string + tax_code?: string | undefined + } + | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + pricing?: + | { + price?: string | undefined + } + | undefined + quantity?: number | undefined + tax_amounts?: + | ( + | { + amount: number + tax_rate_data: { + country?: string | undefined + description?: string | undefined + display_name: string + inclusive: boolean + jurisdiction?: string | undefined + jurisdiction_level?: + | ( + | "city" + | "country" + | "county" + | "district" + | "multiple" + | "state" + ) + | undefined + percentage: number + state?: string | undefined + tax_type?: + | ( + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "retail_delivery_fee" + | "rst" + | "sales_tax" + | "service_tax" + | "vat" + ) + | undefined + } + taxability_reason?: + | ( + | "customer_exempt" + | "not_collecting" + | "not_subject_to_tax" + | "not_supported" + | "portion_product_exempt" + | "portion_reduced_rated" + | "portion_standard_rated" + | "product_exempt" + | "product_exempt_holiday" + | "proportionally_rated" + | "reduced_rated" + | "reverse_charge" + | "standard_rated" + | "taxable_basis_reduced" + | "zero_rated" + ) + | undefined + taxable_amount: number + }[] + | "" + ) + | undefined + tax_rates?: (string[] | "") | undefined + }[] +} + +export type t_PostInvoicesInvoiceVoidParamSchema = { + invoice: string +} + +export type t_PostInvoicesInvoiceVoidRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostIssuingAuthorizationsAuthorizationParamSchema = { + authorization: string +} + +export type t_PostIssuingAuthorizationsAuthorizationRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostIssuingAuthorizationsAuthorizationApproveParamSchema = { + authorization: string +} + +export type t_PostIssuingAuthorizationsAuthorizationApproveRequestBodySchema = { + amount?: number | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostIssuingAuthorizationsAuthorizationDeclineParamSchema = { + authorization: string +} + +export type t_PostIssuingAuthorizationsAuthorizationDeclineRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostIssuingCardholdersRequestBodySchema = { + billing: { + address: { + city: string + country: string + line1: string + line2?: string | undefined + postal_code: string + state?: string | undefined + } + } + company?: + | { + tax_id?: string | undefined + } + | undefined + email?: string | undefined + expand?: string[] | undefined + individual?: + | { + card_issuing?: + | { + user_terms_acceptance?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + dob?: + | { + day: number + month: number + year: number + } + | undefined + first_name?: string | undefined + last_name?: string | undefined + verification?: + | { + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string + phone_number?: string | undefined + preferred_locales?: ("de" | "en" | "es" | "fr" | "it")[] | undefined + spending_controls?: + | { + allowed_categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + allowed_merchant_countries?: string[] | undefined + blocked_categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + blocked_merchant_countries?: string[] | undefined + spending_limits?: + | { + amount: number + categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + interval: + | "all_time" + | "daily" + | "monthly" + | "per_authorization" + | "weekly" + | "yearly" + }[] + | undefined + spending_limits_currency?: string | undefined + } + | undefined + status?: ("active" | "inactive") | undefined + type?: ("company" | "individual") | undefined +} + +export type t_PostIssuingCardholdersCardholderParamSchema = { + cardholder: string +} + +export type t_PostIssuingCardholdersCardholderRequestBodySchema = { + billing?: + | { + address: { + city: string + country: string + line1: string + line2?: string | undefined + postal_code: string + state?: string | undefined + } + } + | undefined + company?: + | { + tax_id?: string | undefined + } + | undefined + email?: string | undefined + expand?: string[] | undefined + individual?: + | { + card_issuing?: + | { + user_terms_acceptance?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + dob?: + | { + day: number + month: number + year: number + } + | undefined + first_name?: string | undefined + last_name?: string | undefined + verification?: + | { + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + phone_number?: string | undefined + preferred_locales?: ("de" | "en" | "es" | "fr" | "it")[] | undefined + spending_controls?: + | { + allowed_categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + allowed_merchant_countries?: string[] | undefined + blocked_categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + blocked_merchant_countries?: string[] | undefined + spending_limits?: + | { + amount: number + categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + interval: + | "all_time" + | "daily" + | "monthly" + | "per_authorization" + | "weekly" + | "yearly" + }[] + | undefined + spending_limits_currency?: string | undefined + } + | undefined + status?: ("active" | "inactive") | undefined +} + +export type t_PostIssuingCardsRequestBodySchema = { + cardholder?: string | undefined + currency: string + expand?: string[] | undefined + financial_account?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + personalization_design?: string | undefined + pin?: + | { + encrypted_number?: string | undefined + } + | undefined + replacement_for?: string | undefined + replacement_reason?: ("damaged" | "expired" | "lost" | "stolen") | undefined + second_line?: (string | "") | undefined + shipping?: + | { + address: { + city: string + country: string + line1: string + line2?: string | undefined + postal_code: string + state?: string | undefined + } + address_validation?: + | { + mode: + | "disabled" + | "normalization_only" + | "validation_and_normalization" + } + | undefined + customs?: + | { + eori_number?: string | undefined + } + | undefined + name: string + phone_number?: string | undefined + require_signature?: boolean | undefined + service?: ("express" | "priority" | "standard") | undefined + type?: ("bulk" | "individual") | undefined + } + | undefined + spending_controls?: + | { + allowed_categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + allowed_merchant_countries?: string[] | undefined + blocked_categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + blocked_merchant_countries?: string[] | undefined + spending_limits?: + | { + amount: number + categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + interval: + | "all_time" + | "daily" + | "monthly" + | "per_authorization" + | "weekly" + | "yearly" + }[] + | undefined + } + | undefined + status?: ("active" | "inactive") | undefined + type: "physical" | "virtual" +} + +export type t_PostIssuingCardsCardParamSchema = { + card: string +} + +export type t_PostIssuingCardsCardRequestBodySchema = { + cancellation_reason?: ("lost" | "stolen") | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + personalization_design?: string | undefined + pin?: + | { + encrypted_number?: string | undefined + } + | undefined + shipping?: + | { + address: { + city: string + country: string + line1: string + line2?: string | undefined + postal_code: string + state?: string | undefined + } + address_validation?: + | { + mode: + | "disabled" + | "normalization_only" + | "validation_and_normalization" + } + | undefined + customs?: + | { + eori_number?: string | undefined + } + | undefined + name: string + phone_number?: string | undefined + require_signature?: boolean | undefined + service?: ("express" | "priority" | "standard") | undefined + type?: ("bulk" | "individual") | undefined + } + | undefined + spending_controls?: + | { + allowed_categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + allowed_merchant_countries?: string[] | undefined + blocked_categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + blocked_merchant_countries?: string[] | undefined + spending_limits?: + | { + amount: number + categories?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + )[] + | undefined + interval: + | "all_time" + | "daily" + | "monthly" + | "per_authorization" + | "weekly" + | "yearly" + }[] + | undefined + } + | undefined + status?: ("active" | "canceled" | "inactive") | undefined +} + +export type t_PostIssuingDisputesRequestBodySchema = { + amount?: number | undefined + evidence?: + | { + canceled?: + | ( + | { + additional_documentation?: (string | "") | undefined + canceled_at?: (number | "") | undefined + cancellation_policy_provided?: (boolean | "") | undefined + cancellation_reason?: (string | "") | undefined + expected_at?: (number | "") | undefined + explanation?: (string | "") | undefined + product_description?: (string | "") | undefined + product_type?: ("" | "merchandise" | "service") | undefined + return_status?: + | ("" | "merchant_rejected" | "successful") + | undefined + returned_at?: (number | "") | undefined + } + | "" + ) + | undefined + duplicate?: + | ( + | { + additional_documentation?: (string | "") | undefined + card_statement?: (string | "") | undefined + cash_receipt?: (string | "") | undefined + check_image?: (string | "") | undefined + explanation?: (string | "") | undefined + original_transaction?: string | undefined + } + | "" + ) + | undefined + fraudulent?: + | ( + | { + additional_documentation?: (string | "") | undefined + explanation?: (string | "") | undefined + } + | "" + ) + | undefined + merchandise_not_as_described?: + | ( + | { + additional_documentation?: (string | "") | undefined + explanation?: (string | "") | undefined + received_at?: (number | "") | undefined + return_description?: (string | "") | undefined + return_status?: + | ("" | "merchant_rejected" | "successful") + | undefined + returned_at?: (number | "") | undefined + } + | "" + ) + | undefined + no_valid_authorization?: + | ( + | { + additional_documentation?: (string | "") | undefined + explanation?: (string | "") | undefined + } + | "" + ) + | undefined + not_received?: + | ( + | { + additional_documentation?: (string | "") | undefined + expected_at?: (number | "") | undefined + explanation?: (string | "") | undefined + product_description?: (string | "") | undefined + product_type?: ("" | "merchandise" | "service") | undefined + } + | "" + ) + | undefined + other?: + | ( + | { + additional_documentation?: (string | "") | undefined + explanation?: (string | "") | undefined + product_description?: (string | "") | undefined + product_type?: ("" | "merchandise" | "service") | undefined + } + | "" + ) + | undefined + reason?: + | ( + | "canceled" + | "duplicate" + | "fraudulent" + | "merchandise_not_as_described" + | "no_valid_authorization" + | "not_received" + | "other" + | "service_not_as_described" + ) + | undefined + service_not_as_described?: + | ( + | { + additional_documentation?: (string | "") | undefined + canceled_at?: (number | "") | undefined + cancellation_reason?: (string | "") | undefined + explanation?: (string | "") | undefined + received_at?: (number | "") | undefined + } + | "" + ) + | undefined + } + | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + transaction?: string | undefined + treasury?: + | { + received_debit: string + } + | undefined +} + +export type t_PostIssuingDisputesDisputeParamSchema = { + dispute: string +} + +export type t_PostIssuingDisputesDisputeRequestBodySchema = { + amount?: number | undefined + evidence?: + | { + canceled?: + | ( + | { + additional_documentation?: (string | "") | undefined + canceled_at?: (number | "") | undefined + cancellation_policy_provided?: (boolean | "") | undefined + cancellation_reason?: (string | "") | undefined + expected_at?: (number | "") | undefined + explanation?: (string | "") | undefined + product_description?: (string | "") | undefined + product_type?: ("" | "merchandise" | "service") | undefined + return_status?: + | ("" | "merchant_rejected" | "successful") + | undefined + returned_at?: (number | "") | undefined + } + | "" + ) + | undefined + duplicate?: + | ( + | { + additional_documentation?: (string | "") | undefined + card_statement?: (string | "") | undefined + cash_receipt?: (string | "") | undefined + check_image?: (string | "") | undefined + explanation?: (string | "") | undefined + original_transaction?: string | undefined + } + | "" + ) + | undefined + fraudulent?: + | ( + | { + additional_documentation?: (string | "") | undefined + explanation?: (string | "") | undefined + } + | "" + ) + | undefined + merchandise_not_as_described?: + | ( + | { + additional_documentation?: (string | "") | undefined + explanation?: (string | "") | undefined + received_at?: (number | "") | undefined + return_description?: (string | "") | undefined + return_status?: + | ("" | "merchant_rejected" | "successful") + | undefined + returned_at?: (number | "") | undefined + } + | "" + ) + | undefined + no_valid_authorization?: + | ( + | { + additional_documentation?: (string | "") | undefined + explanation?: (string | "") | undefined + } + | "" + ) + | undefined + not_received?: + | ( + | { + additional_documentation?: (string | "") | undefined + expected_at?: (number | "") | undefined + explanation?: (string | "") | undefined + product_description?: (string | "") | undefined + product_type?: ("" | "merchandise" | "service") | undefined + } + | "" + ) + | undefined + other?: + | ( + | { + additional_documentation?: (string | "") | undefined + explanation?: (string | "") | undefined + product_description?: (string | "") | undefined + product_type?: ("" | "merchandise" | "service") | undefined + } + | "" + ) + | undefined + reason?: + | ( + | "canceled" + | "duplicate" + | "fraudulent" + | "merchandise_not_as_described" + | "no_valid_authorization" + | "not_received" + | "other" + | "service_not_as_described" + ) + | undefined + service_not_as_described?: + | ( + | { + additional_documentation?: (string | "") | undefined + canceled_at?: (number | "") | undefined + cancellation_reason?: (string | "") | undefined + explanation?: (string | "") | undefined + received_at?: (number | "") | undefined + } + | "" + ) + | undefined + } + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostIssuingDisputesDisputeSubmitParamSchema = { + dispute: string +} + +export type t_PostIssuingDisputesDisputeSubmitRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostIssuingPersonalizationDesignsRequestBodySchema = { + card_logo?: string | undefined + carrier_text?: + | { + footer_body?: (string | "") | undefined + footer_title?: (string | "") | undefined + header_body?: (string | "") | undefined + header_title?: (string | "") | undefined + } + | undefined + expand?: string[] | undefined + lookup_key?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: string | undefined + physical_bundle: string + preferences?: + | { + is_default: boolean + } + | undefined + transfer_lookup_key?: boolean | undefined +} + +export type t_PostIssuingPersonalizationDesignsPersonalizationDesignParamSchema = + { + personalization_design: string + } + +export type t_PostIssuingPersonalizationDesignsPersonalizationDesignRequestBodySchema = + { + card_logo?: (string | "") | undefined + carrier_text?: + | ( + | { + footer_body?: (string | "") | undefined + footer_title?: (string | "") | undefined + header_body?: (string | "") | undefined + header_title?: (string | "") | undefined + } + | "" + ) + | undefined + expand?: string[] | undefined + lookup_key?: (string | "") | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: (string | "") | undefined + physical_bundle?: string | undefined + preferences?: + | { + is_default: boolean + } + | undefined + transfer_lookup_key?: boolean | undefined + } + +export type t_PostIssuingSettlementsSettlementParamSchema = { + settlement: string +} + +export type t_PostIssuingSettlementsSettlementRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostIssuingTokensTokenParamSchema = { + token: string +} + +export type t_PostIssuingTokensTokenRequestBodySchema = { + expand?: string[] | undefined + status: "active" | "deleted" | "suspended" +} + +export type t_PostIssuingTransactionsTransactionParamSchema = { + transaction: string +} + +export type t_PostIssuingTransactionsTransactionRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostLinkAccountSessionsRequestBodySchema = { + account_holder: { + account?: string | undefined + customer?: string | undefined + type: "account" | "customer" + } + expand?: string[] | undefined + filters?: + | { + account_subcategories?: + | ( + | "checking" + | "credit_card" + | "line_of_credit" + | "mortgage" + | "savings" + )[] + | undefined + countries?: string[] | undefined + } + | undefined + permissions: ("balances" | "ownership" | "payment_method" | "transactions")[] + prefetch?: ("balances" | "ownership" | "transactions")[] | undefined + return_url?: string | undefined +} + +export type t_PostLinkedAccountsAccountDisconnectParamSchema = { + account: string +} + +export type t_PostLinkedAccountsAccountDisconnectRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostLinkedAccountsAccountRefreshParamSchema = { + account: string +} + +export type t_PostLinkedAccountsAccountRefreshRequestBodySchema = { + expand?: string[] | undefined + features: ("balance" | "ownership" | "transactions")[] +} + +export type t_PostPaymentIntentsRequestBodySchema = { + amount: number + application_fee_amount?: number | undefined + automatic_payment_methods?: + | { + allow_redirects?: ("always" | "never") | undefined + enabled: boolean + } + | undefined + capture_method?: ("automatic" | "automatic_async" | "manual") | undefined + confirm?: boolean | undefined + confirmation_method?: ("automatic" | "manual") | undefined + confirmation_token?: string | undefined + currency: string + customer?: string | undefined + description?: string | undefined + error_on_requires_action?: boolean | undefined + expand?: string[] | undefined + mandate?: string | undefined + mandate_data?: + | ( + | { + customer_acceptance: { + accepted_at?: number | undefined + offline?: EmptyObject | undefined + online?: + | { + ip_address: string + user_agent: string + } + | undefined + type: "offline" | "online" + } + } + | "" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + off_session?: (boolean | "one_off" | "recurring") | undefined + on_behalf_of?: string | undefined + payment_method?: string | undefined + payment_method_configuration?: string | undefined + payment_method_data?: + | { + acss_debit?: + | { + account_number: string + institution_number: string + transit_number: string + } + | undefined + affirm?: EmptyObject | undefined + afterpay_clearpay?: EmptyObject | undefined + alipay?: EmptyObject | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: EmptyObject | undefined + amazon_pay?: EmptyObject | undefined + au_becs_debit?: + | { + account_number: string + bsb_number: string + } + | undefined + bacs_debit?: + | { + account_number?: string | undefined + sort_code?: string | undefined + } + | undefined + bancontact?: EmptyObject | undefined + billie?: EmptyObject | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + blik?: EmptyObject | undefined + boleto?: + | { + tax_id: string + } + | undefined + cashapp?: EmptyObject | undefined + customer_balance?: EmptyObject | undefined + eps?: + | { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + ) + | undefined + } + | undefined + fpx?: + | { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + } + | undefined + giropay?: EmptyObject | undefined + grabpay?: EmptyObject | undefined + ideal?: + | { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + ) + | undefined + } + | undefined + interac_present?: EmptyObject | undefined + kakao_pay?: EmptyObject | undefined + klarna?: + | { + dob?: + | { + day: number + month: number + year: number + } + | undefined + } + | undefined + konbini?: EmptyObject | undefined + kr_card?: EmptyObject | undefined + link?: EmptyObject | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mobilepay?: EmptyObject | undefined + multibanco?: EmptyObject | undefined + naver_pay?: + | { + funding?: ("card" | "points") | undefined + } + | undefined + nz_bank_account?: + | { + account_holder_name?: string | undefined + account_number: string + bank_code: string + branch_code: string + reference?: string | undefined + suffix: string + } + | undefined + oxxo?: EmptyObject | undefined + p24?: + | { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + ) + | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: EmptyObject | undefined + paynow?: EmptyObject | undefined + paypal?: EmptyObject | undefined + pix?: EmptyObject | undefined + promptpay?: EmptyObject | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + revolut_pay?: EmptyObject | undefined + samsung_pay?: EmptyObject | undefined + satispay?: EmptyObject | undefined + sepa_debit?: + | { + iban: string + } + | undefined + sofort?: + | { + country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" + } + | undefined + swish?: EmptyObject | undefined + twint?: EmptyObject | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + wechat_pay?: EmptyObject | undefined + zip?: EmptyObject | undefined + } + | undefined + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + custom_mandate_url?: (string | "") | undefined + interval_description?: string | undefined + payment_schedule?: + | ("combined" | "interval" | "sporadic") + | undefined + transaction_type?: ("business" | "personal") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + affirm?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: string | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + afterpay_clearpay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + reference?: string | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + alipay?: + | ( + | { + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + alma?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + amazon_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + au_becs_debit?: + | ( + | { + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + bacs_debit?: + | ( + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: ("de" | "en" | "fr" | "nl") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + blik?: + | ( + | { + code?: string | undefined + setup_future_usage?: ("" | "none") | undefined + } + | "" + ) + | undefined + boleto?: + | ( + | { + expires_after_days?: number | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + capture_method?: ("" | "manual") | undefined + cvc_token?: string | undefined + installments?: + | { + enabled?: boolean | undefined + plan?: + | ( + | { + count?: number | undefined + interval?: "month" | undefined + type: "fixed_count" + } + | "" + ) + | undefined + } + | undefined + mandate_options?: + | { + amount: number + amount_type: "fixed" | "maximum" + description?: string | undefined + end_date?: number | undefined + interval: "day" | "month" | "sporadic" | "week" | "year" + interval_count?: number | undefined + reference: string + start_date: number + supported_types?: "india"[] | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_extended_authorization?: + | ("if_available" | "never") + | undefined + request_incremental_authorization?: + | ("if_available" | "never") + | undefined + request_multicapture?: ("if_available" | "never") | undefined + request_overcapture?: ("if_available" | "never") | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + require_cvc_recollection?: boolean | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + statement_descriptor_suffix_kana?: (string | "") | undefined + statement_descriptor_suffix_kanji?: (string | "") | undefined + three_d_secure?: + | { + ares_trans_status?: + | ("A" | "C" | "I" | "N" | "R" | "U" | "Y") + | undefined + cryptogram: string + electronic_commerce_indicator?: + | ("01" | "02" | "05" | "06" | "07") + | undefined + exemption_indicator?: ("low_risk" | "none") | undefined + network_options?: + | { + cartes_bancaires?: + | { + cb_avalgo: "0" | "1" | "2" | "3" | "4" | "A" + cb_exemption?: string | undefined + cb_score?: number | undefined + } + | undefined + } + | undefined + requestor_challenge_indicator?: string | undefined + transaction_id: string + version: "1.0.2" | "2.1.0" | "2.2.0" + } + | undefined + } + | "" + ) + | undefined + card_present?: + | ( + | { + request_extended_authorization?: boolean | undefined + request_incremental_authorization_support?: + | boolean + | undefined + routing?: + | { + requested_priority?: + | ("domestic" | "international") + | undefined + } + | undefined + } + | "" + ) + | undefined + cashapp?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + requested_address_types?: + | ( + | "aba" + | "iban" + | "sepa" + | "sort_code" + | "spei" + | "swift" + | "zengin" + )[] + | undefined + type: + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" + } + | undefined + funding_type?: "bank_transfer" | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + eps?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + fpx?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + giropay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + grabpay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + ideal?: + | ( + | { + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + interac_present?: (EmptyObject | "") | undefined + kakao_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + klarna?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: + | ( + | "cs-CZ" + | "da-DK" + | "de-AT" + | "de-CH" + | "de-DE" + | "el-GR" + | "en-AT" + | "en-AU" + | "en-BE" + | "en-CA" + | "en-CH" + | "en-CZ" + | "en-DE" + | "en-DK" + | "en-ES" + | "en-FI" + | "en-FR" + | "en-GB" + | "en-GR" + | "en-IE" + | "en-IT" + | "en-NL" + | "en-NO" + | "en-NZ" + | "en-PL" + | "en-PT" + | "en-RO" + | "en-SE" + | "en-US" + | "es-ES" + | "es-US" + | "fi-FI" + | "fr-BE" + | "fr-CA" + | "fr-CH" + | "fr-FR" + | "it-CH" + | "it-IT" + | "nb-NO" + | "nl-BE" + | "nl-NL" + | "pl-PL" + | "pt-PT" + | "ro-RO" + | "sv-FI" + | "sv-SE" + ) + | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + konbini?: + | ( + | { + confirmation_number?: (string | "") | undefined + expires_after_days?: (number | "") | undefined + expires_at?: (number | "") | undefined + product_description?: (string | "") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + kr_card?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + link?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + mobilepay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + multibanco?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + naver_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + nz_bank_account?: + | ( + | { + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + oxxo?: + | ( + | { + expires_after_days?: number | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + p24?: + | ( + | { + setup_future_usage?: "none" | undefined + tos_shown_and_accepted?: boolean | undefined + } + | "" + ) + | undefined + pay_by_bank?: (EmptyObject | "") | undefined + payco?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + paynow?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + paypal?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: + | ( + | "cs-CZ" + | "da-DK" + | "de-AT" + | "de-DE" + | "de-LU" + | "el-GR" + | "en-GB" + | "en-US" + | "es-ES" + | "fi-FI" + | "fr-BE" + | "fr-FR" + | "fr-LU" + | "hu-HU" + | "it-IT" + | "nl-BE" + | "nl-NL" + | "pl-PL" + | "pt-PT" + | "sk-SK" + | "sv-SE" + ) + | undefined + reference?: string | undefined + risk_correlation_id?: string | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + pix?: + | ( + | { + expires_after_seconds?: number | undefined + expires_at?: number | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + promptpay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + revolut_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + samsung_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + sepa_debit?: + | ( + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + sofort?: + | ( + | { + preferred_language?: + | ("" | "de" | "en" | "es" | "fr" | "it" | "nl" | "pl") + | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + swish?: + | ( + | { + reference?: (string | "") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + twint?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + return_url?: string | undefined + } + | undefined + mandate_options?: + | { + collection_method?: ("" | "paper") | undefined + } + | undefined + networks?: + | { + requested?: ("ach" | "us_domestic_wire")[] | undefined + } + | undefined + preferred_settlement_speed?: + | ("" | "fastest" | "standard") + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + wechat_pay?: + | ( + | { + app_id?: string | undefined + client?: ("android" | "ios" | "web") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + zip?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: string[] | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + receipt_email?: string | undefined + return_url?: string | undefined + setup_future_usage?: ("off_session" | "on_session") | undefined + shipping?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + carrier?: string | undefined + name: string + phone?: string | undefined + tracking_number?: string | undefined + } + | undefined + statement_descriptor?: string | undefined + statement_descriptor_suffix?: string | undefined + transfer_data?: + | { + amount?: number | undefined + destination: string + } + | undefined + transfer_group?: string | undefined + use_stripe_sdk?: boolean | undefined +} + +export type t_PostPaymentIntentsIntentParamSchema = { + intent: string +} + +export type t_PostPaymentIntentsIntentRequestBodySchema = { + amount?: number | undefined + application_fee_amount?: (number | "") | undefined + capture_method?: ("automatic" | "automatic_async" | "manual") | undefined + currency?: string | undefined + customer?: string | undefined + description?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + payment_method?: string | undefined + payment_method_configuration?: string | undefined + payment_method_data?: + | { + acss_debit?: + | { + account_number: string + institution_number: string + transit_number: string + } + | undefined + affirm?: EmptyObject | undefined + afterpay_clearpay?: EmptyObject | undefined + alipay?: EmptyObject | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: EmptyObject | undefined + amazon_pay?: EmptyObject | undefined + au_becs_debit?: + | { + account_number: string + bsb_number: string + } + | undefined + bacs_debit?: + | { + account_number?: string | undefined + sort_code?: string | undefined + } + | undefined + bancontact?: EmptyObject | undefined + billie?: EmptyObject | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + blik?: EmptyObject | undefined + boleto?: + | { + tax_id: string + } + | undefined + cashapp?: EmptyObject | undefined + customer_balance?: EmptyObject | undefined + eps?: + | { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + ) + | undefined + } + | undefined + fpx?: + | { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + } + | undefined + giropay?: EmptyObject | undefined + grabpay?: EmptyObject | undefined + ideal?: + | { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + ) + | undefined + } + | undefined + interac_present?: EmptyObject | undefined + kakao_pay?: EmptyObject | undefined + klarna?: + | { + dob?: + | { + day: number + month: number + year: number + } + | undefined + } + | undefined + konbini?: EmptyObject | undefined + kr_card?: EmptyObject | undefined + link?: EmptyObject | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mobilepay?: EmptyObject | undefined + multibanco?: EmptyObject | undefined + naver_pay?: + | { + funding?: ("card" | "points") | undefined + } + | undefined + nz_bank_account?: + | { + account_holder_name?: string | undefined + account_number: string + bank_code: string + branch_code: string + reference?: string | undefined + suffix: string + } + | undefined + oxxo?: EmptyObject | undefined + p24?: + | { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + ) + | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: EmptyObject | undefined + paynow?: EmptyObject | undefined + paypal?: EmptyObject | undefined + pix?: EmptyObject | undefined + promptpay?: EmptyObject | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + revolut_pay?: EmptyObject | undefined + samsung_pay?: EmptyObject | undefined + satispay?: EmptyObject | undefined + sepa_debit?: + | { + iban: string + } + | undefined + sofort?: + | { + country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" + } + | undefined + swish?: EmptyObject | undefined + twint?: EmptyObject | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + wechat_pay?: EmptyObject | undefined + zip?: EmptyObject | undefined + } + | undefined + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + custom_mandate_url?: (string | "") | undefined + interval_description?: string | undefined + payment_schedule?: + | ("combined" | "interval" | "sporadic") + | undefined + transaction_type?: ("business" | "personal") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + affirm?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: string | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + afterpay_clearpay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + reference?: string | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + alipay?: + | ( + | { + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + alma?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + amazon_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + au_becs_debit?: + | ( + | { + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + bacs_debit?: + | ( + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: ("de" | "en" | "fr" | "nl") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + blik?: + | ( + | { + code?: string | undefined + setup_future_usage?: ("" | "none") | undefined + } + | "" + ) + | undefined + boleto?: + | ( + | { + expires_after_days?: number | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + capture_method?: ("" | "manual") | undefined + cvc_token?: string | undefined + installments?: + | { + enabled?: boolean | undefined + plan?: + | ( + | { + count?: number | undefined + interval?: "month" | undefined + type: "fixed_count" + } + | "" + ) + | undefined + } + | undefined + mandate_options?: + | { + amount: number + amount_type: "fixed" | "maximum" + description?: string | undefined + end_date?: number | undefined + interval: "day" | "month" | "sporadic" | "week" | "year" + interval_count?: number | undefined + reference: string + start_date: number + supported_types?: "india"[] | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_extended_authorization?: + | ("if_available" | "never") + | undefined + request_incremental_authorization?: + | ("if_available" | "never") + | undefined + request_multicapture?: ("if_available" | "never") | undefined + request_overcapture?: ("if_available" | "never") | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + require_cvc_recollection?: boolean | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + statement_descriptor_suffix_kana?: (string | "") | undefined + statement_descriptor_suffix_kanji?: (string | "") | undefined + three_d_secure?: + | { + ares_trans_status?: + | ("A" | "C" | "I" | "N" | "R" | "U" | "Y") + | undefined + cryptogram: string + electronic_commerce_indicator?: + | ("01" | "02" | "05" | "06" | "07") + | undefined + exemption_indicator?: ("low_risk" | "none") | undefined + network_options?: + | { + cartes_bancaires?: + | { + cb_avalgo: "0" | "1" | "2" | "3" | "4" | "A" + cb_exemption?: string | undefined + cb_score?: number | undefined + } + | undefined + } + | undefined + requestor_challenge_indicator?: string | undefined + transaction_id: string + version: "1.0.2" | "2.1.0" | "2.2.0" + } + | undefined + } + | "" + ) + | undefined + card_present?: + | ( + | { + request_extended_authorization?: boolean | undefined + request_incremental_authorization_support?: + | boolean + | undefined + routing?: + | { + requested_priority?: + | ("domestic" | "international") + | undefined + } + | undefined + } + | "" + ) + | undefined + cashapp?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + requested_address_types?: + | ( + | "aba" + | "iban" + | "sepa" + | "sort_code" + | "spei" + | "swift" + | "zengin" + )[] + | undefined + type: + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" + } + | undefined + funding_type?: "bank_transfer" | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + eps?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + fpx?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + giropay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + grabpay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + ideal?: + | ( + | { + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + interac_present?: (EmptyObject | "") | undefined + kakao_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + klarna?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: + | ( + | "cs-CZ" + | "da-DK" + | "de-AT" + | "de-CH" + | "de-DE" + | "el-GR" + | "en-AT" + | "en-AU" + | "en-BE" + | "en-CA" + | "en-CH" + | "en-CZ" + | "en-DE" + | "en-DK" + | "en-ES" + | "en-FI" + | "en-FR" + | "en-GB" + | "en-GR" + | "en-IE" + | "en-IT" + | "en-NL" + | "en-NO" + | "en-NZ" + | "en-PL" + | "en-PT" + | "en-RO" + | "en-SE" + | "en-US" + | "es-ES" + | "es-US" + | "fi-FI" + | "fr-BE" + | "fr-CA" + | "fr-CH" + | "fr-FR" + | "it-CH" + | "it-IT" + | "nb-NO" + | "nl-BE" + | "nl-NL" + | "pl-PL" + | "pt-PT" + | "ro-RO" + | "sv-FI" + | "sv-SE" + ) + | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + konbini?: + | ( + | { + confirmation_number?: (string | "") | undefined + expires_after_days?: (number | "") | undefined + expires_at?: (number | "") | undefined + product_description?: (string | "") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + kr_card?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + link?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + mobilepay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + multibanco?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + naver_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + nz_bank_account?: + | ( + | { + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + oxxo?: + | ( + | { + expires_after_days?: number | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + p24?: + | ( + | { + setup_future_usage?: "none" | undefined + tos_shown_and_accepted?: boolean | undefined + } + | "" + ) + | undefined + pay_by_bank?: (EmptyObject | "") | undefined + payco?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + paynow?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + paypal?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: + | ( + | "cs-CZ" + | "da-DK" + | "de-AT" + | "de-DE" + | "de-LU" + | "el-GR" + | "en-GB" + | "en-US" + | "es-ES" + | "fi-FI" + | "fr-BE" + | "fr-FR" + | "fr-LU" + | "hu-HU" + | "it-IT" + | "nl-BE" + | "nl-NL" + | "pl-PL" + | "pt-PT" + | "sk-SK" + | "sv-SE" + ) + | undefined + reference?: string | undefined + risk_correlation_id?: string | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + pix?: + | ( + | { + expires_after_seconds?: number | undefined + expires_at?: number | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + promptpay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + revolut_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + samsung_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + sepa_debit?: + | ( + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + sofort?: + | ( + | { + preferred_language?: + | ("" | "de" | "en" | "es" | "fr" | "it" | "nl" | "pl") + | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + swish?: + | ( + | { + reference?: (string | "") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + twint?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + return_url?: string | undefined + } + | undefined + mandate_options?: + | { + collection_method?: ("" | "paper") | undefined + } + | undefined + networks?: + | { + requested?: ("ach" | "us_domestic_wire")[] | undefined + } + | undefined + preferred_settlement_speed?: + | ("" | "fastest" | "standard") + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + wechat_pay?: + | ( + | { + app_id?: string | undefined + client?: ("android" | "ios" | "web") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + zip?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: string[] | undefined + receipt_email?: (string | "") | undefined + setup_future_usage?: ("" | "off_session" | "on_session") | undefined + shipping?: + | ( + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + carrier?: string | undefined + name: string + phone?: string | undefined + tracking_number?: string | undefined + } + | "" + ) + | undefined + statement_descriptor?: string | undefined + statement_descriptor_suffix?: string | undefined + transfer_data?: + | { + amount?: number | undefined + } + | undefined + transfer_group?: string | undefined +} + +export type t_PostPaymentIntentsIntentApplyCustomerBalanceParamSchema = { + intent: string +} + +export type t_PostPaymentIntentsIntentApplyCustomerBalanceRequestBodySchema = { + amount?: number | undefined + currency?: string | undefined + expand?: string[] | undefined +} + +export type t_PostPaymentIntentsIntentCancelParamSchema = { + intent: string +} + +export type t_PostPaymentIntentsIntentCancelRequestBodySchema = { + cancellation_reason?: + | ("abandoned" | "duplicate" | "fraudulent" | "requested_by_customer") + | undefined + expand?: string[] | undefined +} + +export type t_PostPaymentIntentsIntentCaptureParamSchema = { + intent: string +} + +export type t_PostPaymentIntentsIntentCaptureRequestBodySchema = { + amount_to_capture?: number | undefined + application_fee_amount?: number | undefined + expand?: string[] | undefined + final_capture?: boolean | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + statement_descriptor?: string | undefined + statement_descriptor_suffix?: string | undefined + transfer_data?: + | { + amount?: number | undefined + } + | undefined +} + +export type t_PostPaymentIntentsIntentConfirmParamSchema = { + intent: string +} + +export type t_PostPaymentIntentsIntentConfirmRequestBodySchema = { + capture_method?: ("automatic" | "automatic_async" | "manual") | undefined + client_secret?: string | undefined + confirmation_token?: string | undefined + error_on_requires_action?: boolean | undefined + expand?: string[] | undefined + mandate?: string | undefined + mandate_data?: + | ( + | { + customer_acceptance: { + accepted_at?: number | undefined + offline?: EmptyObject | undefined + online?: + | { + ip_address: string + user_agent: string + } + | undefined + type: "offline" | "online" + } + } + | "" + | { + customer_acceptance: { + online: { + ip_address?: string | undefined + user_agent?: string | undefined + } + type: "online" + } + } + ) + | undefined + off_session?: (boolean | "one_off" | "recurring") | undefined + payment_method?: string | undefined + payment_method_data?: + | { + acss_debit?: + | { + account_number: string + institution_number: string + transit_number: string + } + | undefined + affirm?: EmptyObject | undefined + afterpay_clearpay?: EmptyObject | undefined + alipay?: EmptyObject | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: EmptyObject | undefined + amazon_pay?: EmptyObject | undefined + au_becs_debit?: + | { + account_number: string + bsb_number: string + } + | undefined + bacs_debit?: + | { + account_number?: string | undefined + sort_code?: string | undefined + } + | undefined + bancontact?: EmptyObject | undefined + billie?: EmptyObject | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + blik?: EmptyObject | undefined + boleto?: + | { + tax_id: string + } + | undefined + cashapp?: EmptyObject | undefined + customer_balance?: EmptyObject | undefined + eps?: + | { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + ) + | undefined + } + | undefined + fpx?: + | { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + } + | undefined + giropay?: EmptyObject | undefined + grabpay?: EmptyObject | undefined + ideal?: + | { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + ) + | undefined + } + | undefined + interac_present?: EmptyObject | undefined + kakao_pay?: EmptyObject | undefined + klarna?: + | { + dob?: + | { + day: number + month: number + year: number + } + | undefined + } + | undefined + konbini?: EmptyObject | undefined + kr_card?: EmptyObject | undefined + link?: EmptyObject | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mobilepay?: EmptyObject | undefined + multibanco?: EmptyObject | undefined + naver_pay?: + | { + funding?: ("card" | "points") | undefined + } + | undefined + nz_bank_account?: + | { + account_holder_name?: string | undefined + account_number: string + bank_code: string + branch_code: string + reference?: string | undefined + suffix: string + } + | undefined + oxxo?: EmptyObject | undefined + p24?: + | { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + ) + | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: EmptyObject | undefined + paynow?: EmptyObject | undefined + paypal?: EmptyObject | undefined + pix?: EmptyObject | undefined + promptpay?: EmptyObject | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + revolut_pay?: EmptyObject | undefined + samsung_pay?: EmptyObject | undefined + satispay?: EmptyObject | undefined + sepa_debit?: + | { + iban: string + } + | undefined + sofort?: + | { + country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" + } + | undefined + swish?: EmptyObject | undefined + twint?: EmptyObject | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + wechat_pay?: EmptyObject | undefined + zip?: EmptyObject | undefined + } + | undefined + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + custom_mandate_url?: (string | "") | undefined + interval_description?: string | undefined + payment_schedule?: + | ("combined" | "interval" | "sporadic") + | undefined + transaction_type?: ("business" | "personal") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + affirm?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: string | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + afterpay_clearpay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + reference?: string | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + alipay?: + | ( + | { + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + alma?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + amazon_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + au_becs_debit?: + | ( + | { + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + bacs_debit?: + | ( + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: ("de" | "en" | "fr" | "nl") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + blik?: + | ( + | { + code?: string | undefined + setup_future_usage?: ("" | "none") | undefined + } + | "" + ) + | undefined + boleto?: + | ( + | { + expires_after_days?: number | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + capture_method?: ("" | "manual") | undefined + cvc_token?: string | undefined + installments?: + | { + enabled?: boolean | undefined + plan?: + | ( + | { + count?: number | undefined + interval?: "month" | undefined + type: "fixed_count" + } + | "" + ) + | undefined + } + | undefined + mandate_options?: + | { + amount: number + amount_type: "fixed" | "maximum" + description?: string | undefined + end_date?: number | undefined + interval: "day" | "month" | "sporadic" | "week" | "year" + interval_count?: number | undefined + reference: string + start_date: number + supported_types?: "india"[] | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_extended_authorization?: + | ("if_available" | "never") + | undefined + request_incremental_authorization?: + | ("if_available" | "never") + | undefined + request_multicapture?: ("if_available" | "never") | undefined + request_overcapture?: ("if_available" | "never") | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + require_cvc_recollection?: boolean | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + statement_descriptor_suffix_kana?: (string | "") | undefined + statement_descriptor_suffix_kanji?: (string | "") | undefined + three_d_secure?: + | { + ares_trans_status?: + | ("A" | "C" | "I" | "N" | "R" | "U" | "Y") + | undefined + cryptogram: string + electronic_commerce_indicator?: + | ("01" | "02" | "05" | "06" | "07") + | undefined + exemption_indicator?: ("low_risk" | "none") | undefined + network_options?: + | { + cartes_bancaires?: + | { + cb_avalgo: "0" | "1" | "2" | "3" | "4" | "A" + cb_exemption?: string | undefined + cb_score?: number | undefined + } + | undefined + } + | undefined + requestor_challenge_indicator?: string | undefined + transaction_id: string + version: "1.0.2" | "2.1.0" | "2.2.0" + } + | undefined + } + | "" + ) + | undefined + card_present?: + | ( + | { + request_extended_authorization?: boolean | undefined + request_incremental_authorization_support?: + | boolean + | undefined + routing?: + | { + requested_priority?: + | ("domestic" | "international") + | undefined + } + | undefined + } + | "" + ) + | undefined + cashapp?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + requested_address_types?: + | ( + | "aba" + | "iban" + | "sepa" + | "sort_code" + | "spei" + | "swift" + | "zengin" + )[] + | undefined + type: + | "eu_bank_transfer" + | "gb_bank_transfer" + | "jp_bank_transfer" + | "mx_bank_transfer" + | "us_bank_transfer" + } + | undefined + funding_type?: "bank_transfer" | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + eps?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + fpx?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + giropay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + grabpay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + ideal?: + | ( + | { + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + interac_present?: (EmptyObject | "") | undefined + kakao_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + klarna?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: + | ( + | "cs-CZ" + | "da-DK" + | "de-AT" + | "de-CH" + | "de-DE" + | "el-GR" + | "en-AT" + | "en-AU" + | "en-BE" + | "en-CA" + | "en-CH" + | "en-CZ" + | "en-DE" + | "en-DK" + | "en-ES" + | "en-FI" + | "en-FR" + | "en-GB" + | "en-GR" + | "en-IE" + | "en-IT" + | "en-NL" + | "en-NO" + | "en-NZ" + | "en-PL" + | "en-PT" + | "en-RO" + | "en-SE" + | "en-US" + | "es-ES" + | "es-US" + | "fi-FI" + | "fr-BE" + | "fr-CA" + | "fr-CH" + | "fr-FR" + | "it-CH" + | "it-IT" + | "nb-NO" + | "nl-BE" + | "nl-NL" + | "pl-PL" + | "pt-PT" + | "ro-RO" + | "sv-FI" + | "sv-SE" + ) + | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + konbini?: + | ( + | { + confirmation_number?: (string | "") | undefined + expires_after_days?: (number | "") | undefined + expires_at?: (number | "") | undefined + product_description?: (string | "") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + kr_card?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + link?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + mobilepay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + multibanco?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + naver_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + nz_bank_account?: + | ( + | { + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + oxxo?: + | ( + | { + expires_after_days?: number | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + p24?: + | ( + | { + setup_future_usage?: "none" | undefined + tos_shown_and_accepted?: boolean | undefined + } + | "" + ) + | undefined + pay_by_bank?: (EmptyObject | "") | undefined + payco?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + paynow?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + paypal?: + | ( + | { + capture_method?: ("" | "manual") | undefined + preferred_locale?: + | ( + | "cs-CZ" + | "da-DK" + | "de-AT" + | "de-DE" + | "de-LU" + | "el-GR" + | "en-GB" + | "en-US" + | "es-ES" + | "fi-FI" + | "fr-BE" + | "fr-FR" + | "fr-LU" + | "hu-HU" + | "it-IT" + | "nl-BE" + | "nl-NL" + | "pl-PL" + | "pt-PT" + | "sk-SK" + | "sv-SE" + ) + | undefined + reference?: string | undefined + risk_correlation_id?: string | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + pix?: + | ( + | { + expires_after_seconds?: number | undefined + expires_at?: number | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + promptpay?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + revolut_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + samsung_pay?: + | ( + | { + capture_method?: ("" | "manual") | undefined + } + | "" + ) + | undefined + sepa_debit?: + | ( + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + } + | "" + ) + | undefined + sofort?: + | ( + | { + preferred_language?: + | ("" | "de" | "en" | "es" | "fr" | "it" | "nl" | "pl") + | undefined + setup_future_usage?: ("" | "none" | "off_session") | undefined + } + | "" + ) + | undefined + swish?: + | ( + | { + reference?: (string | "") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + twint?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + return_url?: string | undefined + } + | undefined + mandate_options?: + | { + collection_method?: ("" | "paper") | undefined + } + | undefined + networks?: + | { + requested?: ("ach" | "us_domestic_wire")[] | undefined + } + | undefined + preferred_settlement_speed?: + | ("" | "fastest" | "standard") + | undefined + setup_future_usage?: + | ("" | "none" | "off_session" | "on_session") + | undefined + target_date?: string | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + wechat_pay?: + | ( + | { + app_id?: string | undefined + client?: ("android" | "ios" | "web") | undefined + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + zip?: + | ( + | { + setup_future_usage?: "none" | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: string[] | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + receipt_email?: (string | "") | undefined + return_url?: string | undefined + setup_future_usage?: ("" | "off_session" | "on_session") | undefined + shipping?: + | ( + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + carrier?: string | undefined + name: string + phone?: string | undefined + tracking_number?: string | undefined + } + | "" + ) + | undefined + use_stripe_sdk?: boolean | undefined +} + +export type t_PostPaymentIntentsIntentIncrementAuthorizationParamSchema = { + intent: string +} + +export type t_PostPaymentIntentsIntentIncrementAuthorizationRequestBodySchema = + { + amount: number + application_fee_amount?: number | undefined + description?: string | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + statement_descriptor?: string | undefined + transfer_data?: + | { + amount?: number | undefined + } + | undefined + } + +export type t_PostPaymentIntentsIntentVerifyMicrodepositsParamSchema = { + intent: string +} + +export type t_PostPaymentIntentsIntentVerifyMicrodepositsRequestBodySchema = { + amounts?: number[] | undefined + client_secret?: string | undefined + descriptor_code?: string | undefined + expand?: string[] | undefined +} + +export type t_PostPaymentLinksRequestBodySchema = { + after_completion?: + | { + hosted_confirmation?: + | { + custom_message?: string | undefined + } + | undefined + redirect?: + | { + url: string + } + | undefined + type: "hosted_confirmation" | "redirect" + } + | undefined + allow_promotion_codes?: boolean | undefined + application_fee_amount?: number | undefined + application_fee_percent?: number | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_address_collection?: ("auto" | "required") | undefined + consent_collection?: + | { + payment_method_reuse_agreement?: + | { + position: "auto" | "hidden" + } + | undefined + promotions?: ("auto" | "none") | undefined + terms_of_service?: ("none" | "required") | undefined + } + | undefined + currency?: string | undefined + custom_fields?: + | { + dropdown?: + | { + default_value?: string | undefined + options: { + label: string + value: string + }[] + } + | undefined + key: string + label: { + custom: string + type: "custom" + } + numeric?: + | { + default_value?: string | undefined + maximum_length?: number | undefined + minimum_length?: number | undefined + } + | undefined + optional?: boolean | undefined + text?: + | { + default_value?: string | undefined + maximum_length?: number | undefined + minimum_length?: number | undefined + } + | undefined + type: "dropdown" | "numeric" | "text" + }[] + | undefined + custom_text?: + | { + after_submit?: + | ( + | { + message: string + } + | "" + ) + | undefined + shipping_address?: + | ( + | { + message: string + } + | "" + ) + | undefined + submit?: + | ( + | { + message: string + } + | "" + ) + | undefined + terms_of_service_acceptance?: + | ( + | { + message: string + } + | "" + ) + | undefined + } + | undefined + customer_creation?: ("always" | "if_required") | undefined + expand?: string[] | undefined + inactive_message?: string | undefined + invoice_creation?: + | { + enabled: boolean + invoice_data?: + | { + account_tax_ids?: (string[] | "") | undefined + custom_fields?: + | ( + | { + name: string + value: string + }[] + | "" + ) + | undefined + description?: string | undefined + footer?: string | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + rendering_options?: + | ( + | { + amount_tax_display?: + | ("" | "exclude_tax" | "include_inclusive_tax") + | undefined + } + | "" + ) + | undefined + } + | undefined + } + | undefined + line_items: { + adjustable_quantity?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + } + | undefined + price: string + quantity: number + }[] + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: string | undefined + optional_items?: + | { + adjustable_quantity?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + } + | undefined + price: string + quantity: number + }[] + | undefined + payment_intent_data?: + | { + capture_method?: + | ("automatic" | "automatic_async" | "manual") + | undefined + description?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + setup_future_usage?: ("off_session" | "on_session") | undefined + statement_descriptor?: string | undefined + statement_descriptor_suffix?: string | undefined + transfer_group?: string | undefined + } + | undefined + payment_method_collection?: ("always" | "if_required") | undefined + payment_method_types?: + | ( + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "cashapp" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "klarna" + | "konbini" + | "link" + | "mobilepay" + | "multibanco" + | "oxxo" + | "p24" + | "pay_by_bank" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + )[] + | undefined + phone_number_collection?: + | { + enabled: boolean + } + | undefined + restrictions?: + | { + completed_sessions: { + limit: number + } + } + | undefined + shipping_address_collection?: + | { + allowed_countries: ( + | "AC" + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TA" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VN" + | "VU" + | "WF" + | "WS" + | "XK" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | "ZZ" + )[] + } + | undefined + shipping_options?: + | { + shipping_rate?: string | undefined + }[] + | undefined + submit_type?: ("auto" | "book" | "donate" | "pay" | "subscribe") | undefined + subscription_data?: + | { + description?: string | undefined + invoice_settings?: + | { + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + trial_period_days?: number | undefined + trial_settings?: + | { + end_behavior: { + missing_payment_method: "cancel" | "create_invoice" | "pause" + } + } + | undefined + } + | undefined + tax_id_collection?: + | { + enabled: boolean + required?: ("if_supported" | "never") | undefined + } + | undefined + transfer_data?: + | { + amount?: number | undefined + destination: string + } + | undefined +} + +export type t_PostPaymentLinksPaymentLinkParamSchema = { + payment_link: string +} + +export type t_PostPaymentLinksPaymentLinkRequestBodySchema = { + active?: boolean | undefined + after_completion?: + | { + hosted_confirmation?: + | { + custom_message?: string | undefined + } + | undefined + redirect?: + | { + url: string + } + | undefined + type: "hosted_confirmation" | "redirect" + } + | undefined + allow_promotion_codes?: boolean | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_address_collection?: ("auto" | "required") | undefined + custom_fields?: + | ( + | { + dropdown?: + | { + default_value?: string | undefined + options: { + label: string + value: string + }[] + } + | undefined + key: string + label: { + custom: string + type: "custom" + } + numeric?: + | { + default_value?: string | undefined + maximum_length?: number | undefined + minimum_length?: number | undefined + } + | undefined + optional?: boolean | undefined + text?: + | { + default_value?: string | undefined + maximum_length?: number | undefined + minimum_length?: number | undefined + } + | undefined + type: "dropdown" | "numeric" | "text" + }[] + | "" + ) + | undefined + custom_text?: + | { + after_submit?: + | ( + | { + message: string + } + | "" + ) + | undefined + shipping_address?: + | ( + | { + message: string + } + | "" + ) + | undefined + submit?: + | ( + | { + message: string + } + | "" + ) + | undefined + terms_of_service_acceptance?: + | ( + | { + message: string + } + | "" + ) + | undefined + } + | undefined + customer_creation?: ("always" | "if_required") | undefined + expand?: string[] | undefined + inactive_message?: (string | "") | undefined + invoice_creation?: + | { + enabled: boolean + invoice_data?: + | { + account_tax_ids?: (string[] | "") | undefined + custom_fields?: + | ( + | { + name: string + value: string + }[] + | "" + ) + | undefined + description?: string | undefined + footer?: string | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + rendering_options?: + | ( + | { + amount_tax_display?: + | ("" | "exclude_tax" | "include_inclusive_tax") + | undefined + } + | "" + ) + | undefined + } + | undefined + } + | undefined + line_items?: + | { + adjustable_quantity?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + } + | undefined + id: string + quantity?: number | undefined + }[] + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + payment_intent_data?: + | { + description?: (string | "") | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + statement_descriptor?: (string | "") | undefined + statement_descriptor_suffix?: (string | "") | undefined + transfer_group?: (string | "") | undefined + } + | undefined + payment_method_collection?: ("always" | "if_required") | undefined + payment_method_types?: + | ( + | ( + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "cashapp" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "klarna" + | "konbini" + | "link" + | "mobilepay" + | "multibanco" + | "oxxo" + | "p24" + | "pay_by_bank" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + )[] + | "" + ) + | undefined + phone_number_collection?: + | { + enabled: boolean + } + | undefined + restrictions?: + | ( + | { + completed_sessions: { + limit: number + } + } + | "" + ) + | undefined + shipping_address_collection?: + | ( + | { + allowed_countries: ( + | "AC" + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TA" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VN" + | "VU" + | "WF" + | "WS" + | "XK" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | "ZZ" + )[] + } + | "" + ) + | undefined + submit_type?: ("auto" | "book" | "donate" | "pay" | "subscribe") | undefined + subscription_data?: + | { + invoice_settings?: + | { + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + trial_period_days?: (number | "") | undefined + trial_settings?: + | ( + | { + end_behavior: { + missing_payment_method: + | "cancel" + | "create_invoice" + | "pause" + } + } + | "" + ) + | undefined + } + | undefined + tax_id_collection?: + | { + enabled: boolean + required?: ("if_supported" | "never") | undefined + } + | undefined +} + +export type t_PostPaymentMethodConfigurationsRequestBodySchema = { + acss_debit?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + affirm?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + afterpay_clearpay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + alipay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + alma?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + amazon_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + apple_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + apple_pay_later?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + au_becs_debit?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + bacs_debit?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + bancontact?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + billie?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + blik?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + boleto?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + card?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + cartes_bancaires?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + cashapp?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + customer_balance?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + eps?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + expand?: string[] | undefined + fpx?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + giropay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + google_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + grabpay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + ideal?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + jcb?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + klarna?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + konbini?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + link?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + mobilepay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + multibanco?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + name?: string | undefined + nz_bank_account?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + oxxo?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + p24?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + parent?: string | undefined + pay_by_bank?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + paynow?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + paypal?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + promptpay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + revolut_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + satispay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + sepa_debit?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + sofort?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + swish?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + twint?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + us_bank_account?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + wechat_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + zip?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined +} + +export type t_PostPaymentMethodConfigurationsConfigurationParamSchema = { + configuration: string +} + +export type t_PostPaymentMethodConfigurationsConfigurationRequestBodySchema = { + acss_debit?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + active?: boolean | undefined + affirm?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + afterpay_clearpay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + alipay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + alma?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + amazon_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + apple_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + apple_pay_later?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + au_becs_debit?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + bacs_debit?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + bancontact?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + billie?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + blik?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + boleto?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + card?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + cartes_bancaires?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + cashapp?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + customer_balance?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + eps?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + expand?: string[] | undefined + fpx?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + giropay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + google_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + grabpay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + ideal?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + jcb?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + klarna?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + konbini?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + link?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + mobilepay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + multibanco?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + name?: string | undefined + nz_bank_account?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + oxxo?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + p24?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + pay_by_bank?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + paynow?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + paypal?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + promptpay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + revolut_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + satispay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + sepa_debit?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + sofort?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + swish?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + twint?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + us_bank_account?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + wechat_pay?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined + zip?: + | { + display_preference?: + | { + preference?: ("none" | "off" | "on") | undefined + } + | undefined + } + | undefined +} + +export type t_PostPaymentMethodDomainsRequestBodySchema = { + domain_name: string + enabled?: boolean | undefined + expand?: string[] | undefined +} + +export type t_PostPaymentMethodDomainsPaymentMethodDomainParamSchema = { + payment_method_domain: string +} + +export type t_PostPaymentMethodDomainsPaymentMethodDomainRequestBodySchema = { + enabled?: boolean | undefined + expand?: string[] | undefined +} + +export type t_PostPaymentMethodDomainsPaymentMethodDomainValidateParamSchema = { + payment_method_domain: string +} + +export type t_PostPaymentMethodDomainsPaymentMethodDomainValidateRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostPaymentMethodsRequestBodySchema = { + acss_debit?: + | { + account_number: string + institution_number: string + transit_number: string + } + | undefined + affirm?: EmptyObject | undefined + afterpay_clearpay?: EmptyObject | undefined + alipay?: EmptyObject | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: EmptyObject | undefined + amazon_pay?: EmptyObject | undefined + au_becs_debit?: + | { + account_number: string + bsb_number: string + } + | undefined + bacs_debit?: + | { + account_number?: string | undefined + sort_code?: string | undefined + } + | undefined + bancontact?: EmptyObject | undefined + billie?: EmptyObject | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + blik?: EmptyObject | undefined + boleto?: + | { + tax_id: string + } + | undefined + card?: + | ( + | { + cvc?: string | undefined + exp_month: number + exp_year: number + networks?: + | { + preferred?: + | ("cartes_bancaires" | "mastercard" | "visa") + | undefined + } + | undefined + number: string + } + | { + token: string + } + ) + | undefined + cashapp?: EmptyObject | undefined + customer?: string | undefined + customer_balance?: EmptyObject | undefined + eps?: + | { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + ) + | undefined + } + | undefined + expand?: string[] | undefined + fpx?: + | { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + } + | undefined + giropay?: EmptyObject | undefined + grabpay?: EmptyObject | undefined + ideal?: + | { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + ) + | undefined + } + | undefined + interac_present?: EmptyObject | undefined + kakao_pay?: EmptyObject | undefined + klarna?: + | { + dob?: + | { + day: number + month: number + year: number + } + | undefined + } + | undefined + konbini?: EmptyObject | undefined + kr_card?: EmptyObject | undefined + link?: EmptyObject | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mobilepay?: EmptyObject | undefined + multibanco?: EmptyObject | undefined + naver_pay?: + | { + funding?: ("card" | "points") | undefined + } + | undefined + nz_bank_account?: + | { + account_holder_name?: string | undefined + account_number: string + bank_code: string + branch_code: string + reference?: string | undefined + suffix: string + } + | undefined + oxxo?: EmptyObject | undefined + p24?: + | { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + ) + | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: EmptyObject | undefined + payment_method?: string | undefined + paynow?: EmptyObject | undefined + paypal?: EmptyObject | undefined + pix?: EmptyObject | undefined + promptpay?: EmptyObject | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + revolut_pay?: EmptyObject | undefined + samsung_pay?: EmptyObject | undefined + satispay?: EmptyObject | undefined + sepa_debit?: + | { + iban: string + } + | undefined + sofort?: + | { + country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" + } + | undefined + swish?: EmptyObject | undefined + twint?: EmptyObject | undefined + type?: + | ( + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + ) + | undefined + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + wechat_pay?: EmptyObject | undefined + zip?: EmptyObject | undefined +} + +export type t_PostPaymentMethodsPaymentMethodParamSchema = { + payment_method: string +} + +export type t_PostPaymentMethodsPaymentMethodRequestBodySchema = { + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + card?: + | { + exp_month?: number | undefined + exp_year?: number | undefined + networks?: + | { + preferred?: + | ("" | "cartes_bancaires" | "mastercard" | "visa") + | undefined + } + | undefined + } + | undefined + expand?: string[] | undefined + link?: EmptyObject | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + pay_by_bank?: EmptyObject | undefined + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_type?: ("checking" | "savings") | undefined + } + | undefined +} + +export type t_PostPaymentMethodsPaymentMethodAttachParamSchema = { + payment_method: string +} + +export type t_PostPaymentMethodsPaymentMethodAttachRequestBodySchema = { + customer: string + expand?: string[] | undefined +} + +export type t_PostPaymentMethodsPaymentMethodDetachParamSchema = { + payment_method: string +} + +export type t_PostPaymentMethodsPaymentMethodDetachRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostPayoutsRequestBodySchema = { + amount: number + currency: string + description?: string | undefined + destination?: string | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + method?: ("instant" | "standard") | undefined + source_type?: ("bank_account" | "card" | "fpx") | undefined + statement_descriptor?: string | undefined +} + +export type t_PostPayoutsPayoutParamSchema = { + payout: string +} + +export type t_PostPayoutsPayoutRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostPayoutsPayoutCancelParamSchema = { + payout: string +} + +export type t_PostPayoutsPayoutCancelRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostPayoutsPayoutReverseParamSchema = { + payout: string +} + +export type t_PostPayoutsPayoutReverseRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined +} + +export type t_PostPlansRequestBodySchema = { + active?: boolean | undefined + amount?: number | undefined + amount_decimal?: string | undefined + billing_scheme?: ("per_unit" | "tiered") | undefined + currency: string + expand?: string[] | undefined + id?: string | undefined + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + meter?: string | undefined + nickname?: string | undefined + product?: + | ( + | { + active?: boolean | undefined + id?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string + statement_descriptor?: string | undefined + tax_code?: string | undefined + unit_label?: string | undefined + } + | string + ) + | undefined + tiers?: + | { + flat_amount?: number | undefined + flat_amount_decimal?: string | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + up_to: "inf" | number + }[] + | undefined + tiers_mode?: ("graduated" | "volume") | undefined + transform_usage?: + | { + divide_by: number + round: "down" | "up" + } + | undefined + trial_period_days?: number | undefined + usage_type?: ("licensed" | "metered") | undefined +} + +export type t_PostPlansPlanParamSchema = { + plan: string +} + +export type t_PostPlansPlanRequestBodySchema = { + active?: boolean | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + nickname?: string | undefined + product?: string | undefined + trial_period_days?: number | undefined +} + +export type t_PostPricesRequestBodySchema = { + active?: boolean | undefined + billing_scheme?: ("per_unit" | "tiered") | undefined + currency: string + currency_options?: + | { + [key: string]: + | { + custom_unit_amount?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + preset?: number | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + tiers?: + | { + flat_amount?: number | undefined + flat_amount_decimal?: string | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + up_to: "inf" | number + }[] + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + } + | undefined + custom_unit_amount?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + preset?: number | undefined + } + | undefined + expand?: string[] | undefined + lookup_key?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + nickname?: string | undefined + product?: string | undefined + product_data?: + | { + active?: boolean | undefined + id?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string + statement_descriptor?: string | undefined + tax_code?: string | undefined + unit_label?: string | undefined + } + | undefined + recurring?: + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + meter?: string | undefined + usage_type?: ("licensed" | "metered") | undefined + } + | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + tiers?: + | { + flat_amount?: number | undefined + flat_amount_decimal?: string | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + up_to: "inf" | number + }[] + | undefined + tiers_mode?: ("graduated" | "volume") | undefined + transfer_lookup_key?: boolean | undefined + transform_quantity?: + | { + divide_by: number + round: "down" | "up" + } + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined +} + +export type t_PostPricesPriceParamSchema = { + price: string +} + +export type t_PostPricesPriceRequestBodySchema = { + active?: boolean | undefined + currency_options?: + | ( + | { + [key: string]: + | { + custom_unit_amount?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + preset?: number | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + tiers?: + | { + flat_amount?: number | undefined + flat_amount_decimal?: string | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + up_to: "inf" | number + }[] + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + } + | "" + ) + | undefined + expand?: string[] | undefined + lookup_key?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + nickname?: string | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + transfer_lookup_key?: boolean | undefined +} + +export type t_PostProductsRequestBodySchema = { + active?: boolean | undefined + default_price_data?: + | { + currency: string + currency_options?: + | { + [key: string]: + | { + custom_unit_amount?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + preset?: number | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + tiers?: + | { + flat_amount?: number | undefined + flat_amount_decimal?: string | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + up_to: "inf" | number + }[] + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + } + | undefined + custom_unit_amount?: + | { + enabled: boolean + maximum?: number | undefined + minimum?: number | undefined + preset?: number | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + recurring?: + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + description?: string | undefined + expand?: string[] | undefined + id?: string | undefined + images?: string[] | undefined + marketing_features?: + | { + name: string + }[] + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string + package_dimensions?: + | { + height: number + length: number + weight: number + width: number + } + | undefined + shippable?: boolean | undefined + statement_descriptor?: string | undefined + tax_code?: string | undefined + unit_label?: string | undefined + url?: string | undefined +} + +export type t_PostProductsIdParamSchema = { + id: string +} + +export type t_PostProductsIdRequestBodySchema = { + active?: boolean | undefined + default_price?: string | undefined + description?: (string | "") | undefined + expand?: string[] | undefined + images?: (string[] | "") | undefined + marketing_features?: + | ( + | { + name: string + }[] + | "" + ) + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + name?: string | undefined + package_dimensions?: + | ( + | { + height: number + length: number + weight: number + width: number + } + | "" + ) + | undefined + shippable?: boolean | undefined + statement_descriptor?: string | undefined + tax_code?: (string | "") | undefined + unit_label?: (string | "") | undefined + url?: (string | "") | undefined +} + +export type t_PostProductsProductFeaturesParamSchema = { + product: string +} + +export type t_PostProductsProductFeaturesRequestBodySchema = { + entitlement_feature: string + expand?: string[] | undefined +} + +export type t_PostPromotionCodesRequestBodySchema = { + active?: boolean | undefined + code?: string | undefined + coupon: string + customer?: string | undefined + expand?: string[] | undefined + expires_at?: number | undefined + max_redemptions?: number | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + restrictions?: + | { + currency_options?: + | { + [key: string]: + | { + minimum_amount?: number | undefined + } + | undefined + } + | undefined + first_time_transaction?: boolean | undefined + minimum_amount?: number | undefined + minimum_amount_currency?: string | undefined + } + | undefined +} + +export type t_PostPromotionCodesPromotionCodeParamSchema = { + promotion_code: string +} + +export type t_PostPromotionCodesPromotionCodeRequestBodySchema = { + active?: boolean | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + restrictions?: + | { + currency_options?: + | { + [key: string]: + | { + minimum_amount?: number | undefined + } + | undefined + } + | undefined + } + | undefined +} + +export type t_PostQuotesRequestBodySchema = { + application_fee_amount?: (number | "") | undefined + application_fee_percent?: (number | "") | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + customer?: string | undefined + default_tax_rates?: (string[] | "") | undefined + description?: (string | "") | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + expires_at?: number | undefined + footer?: (string | "") | undefined + from_quote?: + | { + is_revision?: boolean | undefined + quote: string + } + | undefined + header?: (string | "") | undefined + invoice_settings?: + | { + days_until_due?: number | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + line_items?: + | { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring?: + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: (string | "") | undefined + subscription_data?: + | { + description?: string | undefined + effective_date?: ("current_period_end" | number | "") | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + trial_period_days?: (number | "") | undefined + } + | undefined + test_clock?: string | undefined + transfer_data?: + | ( + | { + amount?: number | undefined + amount_percent?: number | undefined + destination: string + } + | "" + ) + | undefined +} + +export type t_PostQuotesQuoteParamSchema = { + quote: string +} + +export type t_PostQuotesQuoteRequestBodySchema = { + application_fee_amount?: (number | "") | undefined + application_fee_percent?: (number | "") | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + customer?: string | undefined + default_tax_rates?: (string[] | "") | undefined + description?: (string | "") | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + expires_at?: number | undefined + footer?: (string | "") | undefined + header?: (string | "") | undefined + invoice_settings?: + | { + days_until_due?: number | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + line_items?: + | { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + id?: string | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring?: + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: (string | "") | undefined + subscription_data?: + | { + description?: (string | "") | undefined + effective_date?: ("current_period_end" | number | "") | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + trial_period_days?: (number | "") | undefined + } + | undefined + transfer_data?: + | ( + | { + amount?: number | undefined + amount_percent?: number | undefined + destination: string + } + | "" + ) + | undefined +} + +export type t_PostQuotesQuoteAcceptParamSchema = { + quote: string +} + +export type t_PostQuotesQuoteAcceptRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostQuotesQuoteCancelParamSchema = { + quote: string +} + +export type t_PostQuotesQuoteCancelRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostQuotesQuoteFinalizeParamSchema = { + quote: string +} + +export type t_PostQuotesQuoteFinalizeRequestBodySchema = { + expand?: string[] | undefined + expires_at?: number | undefined +} + +export type t_PostRadarValueListItemsRequestBodySchema = { + expand?: string[] | undefined + value: string + value_list: string +} + +export type t_PostRadarValueListsRequestBodySchema = { + alias: string + expand?: string[] | undefined + item_type?: + | ( + | "card_bin" + | "card_fingerprint" + | "case_sensitive_string" + | "country" + | "customer_id" + | "email" + | "ip_address" + | "sepa_debit_fingerprint" + | "string" + | "us_bank_account_fingerprint" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name: string +} + +export type t_PostRadarValueListsValueListParamSchema = { + value_list: string +} + +export type t_PostRadarValueListsValueListRequestBodySchema = { + alias?: string | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + name?: string | undefined +} + +export type t_PostRefundsRequestBodySchema = { + amount?: number | undefined + charge?: string | undefined + currency?: string | undefined + customer?: string | undefined + expand?: string[] | undefined + instructions_email?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + origin?: "customer_balance" | undefined + payment_intent?: string | undefined + reason?: ("duplicate" | "fraudulent" | "requested_by_customer") | undefined + refund_application_fee?: boolean | undefined + reverse_transfer?: boolean | undefined +} + +export type t_PostRefundsRefundParamSchema = { + refund: string +} + +export type t_PostRefundsRefundRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostRefundsRefundCancelParamSchema = { + refund: string +} + +export type t_PostRefundsRefundCancelRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostReportingReportRunsRequestBodySchema = { + expand?: string[] | undefined + parameters?: + | { + columns?: string[] | undefined + connected_account?: string | undefined + currency?: string | undefined + interval_end?: number | undefined + interval_start?: number | undefined + payout?: string | undefined + reporting_category?: + | ( + | "advance" + | "advance_funding" + | "anticipation_repayment" + | "charge" + | "charge_failure" + | "climate_order_purchase" + | "climate_order_refund" + | "connect_collection_transfer" + | "connect_reserved_funds" + | "contribution" + | "dispute" + | "dispute_reversal" + | "fee" + | "financing_paydown" + | "financing_paydown_reversal" + | "financing_payout" + | "financing_payout_reversal" + | "issuing_authorization_hold" + | "issuing_authorization_release" + | "issuing_dispute" + | "issuing_transaction" + | "network_cost" + | "other_adjustment" + | "partial_capture_reversal" + | "payout" + | "payout_reversal" + | "platform_earning" + | "platform_earning_refund" + | "refund" + | "refund_failure" + | "risk_reserved_funds" + | "tax" + | "topup" + | "topup_reversal" + | "transfer" + | "transfer_reversal" + | "unreconciled_customer_funds" + ) + | undefined + timezone?: + | ( + | "Africa/Abidjan" + | "Africa/Accra" + | "Africa/Addis_Ababa" + | "Africa/Algiers" + | "Africa/Asmara" + | "Africa/Asmera" + | "Africa/Bamako" + | "Africa/Bangui" + | "Africa/Banjul" + | "Africa/Bissau" + | "Africa/Blantyre" + | "Africa/Brazzaville" + | "Africa/Bujumbura" + | "Africa/Cairo" + | "Africa/Casablanca" + | "Africa/Ceuta" + | "Africa/Conakry" + | "Africa/Dakar" + | "Africa/Dar_es_Salaam" + | "Africa/Djibouti" + | "Africa/Douala" + | "Africa/El_Aaiun" + | "Africa/Freetown" + | "Africa/Gaborone" + | "Africa/Harare" + | "Africa/Johannesburg" + | "Africa/Juba" + | "Africa/Kampala" + | "Africa/Khartoum" + | "Africa/Kigali" + | "Africa/Kinshasa" + | "Africa/Lagos" + | "Africa/Libreville" + | "Africa/Lome" + | "Africa/Luanda" + | "Africa/Lubumbashi" + | "Africa/Lusaka" + | "Africa/Malabo" + | "Africa/Maputo" + | "Africa/Maseru" + | "Africa/Mbabane" + | "Africa/Mogadishu" + | "Africa/Monrovia" + | "Africa/Nairobi" + | "Africa/Ndjamena" + | "Africa/Niamey" + | "Africa/Nouakchott" + | "Africa/Ouagadougou" + | "Africa/Porto-Novo" + | "Africa/Sao_Tome" + | "Africa/Timbuktu" + | "Africa/Tripoli" + | "Africa/Tunis" + | "Africa/Windhoek" + | "America/Adak" + | "America/Anchorage" + | "America/Anguilla" + | "America/Antigua" + | "America/Araguaina" + | "America/Argentina/Buenos_Aires" + | "America/Argentina/Catamarca" + | "America/Argentina/ComodRivadavia" + | "America/Argentina/Cordoba" + | "America/Argentina/Jujuy" + | "America/Argentina/La_Rioja" + | "America/Argentina/Mendoza" + | "America/Argentina/Rio_Gallegos" + | "America/Argentina/Salta" + | "America/Argentina/San_Juan" + | "America/Argentina/San_Luis" + | "America/Argentina/Tucuman" + | "America/Argentina/Ushuaia" + | "America/Aruba" + | "America/Asuncion" + | "America/Atikokan" + | "America/Atka" + | "America/Bahia" + | "America/Bahia_Banderas" + | "America/Barbados" + | "America/Belem" + | "America/Belize" + | "America/Blanc-Sablon" + | "America/Boa_Vista" + | "America/Bogota" + | "America/Boise" + | "America/Buenos_Aires" + | "America/Cambridge_Bay" + | "America/Campo_Grande" + | "America/Cancun" + | "America/Caracas" + | "America/Catamarca" + | "America/Cayenne" + | "America/Cayman" + | "America/Chicago" + | "America/Chihuahua" + | "America/Ciudad_Juarez" + | "America/Coral_Harbour" + | "America/Cordoba" + | "America/Costa_Rica" + | "America/Creston" + | "America/Cuiaba" + | "America/Curacao" + | "America/Danmarkshavn" + | "America/Dawson" + | "America/Dawson_Creek" + | "America/Denver" + | "America/Detroit" + | "America/Dominica" + | "America/Edmonton" + | "America/Eirunepe" + | "America/El_Salvador" + | "America/Ensenada" + | "America/Fort_Nelson" + | "America/Fort_Wayne" + | "America/Fortaleza" + | "America/Glace_Bay" + | "America/Godthab" + | "America/Goose_Bay" + | "America/Grand_Turk" + | "America/Grenada" + | "America/Guadeloupe" + | "America/Guatemala" + | "America/Guayaquil" + | "America/Guyana" + | "America/Halifax" + | "America/Havana" + | "America/Hermosillo" + | "America/Indiana/Indianapolis" + | "America/Indiana/Knox" + | "America/Indiana/Marengo" + | "America/Indiana/Petersburg" + | "America/Indiana/Tell_City" + | "America/Indiana/Vevay" + | "America/Indiana/Vincennes" + | "America/Indiana/Winamac" + | "America/Indianapolis" + | "America/Inuvik" + | "America/Iqaluit" + | "America/Jamaica" + | "America/Jujuy" + | "America/Juneau" + | "America/Kentucky/Louisville" + | "America/Kentucky/Monticello" + | "America/Knox_IN" + | "America/Kralendijk" + | "America/La_Paz" + | "America/Lima" + | "America/Los_Angeles" + | "America/Louisville" + | "America/Lower_Princes" + | "America/Maceio" + | "America/Managua" + | "America/Manaus" + | "America/Marigot" + | "America/Martinique" + | "America/Matamoros" + | "America/Mazatlan" + | "America/Mendoza" + | "America/Menominee" + | "America/Merida" + | "America/Metlakatla" + | "America/Mexico_City" + | "America/Miquelon" + | "America/Moncton" + | "America/Monterrey" + | "America/Montevideo" + | "America/Montreal" + | "America/Montserrat" + | "America/Nassau" + | "America/New_York" + | "America/Nipigon" + | "America/Nome" + | "America/Noronha" + | "America/North_Dakota/Beulah" + | "America/North_Dakota/Center" + | "America/North_Dakota/New_Salem" + | "America/Nuuk" + | "America/Ojinaga" + | "America/Panama" + | "America/Pangnirtung" + | "America/Paramaribo" + | "America/Phoenix" + | "America/Port-au-Prince" + | "America/Port_of_Spain" + | "America/Porto_Acre" + | "America/Porto_Velho" + | "America/Puerto_Rico" + | "America/Punta_Arenas" + | "America/Rainy_River" + | "America/Rankin_Inlet" + | "America/Recife" + | "America/Regina" + | "America/Resolute" + | "America/Rio_Branco" + | "America/Rosario" + | "America/Santa_Isabel" + | "America/Santarem" + | "America/Santiago" + | "America/Santo_Domingo" + | "America/Sao_Paulo" + | "America/Scoresbysund" + | "America/Shiprock" + | "America/Sitka" + | "America/St_Barthelemy" + | "America/St_Johns" + | "America/St_Kitts" + | "America/St_Lucia" + | "America/St_Thomas" + | "America/St_Vincent" + | "America/Swift_Current" + | "America/Tegucigalpa" + | "America/Thule" + | "America/Thunder_Bay" + | "America/Tijuana" + | "America/Toronto" + | "America/Tortola" + | "America/Vancouver" + | "America/Virgin" + | "America/Whitehorse" + | "America/Winnipeg" + | "America/Yakutat" + | "America/Yellowknife" + | "Antarctica/Casey" + | "Antarctica/Davis" + | "Antarctica/DumontDUrville" + | "Antarctica/Macquarie" + | "Antarctica/Mawson" + | "Antarctica/McMurdo" + | "Antarctica/Palmer" + | "Antarctica/Rothera" + | "Antarctica/South_Pole" + | "Antarctica/Syowa" + | "Antarctica/Troll" + | "Antarctica/Vostok" + | "Arctic/Longyearbyen" + | "Asia/Aden" + | "Asia/Almaty" + | "Asia/Amman" + | "Asia/Anadyr" + | "Asia/Aqtau" + | "Asia/Aqtobe" + | "Asia/Ashgabat" + | "Asia/Ashkhabad" + | "Asia/Atyrau" + | "Asia/Baghdad" + | "Asia/Bahrain" + | "Asia/Baku" + | "Asia/Bangkok" + | "Asia/Barnaul" + | "Asia/Beirut" + | "Asia/Bishkek" + | "Asia/Brunei" + | "Asia/Calcutta" + | "Asia/Chita" + | "Asia/Choibalsan" + | "Asia/Chongqing" + | "Asia/Chungking" + | "Asia/Colombo" + | "Asia/Dacca" + | "Asia/Damascus" + | "Asia/Dhaka" + | "Asia/Dili" + | "Asia/Dubai" + | "Asia/Dushanbe" + | "Asia/Famagusta" + | "Asia/Gaza" + | "Asia/Harbin" + | "Asia/Hebron" + | "Asia/Ho_Chi_Minh" + | "Asia/Hong_Kong" + | "Asia/Hovd" + | "Asia/Irkutsk" + | "Asia/Istanbul" + | "Asia/Jakarta" + | "Asia/Jayapura" + | "Asia/Jerusalem" + | "Asia/Kabul" + | "Asia/Kamchatka" + | "Asia/Karachi" + | "Asia/Kashgar" + | "Asia/Kathmandu" + | "Asia/Katmandu" + | "Asia/Khandyga" + | "Asia/Kolkata" + | "Asia/Krasnoyarsk" + | "Asia/Kuala_Lumpur" + | "Asia/Kuching" + | "Asia/Kuwait" + | "Asia/Macao" + | "Asia/Macau" + | "Asia/Magadan" + | "Asia/Makassar" + | "Asia/Manila" + | "Asia/Muscat" + | "Asia/Nicosia" + | "Asia/Novokuznetsk" + | "Asia/Novosibirsk" + | "Asia/Omsk" + | "Asia/Oral" + | "Asia/Phnom_Penh" + | "Asia/Pontianak" + | "Asia/Pyongyang" + | "Asia/Qatar" + | "Asia/Qostanay" + | "Asia/Qyzylorda" + | "Asia/Rangoon" + | "Asia/Riyadh" + | "Asia/Saigon" + | "Asia/Sakhalin" + | "Asia/Samarkand" + | "Asia/Seoul" + | "Asia/Shanghai" + | "Asia/Singapore" + | "Asia/Srednekolymsk" + | "Asia/Taipei" + | "Asia/Tashkent" + | "Asia/Tbilisi" + | "Asia/Tehran" + | "Asia/Tel_Aviv" + | "Asia/Thimbu" + | "Asia/Thimphu" + | "Asia/Tokyo" + | "Asia/Tomsk" + | "Asia/Ujung_Pandang" + | "Asia/Ulaanbaatar" + | "Asia/Ulan_Bator" + | "Asia/Urumqi" + | "Asia/Ust-Nera" + | "Asia/Vientiane" + | "Asia/Vladivostok" + | "Asia/Yakutsk" + | "Asia/Yangon" + | "Asia/Yekaterinburg" + | "Asia/Yerevan" + | "Atlantic/Azores" + | "Atlantic/Bermuda" + | "Atlantic/Canary" + | "Atlantic/Cape_Verde" + | "Atlantic/Faeroe" + | "Atlantic/Faroe" + | "Atlantic/Jan_Mayen" + | "Atlantic/Madeira" + | "Atlantic/Reykjavik" + | "Atlantic/South_Georgia" + | "Atlantic/St_Helena" + | "Atlantic/Stanley" + | "Australia/ACT" + | "Australia/Adelaide" + | "Australia/Brisbane" + | "Australia/Broken_Hill" + | "Australia/Canberra" + | "Australia/Currie" + | "Australia/Darwin" + | "Australia/Eucla" + | "Australia/Hobart" + | "Australia/LHI" + | "Australia/Lindeman" + | "Australia/Lord_Howe" + | "Australia/Melbourne" + | "Australia/NSW" + | "Australia/North" + | "Australia/Perth" + | "Australia/Queensland" + | "Australia/South" + | "Australia/Sydney" + | "Australia/Tasmania" + | "Australia/Victoria" + | "Australia/West" + | "Australia/Yancowinna" + | "Brazil/Acre" + | "Brazil/DeNoronha" + | "Brazil/East" + | "Brazil/West" + | "CET" + | "CST6CDT" + | "Canada/Atlantic" + | "Canada/Central" + | "Canada/Eastern" + | "Canada/Mountain" + | "Canada/Newfoundland" + | "Canada/Pacific" + | "Canada/Saskatchewan" + | "Canada/Yukon" + | "Chile/Continental" + | "Chile/EasterIsland" + | "Cuba" + | "EET" + | "EST" + | "EST5EDT" + | "Egypt" + | "Eire" + | "Etc/GMT" + | "Etc/GMT+0" + | "Etc/GMT+1" + | "Etc/GMT+10" + | "Etc/GMT+11" + | "Etc/GMT+12" + | "Etc/GMT+2" + | "Etc/GMT+3" + | "Etc/GMT+4" + | "Etc/GMT+5" + | "Etc/GMT+6" + | "Etc/GMT+7" + | "Etc/GMT+8" + | "Etc/GMT+9" + | "Etc/GMT-0" + | "Etc/GMT-1" + | "Etc/GMT-10" + | "Etc/GMT-11" + | "Etc/GMT-12" + | "Etc/GMT-13" + | "Etc/GMT-14" + | "Etc/GMT-2" + | "Etc/GMT-3" + | "Etc/GMT-4" + | "Etc/GMT-5" + | "Etc/GMT-6" + | "Etc/GMT-7" + | "Etc/GMT-8" + | "Etc/GMT-9" + | "Etc/GMT0" + | "Etc/Greenwich" + | "Etc/UCT" + | "Etc/UTC" + | "Etc/Universal" + | "Etc/Zulu" + | "Europe/Amsterdam" + | "Europe/Andorra" + | "Europe/Astrakhan" + | "Europe/Athens" + | "Europe/Belfast" + | "Europe/Belgrade" + | "Europe/Berlin" + | "Europe/Bratislava" + | "Europe/Brussels" + | "Europe/Bucharest" + | "Europe/Budapest" + | "Europe/Busingen" + | "Europe/Chisinau" + | "Europe/Copenhagen" + | "Europe/Dublin" + | "Europe/Gibraltar" + | "Europe/Guernsey" + | "Europe/Helsinki" + | "Europe/Isle_of_Man" + | "Europe/Istanbul" + | "Europe/Jersey" + | "Europe/Kaliningrad" + | "Europe/Kiev" + | "Europe/Kirov" + | "Europe/Kyiv" + | "Europe/Lisbon" + | "Europe/Ljubljana" + | "Europe/London" + | "Europe/Luxembourg" + | "Europe/Madrid" + | "Europe/Malta" + | "Europe/Mariehamn" + | "Europe/Minsk" + | "Europe/Monaco" + | "Europe/Moscow" + | "Europe/Nicosia" + | "Europe/Oslo" + | "Europe/Paris" + | "Europe/Podgorica" + | "Europe/Prague" + | "Europe/Riga" + | "Europe/Rome" + | "Europe/Samara" + | "Europe/San_Marino" + | "Europe/Sarajevo" + | "Europe/Saratov" + | "Europe/Simferopol" + | "Europe/Skopje" + | "Europe/Sofia" + | "Europe/Stockholm" + | "Europe/Tallinn" + | "Europe/Tirane" + | "Europe/Tiraspol" + | "Europe/Ulyanovsk" + | "Europe/Uzhgorod" + | "Europe/Vaduz" + | "Europe/Vatican" + | "Europe/Vienna" + | "Europe/Vilnius" + | "Europe/Volgograd" + | "Europe/Warsaw" + | "Europe/Zagreb" + | "Europe/Zaporozhye" + | "Europe/Zurich" + | "Factory" + | "GB" + | "GB-Eire" + | "GMT" + | "GMT+0" + | "GMT-0" + | "GMT0" + | "Greenwich" + | "HST" + | "Hongkong" + | "Iceland" + | "Indian/Antananarivo" + | "Indian/Chagos" + | "Indian/Christmas" + | "Indian/Cocos" + | "Indian/Comoro" + | "Indian/Kerguelen" + | "Indian/Mahe" + | "Indian/Maldives" + | "Indian/Mauritius" + | "Indian/Mayotte" + | "Indian/Reunion" + | "Iran" + | "Israel" + | "Jamaica" + | "Japan" + | "Kwajalein" + | "Libya" + | "MET" + | "MST" + | "MST7MDT" + | "Mexico/BajaNorte" + | "Mexico/BajaSur" + | "Mexico/General" + | "NZ" + | "NZ-CHAT" + | "Navajo" + | "PRC" + | "PST8PDT" + | "Pacific/Apia" + | "Pacific/Auckland" + | "Pacific/Bougainville" + | "Pacific/Chatham" + | "Pacific/Chuuk" + | "Pacific/Easter" + | "Pacific/Efate" + | "Pacific/Enderbury" + | "Pacific/Fakaofo" + | "Pacific/Fiji" + | "Pacific/Funafuti" + | "Pacific/Galapagos" + | "Pacific/Gambier" + | "Pacific/Guadalcanal" + | "Pacific/Guam" + | "Pacific/Honolulu" + | "Pacific/Johnston" + | "Pacific/Kanton" + | "Pacific/Kiritimati" + | "Pacific/Kosrae" + | "Pacific/Kwajalein" + | "Pacific/Majuro" + | "Pacific/Marquesas" + | "Pacific/Midway" + | "Pacific/Nauru" + | "Pacific/Niue" + | "Pacific/Norfolk" + | "Pacific/Noumea" + | "Pacific/Pago_Pago" + | "Pacific/Palau" + | "Pacific/Pitcairn" + | "Pacific/Pohnpei" + | "Pacific/Ponape" + | "Pacific/Port_Moresby" + | "Pacific/Rarotonga" + | "Pacific/Saipan" + | "Pacific/Samoa" + | "Pacific/Tahiti" + | "Pacific/Tarawa" + | "Pacific/Tongatapu" + | "Pacific/Truk" + | "Pacific/Wake" + | "Pacific/Wallis" + | "Pacific/Yap" + | "Poland" + | "Portugal" + | "ROC" + | "ROK" + | "Singapore" + | "Turkey" + | "UCT" + | "US/Alaska" + | "US/Aleutian" + | "US/Arizona" + | "US/Central" + | "US/East-Indiana" + | "US/Eastern" + | "US/Hawaii" + | "US/Indiana-Starke" + | "US/Michigan" + | "US/Mountain" + | "US/Pacific" + | "US/Pacific-New" + | "US/Samoa" + | "UTC" + | "Universal" + | "W-SU" + | "WET" + | "Zulu" + ) + | undefined + } + | undefined + report_type: string +} + +export type t_PostReviewsReviewApproveParamSchema = { + review: string +} + +export type t_PostReviewsReviewApproveRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostSetupIntentsRequestBodySchema = { + attach_to_self?: boolean | undefined + automatic_payment_methods?: + | { + allow_redirects?: ("always" | "never") | undefined + enabled: boolean + } + | undefined + confirm?: boolean | undefined + confirmation_token?: string | undefined + customer?: string | undefined + description?: string | undefined + expand?: string[] | undefined + flow_directions?: ("inbound" | "outbound")[] | undefined + mandate_data?: + | ( + | { + customer_acceptance: { + accepted_at?: number | undefined + offline?: EmptyObject | undefined + online?: + | { + ip_address: string + user_agent: string + } + | undefined + type: "offline" | "online" + } + } + | "" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: string | undefined + payment_method?: string | undefined + payment_method_configuration?: string | undefined + payment_method_data?: + | { + acss_debit?: + | { + account_number: string + institution_number: string + transit_number: string + } + | undefined + affirm?: EmptyObject | undefined + afterpay_clearpay?: EmptyObject | undefined + alipay?: EmptyObject | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: EmptyObject | undefined + amazon_pay?: EmptyObject | undefined + au_becs_debit?: + | { + account_number: string + bsb_number: string + } + | undefined + bacs_debit?: + | { + account_number?: string | undefined + sort_code?: string | undefined + } + | undefined + bancontact?: EmptyObject | undefined + billie?: EmptyObject | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + blik?: EmptyObject | undefined + boleto?: + | { + tax_id: string + } + | undefined + cashapp?: EmptyObject | undefined + customer_balance?: EmptyObject | undefined + eps?: + | { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + ) + | undefined + } + | undefined + fpx?: + | { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + } + | undefined + giropay?: EmptyObject | undefined + grabpay?: EmptyObject | undefined + ideal?: + | { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + ) + | undefined + } + | undefined + interac_present?: EmptyObject | undefined + kakao_pay?: EmptyObject | undefined + klarna?: + | { + dob?: + | { + day: number + month: number + year: number + } + | undefined + } + | undefined + konbini?: EmptyObject | undefined + kr_card?: EmptyObject | undefined + link?: EmptyObject | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mobilepay?: EmptyObject | undefined + multibanco?: EmptyObject | undefined + naver_pay?: + | { + funding?: ("card" | "points") | undefined + } + | undefined + nz_bank_account?: + | { + account_holder_name?: string | undefined + account_number: string + bank_code: string + branch_code: string + reference?: string | undefined + suffix: string + } + | undefined + oxxo?: EmptyObject | undefined + p24?: + | { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + ) + | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: EmptyObject | undefined + paynow?: EmptyObject | undefined + paypal?: EmptyObject | undefined + pix?: EmptyObject | undefined + promptpay?: EmptyObject | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + revolut_pay?: EmptyObject | undefined + samsung_pay?: EmptyObject | undefined + satispay?: EmptyObject | undefined + sepa_debit?: + | { + iban: string + } + | undefined + sofort?: + | { + country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" + } + | undefined + swish?: EmptyObject | undefined + twint?: EmptyObject | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + wechat_pay?: EmptyObject | undefined + zip?: EmptyObject | undefined + } + | undefined + payment_method_options?: + | { + acss_debit?: + | { + currency?: ("cad" | "usd") | undefined + mandate_options?: + | { + custom_mandate_url?: (string | "") | undefined + default_for?: ("invoice" | "subscription")[] | undefined + interval_description?: string | undefined + payment_schedule?: + | ("combined" | "interval" | "sporadic") + | undefined + transaction_type?: ("business" | "personal") | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | undefined + amazon_pay?: EmptyObject | undefined + bacs_debit?: + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + } + | undefined + card?: + | { + mandate_options?: + | { + amount: number + amount_type: "fixed" | "maximum" + currency: string + description?: string | undefined + end_date?: number | undefined + interval: "day" | "month" | "sporadic" | "week" | "year" + interval_count?: number | undefined + reference: string + start_date: number + supported_types?: "india"[] | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + three_d_secure?: + | { + ares_trans_status?: + | ("A" | "C" | "I" | "N" | "R" | "U" | "Y") + | undefined + cryptogram?: string | undefined + electronic_commerce_indicator?: + | ("01" | "02" | "05" | "06" | "07") + | undefined + network_options?: + | { + cartes_bancaires?: + | { + cb_avalgo: "0" | "1" | "2" | "3" | "4" | "A" + cb_exemption?: string | undefined + cb_score?: number | undefined + } + | undefined + } + | undefined + requestor_challenge_indicator?: string | undefined + transaction_id?: string | undefined + version?: ("1.0.2" | "2.1.0" | "2.2.0") | undefined + } + | undefined + } + | undefined + card_present?: EmptyObject | undefined + link?: EmptyObject | undefined + paypal?: + | { + billing_agreement_id?: string | undefined + } + | undefined + sepa_debit?: + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + } + | undefined + us_bank_account?: + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + return_url?: string | undefined + } + | undefined + mandate_options?: + | { + collection_method?: ("" | "paper") | undefined + } + | undefined + networks?: + | { + requested?: ("ach" | "us_domestic_wire")[] | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | undefined + } + | undefined + payment_method_types?: string[] | undefined + return_url?: string | undefined + single_use?: + | { + amount: number + currency: string + } + | undefined + usage?: ("off_session" | "on_session") | undefined + use_stripe_sdk?: boolean | undefined +} + +export type t_PostSetupIntentsIntentParamSchema = { + intent: string +} + +export type t_PostSetupIntentsIntentRequestBodySchema = { + attach_to_self?: boolean | undefined + customer?: string | undefined + description?: string | undefined + expand?: string[] | undefined + flow_directions?: ("inbound" | "outbound")[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + payment_method?: string | undefined + payment_method_configuration?: string | undefined + payment_method_data?: + | { + acss_debit?: + | { + account_number: string + institution_number: string + transit_number: string + } + | undefined + affirm?: EmptyObject | undefined + afterpay_clearpay?: EmptyObject | undefined + alipay?: EmptyObject | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: EmptyObject | undefined + amazon_pay?: EmptyObject | undefined + au_becs_debit?: + | { + account_number: string + bsb_number: string + } + | undefined + bacs_debit?: + | { + account_number?: string | undefined + sort_code?: string | undefined + } + | undefined + bancontact?: EmptyObject | undefined + billie?: EmptyObject | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + blik?: EmptyObject | undefined + boleto?: + | { + tax_id: string + } + | undefined + cashapp?: EmptyObject | undefined + customer_balance?: EmptyObject | undefined + eps?: + | { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + ) + | undefined + } + | undefined + fpx?: + | { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + } + | undefined + giropay?: EmptyObject | undefined + grabpay?: EmptyObject | undefined + ideal?: + | { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + ) + | undefined + } + | undefined + interac_present?: EmptyObject | undefined + kakao_pay?: EmptyObject | undefined + klarna?: + | { + dob?: + | { + day: number + month: number + year: number + } + | undefined + } + | undefined + konbini?: EmptyObject | undefined + kr_card?: EmptyObject | undefined + link?: EmptyObject | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mobilepay?: EmptyObject | undefined + multibanco?: EmptyObject | undefined + naver_pay?: + | { + funding?: ("card" | "points") | undefined + } + | undefined + nz_bank_account?: + | { + account_holder_name?: string | undefined + account_number: string + bank_code: string + branch_code: string + reference?: string | undefined + suffix: string + } + | undefined + oxxo?: EmptyObject | undefined + p24?: + | { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + ) + | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: EmptyObject | undefined + paynow?: EmptyObject | undefined + paypal?: EmptyObject | undefined + pix?: EmptyObject | undefined + promptpay?: EmptyObject | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + revolut_pay?: EmptyObject | undefined + samsung_pay?: EmptyObject | undefined + satispay?: EmptyObject | undefined + sepa_debit?: + | { + iban: string + } + | undefined + sofort?: + | { + country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" + } + | undefined + swish?: EmptyObject | undefined + twint?: EmptyObject | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + wechat_pay?: EmptyObject | undefined + zip?: EmptyObject | undefined + } + | undefined + payment_method_options?: + | { + acss_debit?: + | { + currency?: ("cad" | "usd") | undefined + mandate_options?: + | { + custom_mandate_url?: (string | "") | undefined + default_for?: ("invoice" | "subscription")[] | undefined + interval_description?: string | undefined + payment_schedule?: + | ("combined" | "interval" | "sporadic") + | undefined + transaction_type?: ("business" | "personal") | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | undefined + amazon_pay?: EmptyObject | undefined + bacs_debit?: + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + } + | undefined + card?: + | { + mandate_options?: + | { + amount: number + amount_type: "fixed" | "maximum" + currency: string + description?: string | undefined + end_date?: number | undefined + interval: "day" | "month" | "sporadic" | "week" | "year" + interval_count?: number | undefined + reference: string + start_date: number + supported_types?: "india"[] | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + three_d_secure?: + | { + ares_trans_status?: + | ("A" | "C" | "I" | "N" | "R" | "U" | "Y") + | undefined + cryptogram?: string | undefined + electronic_commerce_indicator?: + | ("01" | "02" | "05" | "06" | "07") + | undefined + network_options?: + | { + cartes_bancaires?: + | { + cb_avalgo: "0" | "1" | "2" | "3" | "4" | "A" + cb_exemption?: string | undefined + cb_score?: number | undefined + } + | undefined + } + | undefined + requestor_challenge_indicator?: string | undefined + transaction_id?: string | undefined + version?: ("1.0.2" | "2.1.0" | "2.2.0") | undefined + } + | undefined + } + | undefined + card_present?: EmptyObject | undefined + link?: EmptyObject | undefined + paypal?: + | { + billing_agreement_id?: string | undefined + } + | undefined + sepa_debit?: + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + } + | undefined + us_bank_account?: + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + return_url?: string | undefined + } + | undefined + mandate_options?: + | { + collection_method?: ("" | "paper") | undefined + } + | undefined + networks?: + | { + requested?: ("ach" | "us_domestic_wire")[] | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | undefined + } + | undefined + payment_method_types?: string[] | undefined +} + +export type t_PostSetupIntentsIntentCancelParamSchema = { + intent: string +} + +export type t_PostSetupIntentsIntentCancelRequestBodySchema = { + cancellation_reason?: + | ("abandoned" | "duplicate" | "requested_by_customer") + | undefined + expand?: string[] | undefined +} + +export type t_PostSetupIntentsIntentConfirmParamSchema = { + intent: string +} + +export type t_PostSetupIntentsIntentConfirmRequestBodySchema = { + client_secret?: string | undefined + confirmation_token?: string | undefined + expand?: string[] | undefined + mandate_data?: + | ( + | { + customer_acceptance: { + accepted_at?: number | undefined + offline?: EmptyObject | undefined + online?: + | { + ip_address: string + user_agent: string + } + | undefined + type: "offline" | "online" + } + } + | "" + | { + customer_acceptance: { + online: { + ip_address?: string | undefined + user_agent?: string | undefined + } + type: "online" + } + } + ) + | undefined + payment_method?: string | undefined + payment_method_data?: + | { + acss_debit?: + | { + account_number: string + institution_number: string + transit_number: string + } + | undefined + affirm?: EmptyObject | undefined + afterpay_clearpay?: EmptyObject | undefined + alipay?: EmptyObject | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: EmptyObject | undefined + amazon_pay?: EmptyObject | undefined + au_becs_debit?: + | { + account_number: string + bsb_number: string + } + | undefined + bacs_debit?: + | { + account_number?: string | undefined + sort_code?: string | undefined + } + | undefined + bancontact?: EmptyObject | undefined + billie?: EmptyObject | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + blik?: EmptyObject | undefined + boleto?: + | { + tax_id: string + } + | undefined + cashapp?: EmptyObject | undefined + customer_balance?: EmptyObject | undefined + eps?: + | { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + ) + | undefined + } + | undefined + fpx?: + | { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + } + | undefined + giropay?: EmptyObject | undefined + grabpay?: EmptyObject | undefined + ideal?: + | { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + ) + | undefined + } + | undefined + interac_present?: EmptyObject | undefined + kakao_pay?: EmptyObject | undefined + klarna?: + | { + dob?: + | { + day: number + month: number + year: number + } + | undefined + } + | undefined + konbini?: EmptyObject | undefined + kr_card?: EmptyObject | undefined + link?: EmptyObject | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mobilepay?: EmptyObject | undefined + multibanco?: EmptyObject | undefined + naver_pay?: + | { + funding?: ("card" | "points") | undefined + } + | undefined + nz_bank_account?: + | { + account_holder_name?: string | undefined + account_number: string + bank_code: string + branch_code: string + reference?: string | undefined + suffix: string + } + | undefined + oxxo?: EmptyObject | undefined + p24?: + | { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + ) + | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: EmptyObject | undefined + paynow?: EmptyObject | undefined + paypal?: EmptyObject | undefined + pix?: EmptyObject | undefined + promptpay?: EmptyObject | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + revolut_pay?: EmptyObject | undefined + samsung_pay?: EmptyObject | undefined + satispay?: EmptyObject | undefined + sepa_debit?: + | { + iban: string + } + | undefined + sofort?: + | { + country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" + } + | undefined + swish?: EmptyObject | undefined + twint?: EmptyObject | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + wechat_pay?: EmptyObject | undefined + zip?: EmptyObject | undefined + } + | undefined + payment_method_options?: + | { + acss_debit?: + | { + currency?: ("cad" | "usd") | undefined + mandate_options?: + | { + custom_mandate_url?: (string | "") | undefined + default_for?: ("invoice" | "subscription")[] | undefined + interval_description?: string | undefined + payment_schedule?: + | ("combined" | "interval" | "sporadic") + | undefined + transaction_type?: ("business" | "personal") | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | undefined + amazon_pay?: EmptyObject | undefined + bacs_debit?: + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + } + | undefined + card?: + | { + mandate_options?: + | { + amount: number + amount_type: "fixed" | "maximum" + currency: string + description?: string | undefined + end_date?: number | undefined + interval: "day" | "month" | "sporadic" | "week" | "year" + interval_count?: number | undefined + reference: string + start_date: number + supported_types?: "india"[] | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + three_d_secure?: + | { + ares_trans_status?: + | ("A" | "C" | "I" | "N" | "R" | "U" | "Y") + | undefined + cryptogram?: string | undefined + electronic_commerce_indicator?: + | ("01" | "02" | "05" | "06" | "07") + | undefined + network_options?: + | { + cartes_bancaires?: + | { + cb_avalgo: "0" | "1" | "2" | "3" | "4" | "A" + cb_exemption?: string | undefined + cb_score?: number | undefined + } + | undefined + } + | undefined + requestor_challenge_indicator?: string | undefined + transaction_id?: string | undefined + version?: ("1.0.2" | "2.1.0" | "2.2.0") | undefined + } + | undefined + } + | undefined + card_present?: EmptyObject | undefined + link?: EmptyObject | undefined + paypal?: + | { + billing_agreement_id?: string | undefined + } + | undefined + sepa_debit?: + | { + mandate_options?: + | { + reference_prefix?: (string | "") | undefined + } + | undefined + } + | undefined + us_bank_account?: + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + return_url?: string | undefined + } + | undefined + mandate_options?: + | { + collection_method?: ("" | "paper") | undefined + } + | undefined + networks?: + | { + requested?: ("ach" | "us_domestic_wire")[] | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | undefined + } + | undefined + return_url?: string | undefined + use_stripe_sdk?: boolean | undefined +} + +export type t_PostSetupIntentsIntentVerifyMicrodepositsParamSchema = { + intent: string +} + +export type t_PostSetupIntentsIntentVerifyMicrodepositsRequestBodySchema = { + amounts?: number[] | undefined + client_secret?: string | undefined + descriptor_code?: string | undefined + expand?: string[] | undefined +} + +export type t_PostShippingRatesRequestBodySchema = { + delivery_estimate?: + | { + maximum?: + | { + unit: "business_day" | "day" | "hour" | "month" | "week" + value: number + } + | undefined + minimum?: + | { + unit: "business_day" | "day" | "hour" | "month" | "week" + value: number + } + | undefined + } + | undefined + display_name: string + expand?: string[] | undefined + fixed_amount?: + | { + amount: number + currency: string + currency_options?: + | { + [key: string]: + | { + amount: number + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + tax_code?: string | undefined + type?: "fixed_amount" | undefined +} + +export type t_PostShippingRatesShippingRateTokenParamSchema = { + shipping_rate_token: string +} + +export type t_PostShippingRatesShippingRateTokenRequestBodySchema = { + active?: boolean | undefined + expand?: string[] | undefined + fixed_amount?: + | { + currency_options?: + | { + [key: string]: + | { + amount?: number | undefined + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + } + | undefined + } + | undefined + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined +} + +export type t_PostSigmaSavedQueriesIdParamSchema = { + id: string +} + +export type t_PostSigmaSavedQueriesIdRequestBodySchema = { + expand?: string[] | undefined + name?: string | undefined + sql?: string | undefined +} + +export type t_PostSourcesRequestBodySchema = { + amount?: number | undefined + currency?: string | undefined + customer?: string | undefined + expand?: string[] | undefined + flow?: ("code_verification" | "none" | "receiver" | "redirect") | undefined + mandate?: + | { + acceptance?: + | { + date?: number | undefined + ip?: string | undefined + offline?: + | { + contact_email: string + } + | undefined + online?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: string | undefined + } + | undefined + status: "accepted" | "pending" | "refused" | "revoked" + type?: ("offline" | "online") | undefined + user_agent?: string | undefined + } + | undefined + amount?: (number | "") | undefined + currency?: string | undefined + interval?: ("one_time" | "scheduled" | "variable") | undefined + notification_method?: + | ("deprecated_none" | "email" | "manual" | "none" | "stripe_email") + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + original_source?: string | undefined + owner?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + email?: string | undefined + name?: string | undefined + phone?: string | undefined + } + | undefined + receiver?: + | { + refund_attributes_method?: ("email" | "manual" | "none") | undefined + } + | undefined + redirect?: + | { + return_url: string + } + | undefined + source_order?: + | { + items?: + | { + amount?: number | undefined + currency?: string | undefined + description?: string | undefined + parent?: string | undefined + quantity?: number | undefined + type?: ("discount" | "shipping" | "sku" | "tax") | undefined + }[] + | undefined + shipping?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1: string + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + carrier?: string | undefined + name?: string | undefined + phone?: string | undefined + tracking_number?: string | undefined + } + | undefined + } + | undefined + statement_descriptor?: string | undefined + token?: string | undefined + type?: string | undefined + usage?: ("reusable" | "single_use") | undefined +} + +export type t_PostSourcesSourceParamSchema = { + source: string +} + +export type t_PostSourcesSourceRequestBodySchema = { + amount?: number | undefined + expand?: string[] | undefined + mandate?: + | { + acceptance?: + | { + date?: number | undefined + ip?: string | undefined + offline?: + | { + contact_email: string + } + | undefined + online?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: string | undefined + } + | undefined + status: "accepted" | "pending" | "refused" | "revoked" + type?: ("offline" | "online") | undefined + user_agent?: string | undefined + } + | undefined + amount?: (number | "") | undefined + currency?: string | undefined + interval?: ("one_time" | "scheduled" | "variable") | undefined + notification_method?: + | ("deprecated_none" | "email" | "manual" | "none" | "stripe_email") + | undefined + } + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + owner?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + email?: string | undefined + name?: string | undefined + phone?: string | undefined + } + | undefined + source_order?: + | { + items?: + | { + amount?: number | undefined + currency?: string | undefined + description?: string | undefined + parent?: string | undefined + quantity?: number | undefined + type?: ("discount" | "shipping" | "sku" | "tax") | undefined + }[] + | undefined + shipping?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1: string + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + carrier?: string | undefined + name?: string | undefined + phone?: string | undefined + tracking_number?: string | undefined + } + | undefined + } + | undefined +} + +export type t_PostSourcesSourceVerifyParamSchema = { + source: string +} + +export type t_PostSourcesSourceVerifyRequestBodySchema = { + expand?: string[] | undefined + values: string[] +} + +export type t_PostSubscriptionItemsRequestBodySchema = { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + payment_behavior?: + | ( + | "allow_incomplete" + | "default_incomplete" + | "error_if_incomplete" + | "pending_if_incomplete" + ) + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + proration_date?: number | undefined + quantity?: number | undefined + subscription: string + tax_rates?: (string[] | "") | undefined +} + +export type t_PostSubscriptionItemsItemParamSchema = { + item: string +} + +export type t_PostSubscriptionItemsItemRequestBodySchema = { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + off_session?: boolean | undefined + payment_behavior?: + | ( + | "allow_incomplete" + | "default_incomplete" + | "error_if_incomplete" + | "pending_if_incomplete" + ) + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: ("exclusive" | "inclusive" | "unspecified") | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + proration_date?: number | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined +} + +export type t_PostSubscriptionSchedulesRequestBodySchema = { + customer?: string | undefined + default_settings?: + | { + application_fee_percent?: number | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_cycle_anchor?: ("automatic" | "phase_start") | undefined + collection_method?: + | ("charge_automatically" | "send_invoice") + | undefined + default_payment_method?: string | undefined + description?: (string | "") | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + days_until_due?: number | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + on_behalf_of?: (string | "") | undefined + transfer_data?: + | ( + | { + amount_percent?: number | undefined + destination: string + } + | "" + ) + | undefined + } + | undefined + end_behavior?: ("cancel" | "none" | "release" | "renew") | undefined + expand?: string[] | undefined + from_subscription?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + phases?: + | { + add_invoice_items?: + | { + discounts?: + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + application_fee_percent?: number | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_cycle_anchor?: ("automatic" | "phase_start") | undefined + collection_method?: + | ("charge_automatically" | "send_invoice") + | undefined + currency?: string | undefined + default_payment_method?: string | undefined + default_tax_rates?: (string[] | "") | undefined + description?: (string | "") | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + end_date?: number | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + days_until_due?: number | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + items: { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + iterations?: number | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: string | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + transfer_data?: + | { + amount_percent?: number | undefined + destination: string + } + | undefined + trial?: boolean | undefined + trial_end?: number | undefined + }[] + | undefined + start_date?: (number | "now") | undefined +} + +export type t_PostSubscriptionSchedulesScheduleParamSchema = { + schedule: string +} + +export type t_PostSubscriptionSchedulesScheduleRequestBodySchema = { + default_settings?: + | { + application_fee_percent?: number | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_cycle_anchor?: ("automatic" | "phase_start") | undefined + collection_method?: + | ("charge_automatically" | "send_invoice") + | undefined + default_payment_method?: string | undefined + description?: (string | "") | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + days_until_due?: number | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + on_behalf_of?: (string | "") | undefined + transfer_data?: + | ( + | { + amount_percent?: number | undefined + destination: string + } + | "" + ) + | undefined + } + | undefined + end_behavior?: ("cancel" | "none" | "release" | "renew") | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + phases?: + | { + add_invoice_items?: + | { + discounts?: + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + application_fee_percent?: number | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_cycle_anchor?: ("automatic" | "phase_start") | undefined + collection_method?: + | ("charge_automatically" | "send_invoice") + | undefined + default_payment_method?: string | undefined + default_tax_rates?: (string[] | "") | undefined + description?: (string | "") | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + end_date?: (number | "now") | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + days_until_due?: number | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + items: { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + iterations?: number | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + on_behalf_of?: string | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + start_date?: (number | "now") | undefined + transfer_data?: + | { + amount_percent?: number | undefined + destination: string + } + | undefined + trial?: boolean | undefined + trial_end?: (number | "now") | undefined + }[] + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined +} + +export type t_PostSubscriptionSchedulesScheduleCancelParamSchema = { + schedule: string +} + +export type t_PostSubscriptionSchedulesScheduleCancelRequestBodySchema = { + expand?: string[] | undefined + invoice_now?: boolean | undefined + prorate?: boolean | undefined +} + +export type t_PostSubscriptionSchedulesScheduleReleaseParamSchema = { + schedule: string +} + +export type t_PostSubscriptionSchedulesScheduleReleaseRequestBodySchema = { + expand?: string[] | undefined + preserve_cancel_date?: boolean | undefined +} + +export type t_PostSubscriptionsRequestBodySchema = { + add_invoice_items?: + | { + discounts?: + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + application_fee_percent?: (number | "") | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + backdate_start_date?: number | undefined + billing_cycle_anchor?: number | undefined + billing_cycle_anchor_config?: + | { + day_of_month: number + hour?: number | undefined + minute?: number | undefined + month?: number | undefined + second?: number | undefined + } + | undefined + cancel_at?: number | undefined + cancel_at_period_end?: boolean | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + currency?: string | undefined + customer: string + days_until_due?: number | undefined + default_payment_method?: string | undefined + default_source?: string | undefined + default_tax_rates?: (string[] | "") | undefined + description?: string | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + items?: + | { + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + off_session?: boolean | undefined + on_behalf_of?: (string | "") | undefined + payment_behavior?: + | ( + | "allow_incomplete" + | "default_incomplete" + | "error_if_incomplete" + | "pending_if_incomplete" + ) + | undefined + payment_settings?: + | { + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + transaction_type?: + | ("business" | "personal") + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: + | ("de" | "en" | "fr" | "nl") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + mandate_options?: + | { + amount?: number | undefined + amount_type?: ("fixed" | "maximum") | undefined + description?: string | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + type?: string | undefined + } + | undefined + funding_type?: string | undefined + } + | "" + ) + | undefined + konbini?: (EmptyObject | "") | undefined + sepa_debit?: (EmptyObject | "") | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: + | ( + | ( + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "jp_credit_transfer" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "p24" + | "payco" + | "paynow" + | "paypal" + | "promptpay" + | "revolut_pay" + | "sepa_credit_transfer" + | "sepa_debit" + | "sofort" + | "swish" + | "us_bank_account" + | "wechat_pay" + )[] + | "" + ) + | undefined + save_default_payment_method?: ("off" | "on_subscription") | undefined + } + | undefined + pending_invoice_item_interval?: + | ( + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + | "" + ) + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + transfer_data?: + | { + amount_percent?: number | undefined + destination: string + } + | undefined + trial_end?: ("now" | number) | undefined + trial_from_plan?: boolean | undefined + trial_period_days?: number | undefined + trial_settings?: + | { + end_behavior: { + missing_payment_method: "cancel" | "create_invoice" | "pause" + } + } + | undefined +} + +export type t_PostSubscriptionsSubscriptionExposedIdParamSchema = { + subscription_exposed_id: string +} + +export type t_PostSubscriptionsSubscriptionExposedIdRequestBodySchema = { + add_invoice_items?: + | { + discounts?: + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + application_fee_percent?: (number | "") | undefined + automatic_tax?: + | { + enabled: boolean + liability?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + billing_cycle_anchor?: ("now" | "unchanged") | undefined + cancel_at?: (number | "") | undefined + cancel_at_period_end?: boolean | undefined + cancellation_details?: + | { + comment?: (string | "") | undefined + feedback?: + | ( + | "" + | "customer_service" + | "low_quality" + | "missing_features" + | "other" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + ) + | undefined + } + | undefined + collection_method?: ("charge_automatically" | "send_invoice") | undefined + days_until_due?: number | undefined + default_payment_method?: string | undefined + default_source?: (string | "") | undefined + default_tax_rates?: (string[] | "") | undefined + description?: (string | "") | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + expand?: string[] | undefined + invoice_settings?: + | { + account_tax_ids?: (string[] | "") | undefined + issuer?: + | { + account?: string | undefined + type: "account" | "self" + } + | undefined + } + | undefined + items?: + | { + clear_usage?: boolean | undefined + deleted?: boolean | undefined + discounts?: + | ( + | { + coupon?: string | undefined + discount?: string | undefined + promotion_code?: string | undefined + }[] + | "" + ) + | undefined + id?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + price?: string | undefined + price_data?: + | { + currency: string + product: string + recurring: { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + tax_behavior?: + | ("exclusive" | "inclusive" | "unspecified") + | undefined + unit_amount?: number | undefined + unit_amount_decimal?: string | undefined + } + | undefined + quantity?: number | undefined + tax_rates?: (string[] | "") | undefined + }[] + | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + off_session?: boolean | undefined + on_behalf_of?: (string | "") | undefined + pause_collection?: + | ( + | { + behavior: "keep_as_draft" | "mark_uncollectible" | "void" + resumes_at?: number | undefined + } + | "" + ) + | undefined + payment_behavior?: + | ( + | "allow_incomplete" + | "default_incomplete" + | "error_if_incomplete" + | "pending_if_incomplete" + ) + | undefined + payment_settings?: + | { + payment_method_options?: + | { + acss_debit?: + | ( + | { + mandate_options?: + | { + transaction_type?: + | ("business" | "personal") + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + bancontact?: + | ( + | { + preferred_language?: + | ("de" | "en" | "fr" | "nl") + | undefined + } + | "" + ) + | undefined + card?: + | ( + | { + mandate_options?: + | { + amount?: number | undefined + amount_type?: ("fixed" | "maximum") | undefined + description?: string | undefined + } + | undefined + network?: + | ( + | "amex" + | "cartes_bancaires" + | "diners" + | "discover" + | "eftpos_au" + | "girocard" + | "interac" + | "jcb" + | "link" + | "mastercard" + | "unionpay" + | "unknown" + | "visa" + ) + | undefined + request_three_d_secure?: + | ("any" | "automatic" | "challenge") + | undefined + } + | "" + ) + | undefined + customer_balance?: + | ( + | { + bank_transfer?: + | { + eu_bank_transfer?: + | { + country: string + } + | undefined + type?: string | undefined + } + | undefined + funding_type?: string | undefined + } + | "" + ) + | undefined + konbini?: (EmptyObject | "") | undefined + sepa_debit?: (EmptyObject | "") | undefined + us_bank_account?: + | ( + | { + financial_connections?: + | { + filters?: + | { + account_subcategories?: + | ("checking" | "savings")[] + | undefined + } + | undefined + permissions?: + | ( + | "balances" + | "ownership" + | "payment_method" + | "transactions" + )[] + | undefined + prefetch?: + | ("balances" | "ownership" | "transactions")[] + | undefined + } + | undefined + verification_method?: + | ("automatic" | "instant" | "microdeposits") + | undefined + } + | "" + ) + | undefined + } + | undefined + payment_method_types?: + | ( + | ( + | "ach_credit_transfer" + | "ach_debit" + | "acss_debit" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "boleto" + | "card" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "jp_credit_transfer" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "p24" + | "payco" + | "paynow" + | "paypal" + | "promptpay" + | "revolut_pay" + | "sepa_credit_transfer" + | "sepa_debit" + | "sofort" + | "swish" + | "us_bank_account" + | "wechat_pay" + )[] + | "" + ) + | undefined + save_default_payment_method?: ("off" | "on_subscription") | undefined + } + | undefined + pending_invoice_item_interval?: + | ( + | { + interval: "day" | "month" | "week" | "year" + interval_count?: number | undefined + } + | "" + ) + | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + proration_date?: number | undefined + transfer_data?: + | ( + | { + amount_percent?: number | undefined + destination: string + } + | "" + ) + | undefined + trial_end?: ("now" | number) | undefined + trial_from_plan?: boolean | undefined + trial_settings?: + | { + end_behavior: { + missing_payment_method: "cancel" | "create_invoice" | "pause" + } + } + | undefined +} + +export type t_PostSubscriptionsSubscriptionResumeParamSchema = { + subscription: string +} + +export type t_PostSubscriptionsSubscriptionResumeRequestBodySchema = { + billing_cycle_anchor?: ("now" | "unchanged") | undefined + expand?: string[] | undefined + proration_behavior?: + | ("always_invoice" | "create_prorations" | "none") + | undefined + proration_date?: number | undefined +} + +export type t_PostTaxCalculationsRequestBodySchema = { + currency: string + customer?: string | undefined + customer_details?: + | { + address?: + | { + city?: (string | "") | undefined + country: string + line1?: (string | "") | undefined + line2?: (string | "") | undefined + postal_code?: (string | "") | undefined + state?: (string | "") | undefined + } + | undefined + address_source?: ("billing" | "shipping") | undefined + ip_address?: string | undefined + tax_ids?: + | { + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value: string + }[] + | undefined + taxability_override?: + | ("customer_exempt" | "none" | "reverse_charge") + | undefined + } + | undefined + expand?: string[] | undefined + line_items: { + amount: number + product?: string | undefined + quantity?: number | undefined + reference?: string | undefined + tax_behavior?: ("exclusive" | "inclusive") | undefined + tax_code?: string | undefined + }[] + ship_from_details?: + | { + address: { + city?: (string | "") | undefined + country: string + line1?: (string | "") | undefined + line2?: (string | "") | undefined + postal_code?: (string | "") | undefined + state?: (string | "") | undefined + } + } + | undefined + shipping_cost?: + | { + amount?: number | undefined + shipping_rate?: string | undefined + tax_behavior?: ("exclusive" | "inclusive") | undefined + tax_code?: string | undefined + } + | undefined + tax_date?: number | undefined +} + +export type t_PostTaxIdsRequestBodySchema = { + expand?: string[] | undefined + owner?: + | { + account?: string | undefined + customer?: string | undefined + type: "account" | "application" | "customer" | "self" + } + | undefined + type: + | "ad_nrt" + | "ae_trn" + | "al_tin" + | "am_tin" + | "ao_tin" + | "ar_cuit" + | "au_abn" + | "au_arn" + | "ba_tin" + | "bb_tin" + | "bg_uic" + | "bh_vat" + | "bo_tin" + | "br_cnpj" + | "br_cpf" + | "bs_tin" + | "by_tin" + | "ca_bn" + | "ca_gst_hst" + | "ca_pst_bc" + | "ca_pst_mb" + | "ca_pst_sk" + | "ca_qst" + | "cd_nif" + | "ch_uid" + | "ch_vat" + | "cl_tin" + | "cn_tin" + | "co_nit" + | "cr_tin" + | "de_stn" + | "do_rcn" + | "ec_ruc" + | "eg_tin" + | "es_cif" + | "eu_oss_vat" + | "eu_vat" + | "gb_vat" + | "ge_vat" + | "gn_nif" + | "hk_br" + | "hr_oib" + | "hu_tin" + | "id_npwp" + | "il_vat" + | "in_gst" + | "is_vat" + | "jp_cn" + | "jp_rn" + | "jp_trn" + | "ke_pin" + | "kh_tin" + | "kr_brn" + | "kz_bin" + | "li_uid" + | "li_vat" + | "ma_vat" + | "md_vat" + | "me_pib" + | "mk_vat" + | "mr_nif" + | "mx_rfc" + | "my_frp" + | "my_itn" + | "my_sst" + | "ng_tin" + | "no_vat" + | "no_voec" + | "np_pan" + | "nz_gst" + | "om_vat" + | "pe_ruc" + | "ph_tin" + | "ro_tin" + | "rs_pib" + | "ru_inn" + | "ru_kpp" + | "sa_vat" + | "sg_gst" + | "sg_uen" + | "si_tin" + | "sn_ninea" + | "sr_fin" + | "sv_nit" + | "th_vat" + | "tj_tin" + | "tr_tin" + | "tw_vat" + | "tz_vat" + | "ua_vat" + | "ug_tin" + | "us_ein" + | "uy_ruc" + | "uz_tin" + | "uz_vat" + | "ve_rif" + | "vn_tin" + | "za_vat" + | "zm_tin" + | "zw_tin" + value: string +} + +export type t_PostTaxRatesRequestBodySchema = { + active?: boolean | undefined + country?: string | undefined + description?: string | undefined + display_name: string + expand?: string[] | undefined + inclusive: boolean + jurisdiction?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + percentage: number + state?: string | undefined + tax_type?: + | ( + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "retail_delivery_fee" + | "rst" + | "sales_tax" + | "service_tax" + | "vat" + ) + | undefined +} + +export type t_PostTaxRatesTaxRateParamSchema = { + tax_rate: string +} + +export type t_PostTaxRatesTaxRateRequestBodySchema = { + active?: boolean | undefined + country?: string | undefined + description?: string | undefined + display_name?: string | undefined + expand?: string[] | undefined + jurisdiction?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + state?: string | undefined + tax_type?: + | ( + | "amusement_tax" + | "communications_tax" + | "gst" + | "hst" + | "igst" + | "jct" + | "lease_tax" + | "pst" + | "qst" + | "retail_delivery_fee" + | "rst" + | "sales_tax" + | "service_tax" + | "vat" + ) + | undefined +} + +export type t_PostTaxRegistrationsRequestBodySchema = { + active_from: "now" | number + country: string + country_options: { + ae?: + | { + type: "standard" + } + | undefined + al?: + | { + type: "standard" + } + | undefined + am?: + | { + type: "simplified" + } + | undefined + ao?: + | { + type: "standard" + } + | undefined + at?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + au?: + | { + type: "standard" + } + | undefined + ba?: + | { + type: "standard" + } + | undefined + bb?: + | { + type: "standard" + } + | undefined + be?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + bg?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + bh?: + | { + type: "standard" + } + | undefined + bs?: + | { + type: "standard" + } + | undefined + by?: + | { + type: "simplified" + } + | undefined + ca?: + | { + province_standard?: + | { + province: string + } + | undefined + type: "province_standard" | "simplified" | "standard" + } + | undefined + cd?: + | { + type: "standard" + } + | undefined + ch?: + | { + type: "standard" + } + | undefined + cl?: + | { + type: "simplified" + } + | undefined + co?: + | { + type: "simplified" + } + | undefined + cr?: + | { + type: "simplified" + } + | undefined + cy?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + cz?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + de?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + dk?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + ec?: + | { + type: "simplified" + } + | undefined + ee?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + eg?: + | { + type: "simplified" + } + | undefined + es?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + fi?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + fr?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + gb?: + | { + type: "standard" + } + | undefined + ge?: + | { + type: "simplified" + } + | undefined + gn?: + | { + type: "standard" + } + | undefined + gr?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + hr?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + hu?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + id?: + | { + type: "simplified" + } + | undefined + ie?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + is?: + | { + type: "standard" + } + | undefined + it?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + jp?: + | { + type: "standard" + } + | undefined + ke?: + | { + type: "simplified" + } + | undefined + kh?: + | { + type: "simplified" + } + | undefined + kr?: + | { + type: "simplified" + } + | undefined + kz?: + | { + type: "simplified" + } + | undefined + lt?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + lu?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + lv?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + ma?: + | { + type: "simplified" + } + | undefined + md?: + | { + type: "simplified" + } + | undefined + me?: + | { + type: "standard" + } + | undefined + mk?: + | { + type: "standard" + } + | undefined + mr?: + | { + type: "standard" + } + | undefined + mt?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + mx?: + | { + type: "simplified" + } + | undefined + my?: + | { + type: "simplified" + } + | undefined + ng?: + | { + type: "simplified" + } + | undefined + nl?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + no?: + | { + type: "standard" + } + | undefined + np?: + | { + type: "simplified" + } + | undefined + nz?: + | { + type: "standard" + } + | undefined + om?: + | { + type: "standard" + } + | undefined + pe?: + | { + type: "simplified" + } + | undefined + pl?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + pt?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + ro?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + rs?: + | { + type: "standard" + } + | undefined + ru?: + | { + type: "simplified" + } + | undefined + sa?: + | { + type: "simplified" + } + | undefined + se?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + sg?: + | { + type: "standard" + } + | undefined + si?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + sk?: + | { + standard?: + | { + place_of_supply_scheme: "small_seller" | "standard" + } + | undefined + type: "ioss" | "oss_non_union" | "oss_union" | "standard" + } + | undefined + sn?: + | { + type: "simplified" + } + | undefined + sr?: + | { + type: "standard" + } + | undefined + th?: + | { + type: "simplified" + } + | undefined + tj?: + | { + type: "simplified" + } + | undefined + tr?: + | { + type: "simplified" + } + | undefined + tz?: + | { + type: "simplified" + } + | undefined + ug?: + | { + type: "simplified" + } + | undefined + us?: + | { + local_amusement_tax?: + | { + jurisdiction: string + } + | undefined + local_lease_tax?: + | { + jurisdiction: string + } + | undefined + state: string + state_sales_tax?: + | { + elections: { + jurisdiction?: string | undefined + type: + | "local_use_tax" + | "simplified_sellers_use_tax" + | "single_local_use_tax" + }[] + } + | undefined + type: + | "local_amusement_tax" + | "local_lease_tax" + | "state_communications_tax" + | "state_retail_delivery_fee" + | "state_sales_tax" + } + | undefined + uy?: + | { + type: "standard" + } + | undefined + uz?: + | { + type: "simplified" + } + | undefined + vn?: + | { + type: "simplified" + } + | undefined + za?: + | { + type: "standard" + } + | undefined + zm?: + | { + type: "simplified" + } + | undefined + zw?: + | { + type: "standard" + } + | undefined + } + expand?: string[] | undefined + expires_at?: number | undefined +} + +export type t_PostTaxRegistrationsIdParamSchema = { + id: string +} + +export type t_PostTaxRegistrationsIdRequestBodySchema = { + active_from?: ("now" | number) | undefined + expand?: string[] | undefined + expires_at?: ("now" | number | "") | undefined +} + +export type t_PostTaxSettingsRequestBodySchema = { + defaults?: + | { + tax_behavior?: + | ("exclusive" | "inclusive" | "inferred_by_currency") + | undefined + tax_code?: string | undefined + } + | undefined + expand?: string[] | undefined + head_office?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + } + | undefined +} + +export type t_PostTaxTransactionsCreateFromCalculationRequestBodySchema = { + calculation: string + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + posted_at?: number | undefined + reference: string +} + +export type t_PostTaxTransactionsCreateReversalRequestBodySchema = { + expand?: string[] | undefined + flat_amount?: number | undefined + line_items?: + | { + amount: number + amount_tax: number + metadata?: + | { + [key: string]: string | undefined + } + | undefined + original_line_item: string + quantity?: number | undefined + reference: string + }[] + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mode: "full" | "partial" + original_transaction: string + reference: string + shipping_cost?: + | { + amount: number + amount_tax: number + } + | undefined +} + +export type t_PostTerminalConfigurationsRequestBodySchema = { + bbpos_wisepos_e?: + | { + splashscreen?: (string | "") | undefined + } + | undefined + expand?: string[] | undefined + name?: string | undefined + offline?: + | ( + | { + enabled: boolean + } + | "" + ) + | undefined + reboot_window?: + | { + end_hour: number + start_hour: number + } + | undefined + stripe_s700?: + | { + splashscreen?: (string | "") | undefined + } + | undefined + tipping?: + | ( + | { + aud?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + cad?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + chf?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + czk?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + dkk?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + eur?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + gbp?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + hkd?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + jpy?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + myr?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + nok?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + nzd?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + pln?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + sek?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + sgd?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + usd?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + } + | "" + ) + | undefined + verifone_p400?: + | { + splashscreen?: (string | "") | undefined + } + | undefined + wifi?: + | ( + | { + enterprise_eap_peap?: + | { + ca_certificate_file?: string | undefined + password: string + ssid: string + username: string + } + | undefined + enterprise_eap_tls?: + | { + ca_certificate_file?: string | undefined + client_certificate_file: string + private_key_file: string + private_key_file_password?: string | undefined + ssid: string + } + | undefined + personal_psk?: + | { + password: string + ssid: string + } + | undefined + type: "enterprise_eap_peap" | "enterprise_eap_tls" | "personal_psk" + } + | "" + ) + | undefined +} + +export type t_PostTerminalConfigurationsConfigurationParamSchema = { + configuration: string +} + +export type t_PostTerminalConfigurationsConfigurationRequestBodySchema = { + bbpos_wisepos_e?: + | ( + | { + splashscreen?: (string | "") | undefined + } + | "" + ) + | undefined + expand?: string[] | undefined + name?: string | undefined + offline?: + | ( + | { + enabled: boolean + } + | "" + ) + | undefined + reboot_window?: + | ( + | { + end_hour: number + start_hour: number + } + | "" + ) + | undefined + stripe_s700?: + | ( + | { + splashscreen?: (string | "") | undefined + } + | "" + ) + | undefined + tipping?: + | ( + | { + aud?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + cad?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + chf?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + czk?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + dkk?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + eur?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + gbp?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + hkd?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + jpy?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + myr?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + nok?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + nzd?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + pln?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + sek?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + sgd?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + usd?: + | { + fixed_amounts?: number[] | undefined + percentages?: number[] | undefined + smart_tip_threshold?: number | undefined + } + | undefined + } + | "" + ) + | undefined + verifone_p400?: + | ( + | { + splashscreen?: (string | "") | undefined + } + | "" + ) + | undefined + wifi?: + | ( + | { + enterprise_eap_peap?: + | { + ca_certificate_file?: string | undefined + password: string + ssid: string + username: string + } + | undefined + enterprise_eap_tls?: + | { + ca_certificate_file?: string | undefined + client_certificate_file: string + private_key_file: string + private_key_file_password?: string | undefined + ssid: string + } + | undefined + personal_psk?: + | { + password: string + ssid: string + } + | undefined + type: "enterprise_eap_peap" | "enterprise_eap_tls" | "personal_psk" + } + | "" + ) + | undefined +} + +export type t_PostTerminalConnectionTokensRequestBodySchema = { + expand?: string[] | undefined + location?: string | undefined +} + +export type t_PostTerminalLocationsRequestBodySchema = { + address: { + city?: string | undefined + country: string + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + configuration_overrides?: string | undefined + display_name: string + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostTerminalLocationsLocationParamSchema = { + location: string +} + +export type t_PostTerminalLocationsLocationRequestBodySchema = { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + configuration_overrides?: (string | "") | undefined + display_name?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostTerminalReadersRequestBodySchema = { + expand?: string[] | undefined + label?: string | undefined + location?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + registration_code: string +} + +export type t_PostTerminalReadersReaderParamSchema = { + reader: string +} + +export type t_PostTerminalReadersReaderRequestBodySchema = { + expand?: string[] | undefined + label?: (string | "") | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostTerminalReadersReaderCancelActionParamSchema = { + reader: string +} + +export type t_PostTerminalReadersReaderCancelActionRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTerminalReadersReaderProcessPaymentIntentParamSchema = { + reader: string +} + +export type t_PostTerminalReadersReaderProcessPaymentIntentRequestBodySchema = { + expand?: string[] | undefined + payment_intent: string + process_config?: + | { + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + enable_customer_cancellation?: boolean | undefined + skip_tipping?: boolean | undefined + tipping?: + | { + amount_eligible?: number | undefined + } + | undefined + } + | undefined +} + +export type t_PostTerminalReadersReaderProcessSetupIntentParamSchema = { + reader: string +} + +export type t_PostTerminalReadersReaderProcessSetupIntentRequestBodySchema = { + allow_redisplay: "always" | "limited" | "unspecified" + expand?: string[] | undefined + process_config?: + | { + enable_customer_cancellation?: boolean | undefined + } + | undefined + setup_intent: string +} + +export type t_PostTerminalReadersReaderRefundPaymentParamSchema = { + reader: string +} + +export type t_PostTerminalReadersReaderRefundPaymentRequestBodySchema = { + amount?: number | undefined + charge?: string | undefined + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + payment_intent?: string | undefined + refund_application_fee?: boolean | undefined + refund_payment_config?: + | { + enable_customer_cancellation?: boolean | undefined + } + | undefined + reverse_transfer?: boolean | undefined +} + +export type t_PostTerminalReadersReaderSetReaderDisplayParamSchema = { + reader: string +} + +export type t_PostTerminalReadersReaderSetReaderDisplayRequestBodySchema = { + cart?: + | { + currency: string + line_items: { + amount: number + description: string + quantity: number + }[] + tax?: number | undefined + total: number + } + | undefined + expand?: string[] | undefined + type: "cart" +} + +export type t_PostTestHelpersConfirmationTokensRequestBodySchema = { + expand?: string[] | undefined + payment_method?: string | undefined + payment_method_data?: + | { + acss_debit?: + | { + account_number: string + institution_number: string + transit_number: string + } + | undefined + affirm?: EmptyObject | undefined + afterpay_clearpay?: EmptyObject | undefined + alipay?: EmptyObject | undefined + allow_redisplay?: ("always" | "limited" | "unspecified") | undefined + alma?: EmptyObject | undefined + amazon_pay?: EmptyObject | undefined + au_becs_debit?: + | { + account_number: string + bsb_number: string + } + | undefined + bacs_debit?: + | { + account_number?: string | undefined + sort_code?: string | undefined + } + | undefined + bancontact?: EmptyObject | undefined + billie?: EmptyObject | undefined + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + blik?: EmptyObject | undefined + boleto?: + | { + tax_id: string + } + | undefined + cashapp?: EmptyObject | undefined + customer_balance?: EmptyObject | undefined + eps?: + | { + bank?: + | ( + | "arzte_und_apotheker_bank" + | "austrian_anadi_bank_ag" + | "bank_austria" + | "bankhaus_carl_spangler" + | "bankhaus_schelhammer_und_schattera_ag" + | "bawag_psk_ag" + | "bks_bank_ag" + | "brull_kallmus_bank_ag" + | "btv_vier_lander_bank" + | "capital_bank_grawe_gruppe_ag" + | "deutsche_bank_ag" + | "dolomitenbank" + | "easybank_ag" + | "erste_bank_und_sparkassen" + | "hypo_alpeadriabank_international_ag" + | "hypo_bank_burgenland_aktiengesellschaft" + | "hypo_noe_lb_fur_niederosterreich_u_wien" + | "hypo_oberosterreich_salzburg_steiermark" + | "hypo_tirol_bank_ag" + | "hypo_vorarlberg_bank_ag" + | "marchfelder_bank" + | "oberbank_ag" + | "raiffeisen_bankengruppe_osterreich" + | "schoellerbank_ag" + | "sparda_bank_wien" + | "volksbank_gruppe" + | "volkskreditbank_ag" + | "vr_bank_braunau" + ) + | undefined + } + | undefined + fpx?: + | { + bank: + | "affin_bank" + | "agrobank" + | "alliance_bank" + | "ambank" + | "bank_islam" + | "bank_muamalat" + | "bank_of_china" + | "bank_rakyat" + | "bsn" + | "cimb" + | "deutsche_bank" + | "hong_leong_bank" + | "hsbc" + | "kfh" + | "maybank2e" + | "maybank2u" + | "ocbc" + | "pb_enterprise" + | "public_bank" + | "rhb" + | "standard_chartered" + | "uob" + } + | undefined + giropay?: EmptyObject | undefined + grabpay?: EmptyObject | undefined + ideal?: + | { + bank?: + | ( + | "abn_amro" + | "asn_bank" + | "bunq" + | "handelsbanken" + | "ing" + | "knab" + | "moneyou" + | "n26" + | "nn" + | "rabobank" + | "regiobank" + | "revolut" + | "sns_bank" + | "triodos_bank" + | "van_lanschot" + | "yoursafe" + ) + | undefined + } + | undefined + interac_present?: EmptyObject | undefined + kakao_pay?: EmptyObject | undefined + klarna?: + | { + dob?: + | { + day: number + month: number + year: number + } + | undefined + } + | undefined + konbini?: EmptyObject | undefined + kr_card?: EmptyObject | undefined + link?: EmptyObject | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + mobilepay?: EmptyObject | undefined + multibanco?: EmptyObject | undefined + naver_pay?: + | { + funding?: ("card" | "points") | undefined + } + | undefined + nz_bank_account?: + | { + account_holder_name?: string | undefined + account_number: string + bank_code: string + branch_code: string + reference?: string | undefined + suffix: string + } + | undefined + oxxo?: EmptyObject | undefined + p24?: + | { + bank?: + | ( + | "alior_bank" + | "bank_millennium" + | "bank_nowy_bfg_sa" + | "bank_pekao_sa" + | "banki_spbdzielcze" + | "blik" + | "bnp_paribas" + | "boz" + | "citi_handlowy" + | "credit_agricole" + | "envelobank" + | "etransfer_pocztowy24" + | "getin_bank" + | "ideabank" + | "ing" + | "inteligo" + | "mbank_mtransfer" + | "nest_przelew" + | "noble_pay" + | "pbac_z_ipko" + | "plus_bank" + | "santander_przelew24" + | "tmobile_usbugi_bankowe" + | "toyota_bank" + | "velobank" + | "volkswagen_bank" + ) + | undefined + } + | undefined + pay_by_bank?: EmptyObject | undefined + payco?: EmptyObject | undefined + paynow?: EmptyObject | undefined + paypal?: EmptyObject | undefined + pix?: EmptyObject | undefined + promptpay?: EmptyObject | undefined + radar_options?: + | { + session?: string | undefined + } + | undefined + revolut_pay?: EmptyObject | undefined + samsung_pay?: EmptyObject | undefined + satispay?: EmptyObject | undefined + sepa_debit?: + | { + iban: string + } + | undefined + sofort?: + | { + country: "AT" | "BE" | "DE" | "ES" | "IT" | "NL" + } + | undefined + swish?: EmptyObject | undefined + twint?: EmptyObject | undefined + type: + | "acss_debit" + | "affirm" + | "afterpay_clearpay" + | "alipay" + | "alma" + | "amazon_pay" + | "au_becs_debit" + | "bacs_debit" + | "bancontact" + | "billie" + | "blik" + | "boleto" + | "cashapp" + | "customer_balance" + | "eps" + | "fpx" + | "giropay" + | "grabpay" + | "ideal" + | "kakao_pay" + | "klarna" + | "konbini" + | "kr_card" + | "link" + | "mobilepay" + | "multibanco" + | "naver_pay" + | "nz_bank_account" + | "oxxo" + | "p24" + | "pay_by_bank" + | "payco" + | "paynow" + | "paypal" + | "pix" + | "promptpay" + | "revolut_pay" + | "samsung_pay" + | "satispay" + | "sepa_debit" + | "sofort" + | "swish" + | "twint" + | "us_bank_account" + | "wechat_pay" + | "zip" + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + wechat_pay?: EmptyObject | undefined + zip?: EmptyObject | undefined + } + | undefined + return_url?: string | undefined + setup_future_usage?: ("off_session" | "on_session") | undefined + shipping?: + | { + address: { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + name: string + phone?: (string | "") | undefined + } + | undefined +} + +export type t_PostTestHelpersCustomersCustomerFundCashBalanceParamSchema = { + customer: string +} + +export type t_PostTestHelpersCustomersCustomerFundCashBalanceRequestBodySchema = + { + amount: number + currency: string + expand?: string[] | undefined + reference?: string | undefined + } + +export type t_PostTestHelpersIssuingAuthorizationsRequestBodySchema = { + amount?: number | undefined + amount_details?: + | { + atm_fee?: number | undefined + cashback_amount?: number | undefined + } + | undefined + authorization_method?: + | ("chip" | "contactless" | "keyed_in" | "online" | "swipe") + | undefined + card: string + currency?: string | undefined + expand?: string[] | undefined + fleet?: + | { + cardholder_prompt_data?: + | { + driver_id?: string | undefined + odometer?: number | undefined + unspecified_id?: string | undefined + user_id?: string | undefined + vehicle_number?: string | undefined + } + | undefined + purchase_type?: + | ( + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + ) + | undefined + reported_breakdown?: + | { + fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + non_fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + tax?: + | { + local_amount_decimal?: string | undefined + national_amount_decimal?: string | undefined + } + | undefined + } + | undefined + service_type?: + | ("full_service" | "non_fuel_transaction" | "self_service") + | undefined + } + | undefined + fuel?: + | { + industry_product_code?: string | undefined + quantity_decimal?: string | undefined + type?: + | ( + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + ) + | undefined + unit?: + | ( + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + ) + | undefined + unit_cost_decimal?: string | undefined + } + | undefined + is_amount_controllable?: boolean | undefined + merchant_amount?: number | undefined + merchant_currency?: string | undefined + merchant_data?: + | { + category?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + ) + | undefined + city?: string | undefined + country?: string | undefined + name?: string | undefined + network_id?: string | undefined + postal_code?: string | undefined + state?: string | undefined + terminal_id?: string | undefined + url?: string | undefined + } + | undefined + network_data?: + | { + acquiring_institution_id?: string | undefined + } + | undefined + verification_data?: + | { + address_line1_check?: + | ("match" | "mismatch" | "not_provided") + | undefined + address_postal_code_check?: + | ("match" | "mismatch" | "not_provided") + | undefined + authentication_exemption?: + | { + claimed_by: "acquirer" | "issuer" + type: + | "low_value_transaction" + | "transaction_risk_analysis" + | "unknown" + } + | undefined + cvc_check?: ("match" | "mismatch" | "not_provided") | undefined + expiry_check?: ("match" | "mismatch" | "not_provided") | undefined + three_d_secure?: + | { + result: + | "attempt_acknowledged" + | "authenticated" + | "failed" + | "required" + } + | undefined + } + | undefined + wallet?: ("apple_pay" | "google_pay" | "samsung_pay") | undefined +} + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationCaptureParamSchema = + { + authorization: string + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationCaptureRequestBodySchema = + { + capture_amount?: number | undefined + close_authorization?: boolean | undefined + expand?: string[] | undefined + purchase_details?: + | { + fleet?: + | { + cardholder_prompt_data?: + | { + driver_id?: string | undefined + odometer?: number | undefined + unspecified_id?: string | undefined + user_id?: string | undefined + vehicle_number?: string | undefined + } + | undefined + purchase_type?: + | ( + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + ) + | undefined + reported_breakdown?: + | { + fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + non_fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + tax?: + | { + local_amount_decimal?: string | undefined + national_amount_decimal?: string | undefined + } + | undefined + } + | undefined + service_type?: + | ("full_service" | "non_fuel_transaction" | "self_service") + | undefined + } + | undefined + flight?: + | { + departure_at?: number | undefined + passenger_name?: string | undefined + refundable?: boolean | undefined + segments?: + | { + arrival_airport_code?: string | undefined + carrier?: string | undefined + departure_airport_code?: string | undefined + flight_number?: string | undefined + service_class?: string | undefined + stopover_allowed?: boolean | undefined + }[] + | undefined + travel_agency?: string | undefined + } + | undefined + fuel?: + | { + industry_product_code?: string | undefined + quantity_decimal?: string | undefined + type?: + | ( + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + ) + | undefined + unit?: + | ( + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + ) + | undefined + unit_cost_decimal?: string | undefined + } + | undefined + lodging?: + | { + check_in_at?: number | undefined + nights?: number | undefined + } + | undefined + receipt?: + | { + description?: string | undefined + quantity?: string | undefined + total?: number | undefined + unit_cost?: number | undefined + }[] + | undefined + reference?: string | undefined + } + | undefined + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationExpireParamSchema = + { + authorization: string + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationExpireRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountParamSchema = + { + authorization: string + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationFinalizeAmountRequestBodySchema = + { + expand?: string[] | undefined + final_amount: number + fleet?: + | { + cardholder_prompt_data?: + | { + driver_id?: string | undefined + odometer?: number | undefined + unspecified_id?: string | undefined + user_id?: string | undefined + vehicle_number?: string | undefined + } + | undefined + purchase_type?: + | ( + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + ) + | undefined + reported_breakdown?: + | { + fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + non_fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + tax?: + | { + local_amount_decimal?: string | undefined + national_amount_decimal?: string | undefined + } + | undefined + } + | undefined + service_type?: + | ("full_service" | "non_fuel_transaction" | "self_service") + | undefined + } + | undefined + fuel?: + | { + industry_product_code?: string | undefined + quantity_decimal?: string | undefined + type?: + | ( + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + ) + | undefined + unit?: + | ( + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + ) + | undefined + unit_cost_decimal?: string | undefined + } + | undefined + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondParamSchema = + { + authorization: string + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationFraudChallengesRespondRequestBodySchema = + { + confirmed: boolean + expand?: string[] | undefined + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationIncrementParamSchema = + { + authorization: string + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationIncrementRequestBodySchema = + { + expand?: string[] | undefined + increment_amount: number + is_amount_controllable?: boolean | undefined + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationReverseParamSchema = + { + authorization: string + } + +export type t_PostTestHelpersIssuingAuthorizationsAuthorizationReverseRequestBodySchema = + { + expand?: string[] | undefined + reverse_amount?: number | undefined + } + +export type t_PostTestHelpersIssuingCardsCardShippingDeliverParamSchema = { + card: string +} + +export type t_PostTestHelpersIssuingCardsCardShippingDeliverRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersIssuingCardsCardShippingFailParamSchema = { + card: string +} + +export type t_PostTestHelpersIssuingCardsCardShippingFailRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTestHelpersIssuingCardsCardShippingReturnParamSchema = { + card: string +} + +export type t_PostTestHelpersIssuingCardsCardShippingReturnRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTestHelpersIssuingCardsCardShippingShipParamSchema = { + card: string +} + +export type t_PostTestHelpersIssuingCardsCardShippingShipRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTestHelpersIssuingCardsCardShippingSubmitParamSchema = { + card: string +} + +export type t_PostTestHelpersIssuingCardsCardShippingSubmitRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateParamSchema = + { + personalization_design: string + } + +export type t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignActivateRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateParamSchema = + { + personalization_design: string + } + +export type t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignDeactivateRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectParamSchema = + { + personalization_design: string + } + +export type t_PostTestHelpersIssuingPersonalizationDesignsPersonalizationDesignRejectRequestBodySchema = + { + expand?: string[] | undefined + rejection_reasons: { + card_logo?: + | ( + | "geographic_location" + | "inappropriate" + | "network_name" + | "non_binary_image" + | "non_fiat_currency" + | "other" + | "other_entity" + | "promotional_material" + )[] + | undefined + carrier_text?: + | ( + | "geographic_location" + | "inappropriate" + | "network_name" + | "non_fiat_currency" + | "other" + | "other_entity" + | "promotional_material" + )[] + | undefined + } + } + +export type t_PostTestHelpersIssuingSettlementsRequestBodySchema = { + bin: string + clearing_date: number + currency: string + expand?: string[] | undefined + interchange_fees_amount?: number | undefined + net_total_amount: number + network?: ("maestro" | "visa") | undefined + network_settlement_identifier?: string | undefined + transaction_amount?: number | undefined + transaction_count?: number | undefined +} + +export type t_PostTestHelpersIssuingSettlementsSettlementCompleteParamSchema = { + settlement: string +} + +export type t_PostTestHelpersIssuingSettlementsSettlementCompleteRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersIssuingTransactionsCreateForceCaptureRequestBodySchema = + { + amount: number + card: string + currency?: string | undefined + expand?: string[] | undefined + merchant_data?: + | { + category?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + ) + | undefined + city?: string | undefined + country?: string | undefined + name?: string | undefined + network_id?: string | undefined + postal_code?: string | undefined + state?: string | undefined + terminal_id?: string | undefined + url?: string | undefined + } + | undefined + purchase_details?: + | { + fleet?: + | { + cardholder_prompt_data?: + | { + driver_id?: string | undefined + odometer?: number | undefined + unspecified_id?: string | undefined + user_id?: string | undefined + vehicle_number?: string | undefined + } + | undefined + purchase_type?: + | ( + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + ) + | undefined + reported_breakdown?: + | { + fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + non_fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + tax?: + | { + local_amount_decimal?: string | undefined + national_amount_decimal?: string | undefined + } + | undefined + } + | undefined + service_type?: + | ("full_service" | "non_fuel_transaction" | "self_service") + | undefined + } + | undefined + flight?: + | { + departure_at?: number | undefined + passenger_name?: string | undefined + refundable?: boolean | undefined + segments?: + | { + arrival_airport_code?: string | undefined + carrier?: string | undefined + departure_airport_code?: string | undefined + flight_number?: string | undefined + service_class?: string | undefined + stopover_allowed?: boolean | undefined + }[] + | undefined + travel_agency?: string | undefined + } + | undefined + fuel?: + | { + industry_product_code?: string | undefined + quantity_decimal?: string | undefined + type?: + | ( + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + ) + | undefined + unit?: + | ( + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + ) + | undefined + unit_cost_decimal?: string | undefined + } + | undefined + lodging?: + | { + check_in_at?: number | undefined + nights?: number | undefined + } + | undefined + receipt?: + | { + description?: string | undefined + quantity?: string | undefined + total?: number | undefined + unit_cost?: number | undefined + }[] + | undefined + reference?: string | undefined + } + | undefined + } + +export type t_PostTestHelpersIssuingTransactionsCreateUnlinkedRefundRequestBodySchema = + { + amount: number + card: string + currency?: string | undefined + expand?: string[] | undefined + merchant_data?: + | { + category?: + | ( + | "ac_refrigeration_repair" + | "accounting_bookkeeping_services" + | "advertising_services" + | "agricultural_cooperative" + | "airlines_air_carriers" + | "airports_flying_fields" + | "ambulance_services" + | "amusement_parks_carnivals" + | "antique_reproductions" + | "antique_shops" + | "aquariums" + | "architectural_surveying_services" + | "art_dealers_and_galleries" + | "artists_supply_and_craft_shops" + | "auto_and_home_supply_stores" + | "auto_body_repair_shops" + | "auto_paint_shops" + | "auto_service_shops" + | "automated_cash_disburse" + | "automated_fuel_dispensers" + | "automobile_associations" + | "automotive_parts_and_accessories_stores" + | "automotive_tire_stores" + | "bail_and_bond_payments" + | "bakeries" + | "bands_orchestras" + | "barber_and_beauty_shops" + | "betting_casino_gambling" + | "bicycle_shops" + | "billiard_pool_establishments" + | "boat_dealers" + | "boat_rentals_and_leases" + | "book_stores" + | "books_periodicals_and_newspapers" + | "bowling_alleys" + | "bus_lines" + | "business_secretarial_schools" + | "buying_shopping_services" + | "cable_satellite_and_other_pay_television_and_radio" + | "camera_and_photographic_supply_stores" + | "candy_nut_and_confectionery_stores" + | "car_and_truck_dealers_new_used" + | "car_and_truck_dealers_used_only" + | "car_rental_agencies" + | "car_washes" + | "carpentry_services" + | "carpet_upholstery_cleaning" + | "caterers" + | "charitable_and_social_service_organizations_fundraising" + | "chemicals_and_allied_products" + | "child_care_services" + | "childrens_and_infants_wear_stores" + | "chiropodists_podiatrists" + | "chiropractors" + | "cigar_stores_and_stands" + | "civic_social_fraternal_associations" + | "cleaning_and_maintenance" + | "clothing_rental" + | "colleges_universities" + | "commercial_equipment" + | "commercial_footwear" + | "commercial_photography_art_and_graphics" + | "commuter_transport_and_ferries" + | "computer_network_services" + | "computer_programming" + | "computer_repair" + | "computer_software_stores" + | "computers_peripherals_and_software" + | "concrete_work_services" + | "construction_materials" + | "consulting_public_relations" + | "correspondence_schools" + | "cosmetic_stores" + | "counseling_services" + | "country_clubs" + | "courier_services" + | "court_costs" + | "credit_reporting_agencies" + | "cruise_lines" + | "dairy_products_stores" + | "dance_hall_studios_schools" + | "dating_escort_services" + | "dentists_orthodontists" + | "department_stores" + | "detective_agencies" + | "digital_goods_applications" + | "digital_goods_games" + | "digital_goods_large_volume" + | "digital_goods_media" + | "direct_marketing_catalog_merchant" + | "direct_marketing_combination_catalog_and_retail_merchant" + | "direct_marketing_inbound_telemarketing" + | "direct_marketing_insurance_services" + | "direct_marketing_other" + | "direct_marketing_outbound_telemarketing" + | "direct_marketing_subscription" + | "direct_marketing_travel" + | "discount_stores" + | "doctors" + | "door_to_door_sales" + | "drapery_window_covering_and_upholstery_stores" + | "drinking_places" + | "drug_stores_and_pharmacies" + | "drugs_drug_proprietaries_and_druggist_sundries" + | "dry_cleaners" + | "durable_goods" + | "duty_free_stores" + | "eating_places_restaurants" + | "educational_services" + | "electric_razor_stores" + | "electric_vehicle_charging" + | "electrical_parts_and_equipment" + | "electrical_services" + | "electronics_repair_shops" + | "electronics_stores" + | "elementary_secondary_schools" + | "emergency_services_gcas_visa_use_only" + | "employment_temp_agencies" + | "equipment_rental" + | "exterminating_services" + | "family_clothing_stores" + | "fast_food_restaurants" + | "financial_institutions" + | "fines_government_administrative_entities" + | "fireplace_fireplace_screens_and_accessories_stores" + | "floor_covering_stores" + | "florists" + | "florists_supplies_nursery_stock_and_flowers" + | "freezer_and_locker_meat_provisioners" + | "fuel_dealers_non_automotive" + | "funeral_services_crematories" + | "furniture_home_furnishings_and_equipment_stores_except_appliances" + | "furniture_repair_refinishing" + | "furriers_and_fur_shops" + | "general_services" + | "gift_card_novelty_and_souvenir_shops" + | "glass_paint_and_wallpaper_stores" + | "glassware_crystal_stores" + | "golf_courses_public" + | "government_licensed_horse_dog_racing_us_region_only" + | "government_licensed_online_casions_online_gambling_us_region_only" + | "government_owned_lotteries_non_us_region" + | "government_owned_lotteries_us_region_only" + | "government_services" + | "grocery_stores_supermarkets" + | "hardware_equipment_and_supplies" + | "hardware_stores" + | "health_and_beauty_spas" + | "hearing_aids_sales_and_supplies" + | "heating_plumbing_a_c" + | "hobby_toy_and_game_shops" + | "home_supply_warehouse_stores" + | "hospitals" + | "hotels_motels_and_resorts" + | "household_appliance_stores" + | "industrial_supplies" + | "information_retrieval_services" + | "insurance_default" + | "insurance_underwriting_premiums" + | "intra_company_purchases" + | "jewelry_stores_watches_clocks_and_silverware_stores" + | "landscaping_services" + | "laundries" + | "laundry_cleaning_services" + | "legal_services_attorneys" + | "luggage_and_leather_goods_stores" + | "lumber_building_materials_stores" + | "manual_cash_disburse" + | "marinas_service_and_supplies" + | "marketplaces" + | "masonry_stonework_and_plaster" + | "massage_parlors" + | "medical_and_dental_labs" + | "medical_dental_ophthalmic_and_hospital_equipment_and_supplies" + | "medical_services" + | "membership_organizations" + | "mens_and_boys_clothing_and_accessories_stores" + | "mens_womens_clothing_stores" + | "metal_service_centers" + | "miscellaneous_apparel_and_accessory_shops" + | "miscellaneous_auto_dealers" + | "miscellaneous_business_services" + | "miscellaneous_food_stores" + | "miscellaneous_general_merchandise" + | "miscellaneous_general_services" + | "miscellaneous_home_furnishing_specialty_stores" + | "miscellaneous_publishing_and_printing" + | "miscellaneous_recreation_services" + | "miscellaneous_repair_shops" + | "miscellaneous_specialty_retail" + | "mobile_home_dealers" + | "motion_picture_theaters" + | "motor_freight_carriers_and_trucking" + | "motor_homes_dealers" + | "motor_vehicle_supplies_and_new_parts" + | "motorcycle_shops_and_dealers" + | "motorcycle_shops_dealers" + | "music_stores_musical_instruments_pianos_and_sheet_music" + | "news_dealers_and_newsstands" + | "non_fi_money_orders" + | "non_fi_stored_value_card_purchase_load" + | "nondurable_goods" + | "nurseries_lawn_and_garden_supply_stores" + | "nursing_personal_care" + | "office_and_commercial_furniture" + | "opticians_eyeglasses" + | "optometrists_ophthalmologist" + | "orthopedic_goods_prosthetic_devices" + | "osteopaths" + | "package_stores_beer_wine_and_liquor" + | "paints_varnishes_and_supplies" + | "parking_lots_garages" + | "passenger_railways" + | "pawn_shops" + | "pet_shops_pet_food_and_supplies" + | "petroleum_and_petroleum_products" + | "photo_developing" + | "photographic_photocopy_microfilm_equipment_and_supplies" + | "photographic_studios" + | "picture_video_production" + | "piece_goods_notions_and_other_dry_goods" + | "plumbing_heating_equipment_and_supplies" + | "political_organizations" + | "postal_services_government_only" + | "precious_stones_and_metals_watches_and_jewelry" + | "professional_services" + | "public_warehousing_and_storage" + | "quick_copy_repro_and_blueprint" + | "railroads" + | "real_estate_agents_and_managers_rentals" + | "record_stores" + | "recreational_vehicle_rentals" + | "religious_goods_stores" + | "religious_organizations" + | "roofing_siding_sheet_metal" + | "secretarial_support_services" + | "security_brokers_dealers" + | "service_stations" + | "sewing_needlework_fabric_and_piece_goods_stores" + | "shoe_repair_hat_cleaning" + | "shoe_stores" + | "small_appliance_repair" + | "snowmobile_dealers" + | "special_trade_services" + | "specialty_cleaning" + | "sporting_goods_stores" + | "sporting_recreation_camps" + | "sports_and_riding_apparel_stores" + | "sports_clubs_fields" + | "stamp_and_coin_stores" + | "stationary_office_supplies_printing_and_writing_paper" + | "stationery_stores_office_and_school_supply_stores" + | "swimming_pools_sales" + | "t_ui_travel_germany" + | "tailors_alterations" + | "tax_payments_government_agencies" + | "tax_preparation_services" + | "taxicabs_limousines" + | "telecommunication_equipment_and_telephone_sales" + | "telecommunication_services" + | "telegraph_services" + | "tent_and_awning_shops" + | "testing_laboratories" + | "theatrical_ticket_agencies" + | "timeshares" + | "tire_retreading_and_repair" + | "tolls_bridge_fees" + | "tourist_attractions_and_exhibits" + | "towing_services" + | "trailer_parks_campgrounds" + | "transportation_services" + | "travel_agencies_tour_operators" + | "truck_stop_iteration" + | "truck_utility_trailer_rentals" + | "typesetting_plate_making_and_related_services" + | "typewriter_stores" + | "u_s_federal_government_agencies_or_departments" + | "uniforms_commercial_clothing" + | "used_merchandise_and_secondhand_stores" + | "utilities" + | "variety_stores" + | "veterinary_services" + | "video_amusement_game_supplies" + | "video_game_arcades" + | "video_tape_rental_stores" + | "vocational_trade_schools" + | "watch_jewelry_repair" + | "welding_repair" + | "wholesale_clubs" + | "wig_and_toupee_stores" + | "wires_money_orders" + | "womens_accessory_and_specialty_shops" + | "womens_ready_to_wear_stores" + | "wrecking_and_salvage_yards" + ) + | undefined + city?: string | undefined + country?: string | undefined + name?: string | undefined + network_id?: string | undefined + postal_code?: string | undefined + state?: string | undefined + terminal_id?: string | undefined + url?: string | undefined + } + | undefined + purchase_details?: + | { + fleet?: + | { + cardholder_prompt_data?: + | { + driver_id?: string | undefined + odometer?: number | undefined + unspecified_id?: string | undefined + user_id?: string | undefined + vehicle_number?: string | undefined + } + | undefined + purchase_type?: + | ( + | "fuel_and_non_fuel_purchase" + | "fuel_purchase" + | "non_fuel_purchase" + ) + | undefined + reported_breakdown?: + | { + fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + non_fuel?: + | { + gross_amount_decimal?: string | undefined + } + | undefined + tax?: + | { + local_amount_decimal?: string | undefined + national_amount_decimal?: string | undefined + } + | undefined + } + | undefined + service_type?: + | ("full_service" | "non_fuel_transaction" | "self_service") + | undefined + } + | undefined + flight?: + | { + departure_at?: number | undefined + passenger_name?: string | undefined + refundable?: boolean | undefined + segments?: + | { + arrival_airport_code?: string | undefined + carrier?: string | undefined + departure_airport_code?: string | undefined + flight_number?: string | undefined + service_class?: string | undefined + stopover_allowed?: boolean | undefined + }[] + | undefined + travel_agency?: string | undefined + } + | undefined + fuel?: + | { + industry_product_code?: string | undefined + quantity_decimal?: string | undefined + type?: + | ( + | "diesel" + | "other" + | "unleaded_plus" + | "unleaded_regular" + | "unleaded_super" + ) + | undefined + unit?: + | ( + | "charging_minute" + | "imperial_gallon" + | "kilogram" + | "kilowatt_hour" + | "liter" + | "other" + | "pound" + | "us_gallon" + ) + | undefined + unit_cost_decimal?: string | undefined + } + | undefined + lodging?: + | { + check_in_at?: number | undefined + nights?: number | undefined + } + | undefined + receipt?: + | { + description?: string | undefined + quantity?: string | undefined + total?: number | undefined + unit_cost?: number | undefined + }[] + | undefined + reference?: string | undefined + } + | undefined + } + +export type t_PostTestHelpersIssuingTransactionsTransactionRefundParamSchema = { + transaction: string +} + +export type t_PostTestHelpersIssuingTransactionsTransactionRefundRequestBodySchema = + { + expand?: string[] | undefined + refund_amount?: number | undefined + } + +export type t_PostTestHelpersRefundsRefundExpireParamSchema = { + refund: string +} + +export type t_PostTestHelpersRefundsRefundExpireRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTestHelpersTerminalReadersReaderPresentPaymentMethodParamSchema = + { + reader: string + } + +export type t_PostTestHelpersTerminalReadersReaderPresentPaymentMethodRequestBodySchema = + { + amount_tip?: number | undefined + card_present?: + | { + number?: string | undefined + } + | undefined + expand?: string[] | undefined + interac_present?: + | { + number?: string | undefined + } + | undefined + type?: ("card_present" | "interac_present") | undefined + } + +export type t_PostTestHelpersTestClocksRequestBodySchema = { + expand?: string[] | undefined + frozen_time: number + name?: string | undefined +} + +export type t_PostTestHelpersTestClocksTestClockAdvanceParamSchema = { + test_clock: string +} + +export type t_PostTestHelpersTestClocksTestClockAdvanceRequestBodySchema = { + expand?: string[] | undefined + frozen_time: number +} + +export type t_PostTestHelpersTreasuryInboundTransfersIdFailParamSchema = { + id: string +} + +export type t_PostTestHelpersTreasuryInboundTransfersIdFailRequestBodySchema = { + expand?: string[] | undefined + failure_details?: + | { + code?: + | ( + | "account_closed" + | "account_frozen" + | "bank_account_restricted" + | "bank_ownership_changed" + | "debit_not_authorized" + | "incorrect_account_holder_address" + | "incorrect_account_holder_name" + | "incorrect_account_holder_tax_id" + | "insufficient_funds" + | "invalid_account_number" + | "invalid_currency" + | "no_account" + | "other" + ) + | undefined + } + | undefined +} + +export type t_PostTestHelpersTreasuryInboundTransfersIdReturnParamSchema = { + id: string +} + +export type t_PostTestHelpersTreasuryInboundTransfersIdReturnRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersTreasuryInboundTransfersIdSucceedParamSchema = { + id: string +} + +export type t_PostTestHelpersTreasuryInboundTransfersIdSucceedRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdParamSchema = { + id: string +} + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdRequestBodySchema = { + expand?: string[] | undefined + tracking_details: { + ach?: + | { + trace_id: string + } + | undefined + type: "ach" | "us_domestic_wire" + us_domestic_wire?: + | { + chips?: string | undefined + imad?: string | undefined + omad?: string | undefined + } + | undefined + } +} + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdFailParamSchema = { + id: string +} + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdFailRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdPostParamSchema = { + id: string +} + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdPostRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdReturnParamSchema = { + id: string +} + +export type t_PostTestHelpersTreasuryOutboundPaymentsIdReturnRequestBodySchema = + { + expand?: string[] | undefined + returned_details?: + | { + code?: + | ( + | "account_closed" + | "account_frozen" + | "bank_account_restricted" + | "bank_ownership_changed" + | "declined" + | "incorrect_account_holder_name" + | "invalid_account_number" + | "invalid_currency" + | "no_account" + | "other" + ) + | undefined + } + | undefined + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferParamSchema = + { + outbound_transfer: string + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferRequestBodySchema = + { + expand?: string[] | undefined + tracking_details: { + ach?: + | { + trace_id: string + } + | undefined + type: "ach" | "us_domestic_wire" + us_domestic_wire?: + | { + chips?: string | undefined + imad?: string | undefined + omad?: string | undefined + } + | undefined + } + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailParamSchema = + { + outbound_transfer: string + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferFailRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferPostParamSchema = + { + outbound_transfer: string + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferPostRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturnParamSchema = + { + outbound_transfer: string + } + +export type t_PostTestHelpersTreasuryOutboundTransfersOutboundTransferReturnRequestBodySchema = + { + expand?: string[] | undefined + returned_details?: + | { + code?: + | ( + | "account_closed" + | "account_frozen" + | "bank_account_restricted" + | "bank_ownership_changed" + | "declined" + | "incorrect_account_holder_name" + | "invalid_account_number" + | "invalid_currency" + | "no_account" + | "other" + ) + | undefined + } + | undefined + } + +export type t_PostTestHelpersTreasuryReceivedCreditsRequestBodySchema = { + amount: number + currency: string + description?: string | undefined + expand?: string[] | undefined + financial_account: string + initiating_payment_method_details?: + | { + type: "us_bank_account" + us_bank_account?: + | { + account_holder_name?: string | undefined + account_number?: string | undefined + routing_number?: string | undefined + } + | undefined + } + | undefined + network: "ach" | "us_domestic_wire" +} + +export type t_PostTestHelpersTreasuryReceivedDebitsRequestBodySchema = { + amount: number + currency: string + description?: string | undefined + expand?: string[] | undefined + financial_account: string + initiating_payment_method_details?: + | { + type: "us_bank_account" + us_bank_account?: + | { + account_holder_name?: string | undefined + account_number?: string | undefined + routing_number?: string | undefined + } + | undefined + } + | undefined + network: "ach" +} + +export type t_PostTokensRequestBodySchema = { + account?: + | { + business_type?: + | ("company" | "government_entity" | "individual" | "non_profit") + | undefined + company?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + directors_provided?: boolean | undefined + directorship_declaration?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: string | undefined + } + | undefined + executives_provided?: boolean | undefined + export_license_id?: string | undefined + export_purpose_code?: string | undefined + name?: string | undefined + name_kana?: string | undefined + name_kanji?: string | undefined + owners_provided?: boolean | undefined + ownership_declaration?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: string | undefined + } + | undefined + ownership_declaration_shown_and_signed?: boolean | undefined + ownership_exemption_reason?: + | ( + | "" + | "qualified_entity_exceeds_ownership_threshold" + | "qualifies_as_financial_institution" + ) + | undefined + phone?: string | undefined + registration_number?: string | undefined + structure?: + | ( + | "" + | "free_zone_establishment" + | "free_zone_llc" + | "government_instrumentality" + | "governmental_unit" + | "incorporated_non_profit" + | "incorporated_partnership" + | "limited_liability_partnership" + | "llc" + | "multi_member_llc" + | "private_company" + | "private_corporation" + | "private_partnership" + | "public_company" + | "public_corporation" + | "public_partnership" + | "registered_charity" + | "single_member_llc" + | "sole_establishment" + | "sole_proprietorship" + | "tax_exempt_government_instrumentality" + | "unincorporated_association" + | "unincorporated_non_profit" + | "unincorporated_partnership" + ) + | undefined + tax_id?: string | undefined + tax_id_registrar?: string | undefined + vat_id?: string | undefined + verification?: + | { + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + individual?: + | { + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + dob?: + | ( + | { + day: number + month: number + year: number + } + | "" + ) + | undefined + email?: string | undefined + first_name?: string | undefined + first_name_kana?: string | undefined + first_name_kanji?: string | undefined + full_name_aliases?: (string[] | "") | undefined + gender?: string | undefined + id_number?: string | undefined + id_number_secondary?: string | undefined + last_name?: string | undefined + last_name_kana?: string | undefined + last_name_kanji?: string | undefined + maiden_name?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + phone?: string | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + relationship?: + | { + director?: boolean | undefined + executive?: boolean | undefined + owner?: boolean | undefined + percent_ownership?: (number | "") | undefined + title?: string | undefined + } + | undefined + ssn_last_4?: string | undefined + verification?: + | { + additional_document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + tos_shown_and_accepted?: boolean | undefined + } + | undefined + bank_account?: + | { + account_holder_name?: string | undefined + account_holder_type?: ("company" | "individual") | undefined + account_number: string + account_type?: ("checking" | "futsu" | "savings" | "toza") | undefined + country: string + currency?: string | undefined + payment_method?: string | undefined + routing_number?: string | undefined + } + | undefined + card?: + | ( + | { + address_city?: string | undefined + address_country?: string | undefined + address_line1?: string | undefined + address_line2?: string | undefined + address_state?: string | undefined + address_zip?: string | undefined + currency?: string | undefined + cvc?: string | undefined + exp_month: string + exp_year: string + name?: string | undefined + networks?: + | { + preferred?: + | ("cartes_bancaires" | "mastercard" | "visa") + | undefined + } + | undefined + number: string + } + | string + ) + | undefined + customer?: string | undefined + cvc_update?: + | { + cvc: string + } + | undefined + expand?: string[] | undefined + person?: + | { + additional_tos_acceptances?: + | { + account?: + | { + date?: number | undefined + ip?: string | undefined + user_agent?: (string | "") | undefined + } + | undefined + } + | undefined + address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + address_kana?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + address_kanji?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + town?: string | undefined + } + | undefined + dob?: + | ( + | { + day: number + month: number + year: number + } + | "" + ) + | undefined + documents?: + | { + company_authorization?: + | { + files?: (string | "")[] | undefined + } + | undefined + passport?: + | { + files?: (string | "")[] | undefined + } + | undefined + visa?: + | { + files?: (string | "")[] | undefined + } + | undefined + } + | undefined + email?: string | undefined + first_name?: string | undefined + first_name_kana?: string | undefined + first_name_kanji?: string | undefined + full_name_aliases?: (string[] | "") | undefined + gender?: string | undefined + id_number?: string | undefined + id_number_secondary?: string | undefined + last_name?: string | undefined + last_name_kana?: string | undefined + last_name_kanji?: string | undefined + maiden_name?: string | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + nationality?: string | undefined + phone?: string | undefined + political_exposure?: ("existing" | "none") | undefined + registered_address?: + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | undefined + relationship?: + | { + authorizer?: boolean | undefined + director?: boolean | undefined + executive?: boolean | undefined + legal_guardian?: boolean | undefined + owner?: boolean | undefined + percent_ownership?: (number | "") | undefined + representative?: boolean | undefined + title?: string | undefined + } + | undefined + ssn_last_4?: string | undefined + verification?: + | { + additional_document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + document?: + | { + back?: string | undefined + front?: string | undefined + } + | undefined + } + | undefined + } + | undefined + pii?: + | { + id_number?: string | undefined + } + | undefined +} + +export type t_PostTopupsRequestBodySchema = { + amount: number + currency: string + description?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + source?: string | undefined + statement_descriptor?: string | undefined + transfer_group?: string | undefined +} + +export type t_PostTopupsTopupParamSchema = { + topup: string +} + +export type t_PostTopupsTopupRequestBodySchema = { + description?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostTopupsTopupCancelParamSchema = { + topup: string +} + +export type t_PostTopupsTopupCancelRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTransfersRequestBodySchema = { + amount?: number | undefined + currency: string + description?: string | undefined + destination: string + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + source_transaction?: string | undefined + source_type?: ("bank_account" | "card" | "fpx") | undefined + transfer_group?: string | undefined +} + +export type t_PostTransfersIdReversalsParamSchema = { + id: string +} + +export type t_PostTransfersIdReversalsRequestBodySchema = { + amount?: number | undefined + description?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + refund_application_fee?: boolean | undefined +} + +export type t_PostTransfersTransferParamSchema = { + transfer: string +} + +export type t_PostTransfersTransferRequestBodySchema = { + description?: string | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostTransfersTransferReversalsIdParamSchema = { + id: string + transfer: string +} + +export type t_PostTransfersTransferReversalsIdRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined +} + +export type t_PostTreasuryCreditReversalsRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + received_credit: string +} + +export type t_PostTreasuryDebitReversalsRequestBodySchema = { + expand?: string[] | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + received_debit: string +} + +export type t_PostTreasuryFinancialAccountsRequestBodySchema = { + expand?: string[] | undefined + features?: + | { + card_issuing?: + | { + requested: boolean + } + | undefined + deposit_insurance?: + | { + requested: boolean + } + | undefined + financial_addresses?: + | { + aba?: + | { + requested: boolean + } + | undefined + } + | undefined + inbound_transfers?: + | { + ach?: + | { + requested: boolean + } + | undefined + } + | undefined + intra_stripe_flows?: + | { + requested: boolean + } + | undefined + outbound_payments?: + | { + ach?: + | { + requested: boolean + } + | undefined + us_domestic_wire?: + | { + requested: boolean + } + | undefined + } + | undefined + outbound_transfers?: + | { + ach?: + | { + requested: boolean + } + | undefined + us_domestic_wire?: + | { + requested: boolean + } + | undefined + } + | undefined + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + nickname?: (string | "") | undefined + platform_restrictions?: + | { + inbound_flows?: ("restricted" | "unrestricted") | undefined + outbound_flows?: ("restricted" | "unrestricted") | undefined + } + | undefined + supported_currencies: string[] +} + +export type t_PostTreasuryFinancialAccountsFinancialAccountParamSchema = { + financial_account: string +} + +export type t_PostTreasuryFinancialAccountsFinancialAccountRequestBodySchema = { + expand?: string[] | undefined + features?: + | { + card_issuing?: + | { + requested: boolean + } + | undefined + deposit_insurance?: + | { + requested: boolean + } + | undefined + financial_addresses?: + | { + aba?: + | { + requested: boolean + } + | undefined + } + | undefined + inbound_transfers?: + | { + ach?: + | { + requested: boolean + } + | undefined + } + | undefined + intra_stripe_flows?: + | { + requested: boolean + } + | undefined + outbound_payments?: + | { + ach?: + | { + requested: boolean + } + | undefined + us_domestic_wire?: + | { + requested: boolean + } + | undefined + } + | undefined + outbound_transfers?: + | { + ach?: + | { + requested: boolean + } + | undefined + us_domestic_wire?: + | { + requested: boolean + } + | undefined + } + | undefined + } + | undefined + forwarding_settings?: + | { + financial_account?: string | undefined + payment_method?: string | undefined + type: "financial_account" | "payment_method" + } + | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + nickname?: (string | "") | undefined + platform_restrictions?: + | { + inbound_flows?: ("restricted" | "unrestricted") | undefined + outbound_flows?: ("restricted" | "unrestricted") | undefined + } + | undefined +} + +export type t_PostTreasuryFinancialAccountsFinancialAccountCloseParamSchema = { + financial_account: string +} + +export type t_PostTreasuryFinancialAccountsFinancialAccountCloseRequestBodySchema = + { + expand?: string[] | undefined + forwarding_settings?: + | { + financial_account?: string | undefined + payment_method?: string | undefined + type: "financial_account" | "payment_method" + } + | undefined + } + +export type t_PostTreasuryFinancialAccountsFinancialAccountFeaturesParamSchema = + { + financial_account: string + } + +export type t_PostTreasuryFinancialAccountsFinancialAccountFeaturesRequestBodySchema = + { + card_issuing?: + | { + requested: boolean + } + | undefined + deposit_insurance?: + | { + requested: boolean + } + | undefined + expand?: string[] | undefined + financial_addresses?: + | { + aba?: + | { + requested: boolean + } + | undefined + } + | undefined + inbound_transfers?: + | { + ach?: + | { + requested: boolean + } + | undefined + } + | undefined + intra_stripe_flows?: + | { + requested: boolean + } + | undefined + outbound_payments?: + | { + ach?: + | { + requested: boolean + } + | undefined + us_domestic_wire?: + | { + requested: boolean + } + | undefined + } + | undefined + outbound_transfers?: + | { + ach?: + | { + requested: boolean + } + | undefined + us_domestic_wire?: + | { + requested: boolean + } + | undefined + } + | undefined + } + +export type t_PostTreasuryInboundTransfersRequestBodySchema = { + amount: number + currency: string + description?: string | undefined + expand?: string[] | undefined + financial_account: string + metadata?: + | { + [key: string]: string | undefined + } + | undefined + origin_payment_method: string + statement_descriptor?: string | undefined +} + +export type t_PostTreasuryInboundTransfersInboundTransferCancelParamSchema = { + inbound_transfer: string +} + +export type t_PostTreasuryInboundTransfersInboundTransferCancelRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostTreasuryOutboundPaymentsRequestBodySchema = { + amount: number + currency: string + customer?: string | undefined + description?: string | undefined + destination_payment_method?: string | undefined + destination_payment_method_data?: + | { + billing_details?: + | { + address?: + | ( + | { + city?: string | undefined + country?: string | undefined + line1?: string | undefined + line2?: string | undefined + postal_code?: string | undefined + state?: string | undefined + } + | "" + ) + | undefined + email?: (string | "") | undefined + name?: (string | "") | undefined + phone?: (string | "") | undefined + } + | undefined + financial_account?: string | undefined + metadata?: + | { + [key: string]: string | undefined + } + | undefined + type: "financial_account" | "us_bank_account" + us_bank_account?: + | { + account_holder_type?: ("company" | "individual") | undefined + account_number?: string | undefined + account_type?: ("checking" | "savings") | undefined + financial_connections_account?: string | undefined + routing_number?: string | undefined + } + | undefined + } + | undefined + destination_payment_method_options?: + | { + us_bank_account?: + | ( + | { + network?: ("ach" | "us_domestic_wire") | undefined + } + | "" + ) + | undefined + } + | undefined + end_user_details?: + | { + ip_address?: string | undefined + present: boolean + } + | undefined + expand?: string[] | undefined + financial_account: string + metadata?: + | { + [key: string]: string | undefined + } + | undefined + statement_descriptor?: string | undefined +} + +export type t_PostTreasuryOutboundPaymentsIdCancelParamSchema = { + id: string +} + +export type t_PostTreasuryOutboundPaymentsIdCancelRequestBodySchema = { + expand?: string[] | undefined +} + +export type t_PostTreasuryOutboundTransfersRequestBodySchema = { + amount: number + currency: string + description?: string | undefined + destination_payment_method?: string | undefined + destination_payment_method_data?: + | { + financial_account?: string | undefined + type: "financial_account" + } + | undefined + destination_payment_method_options?: + | { + us_bank_account?: + | ( + | { + network?: ("ach" | "us_domestic_wire") | undefined + } + | "" + ) + | undefined + } + | undefined + expand?: string[] | undefined + financial_account: string + metadata?: + | { + [key: string]: string | undefined + } + | undefined + statement_descriptor?: string | undefined +} + +export type t_PostTreasuryOutboundTransfersOutboundTransferCancelParamSchema = { + outbound_transfer: string +} + +export type t_PostTreasuryOutboundTransfersOutboundTransferCancelRequestBodySchema = + { + expand?: string[] | undefined + } + +export type t_PostWebhookEndpointsRequestBodySchema = { + api_version?: + | ( + | "2011-01-01" + | "2011-06-21" + | "2011-06-28" + | "2011-08-01" + | "2011-09-15" + | "2011-11-17" + | "2012-02-23" + | "2012-03-25" + | "2012-06-18" + | "2012-06-28" + | "2012-07-09" + | "2012-09-24" + | "2012-10-26" + | "2012-11-07" + | "2013-02-11" + | "2013-02-13" + | "2013-07-05" + | "2013-08-12" + | "2013-08-13" + | "2013-10-29" + | "2013-12-03" + | "2014-01-31" + | "2014-03-13" + | "2014-03-28" + | "2014-05-19" + | "2014-06-13" + | "2014-06-17" + | "2014-07-22" + | "2014-07-26" + | "2014-08-04" + | "2014-08-20" + | "2014-09-08" + | "2014-10-07" + | "2014-11-05" + | "2014-11-20" + | "2014-12-08" + | "2014-12-17" + | "2014-12-22" + | "2015-01-11" + | "2015-01-26" + | "2015-02-10" + | "2015-02-16" + | "2015-02-18" + | "2015-03-24" + | "2015-04-07" + | "2015-06-15" + | "2015-07-07" + | "2015-07-13" + | "2015-07-28" + | "2015-08-07" + | "2015-08-19" + | "2015-09-03" + | "2015-09-08" + | "2015-09-23" + | "2015-10-01" + | "2015-10-12" + | "2015-10-16" + | "2016-02-03" + | "2016-02-19" + | "2016-02-22" + | "2016-02-23" + | "2016-02-29" + | "2016-03-07" + | "2016-06-15" + | "2016-07-06" + | "2016-10-19" + | "2017-01-27" + | "2017-02-14" + | "2017-04-06" + | "2017-05-25" + | "2017-06-05" + | "2017-08-15" + | "2017-12-14" + | "2018-01-23" + | "2018-02-05" + | "2018-02-06" + | "2018-02-28" + | "2018-05-21" + | "2018-07-27" + | "2018-08-23" + | "2018-09-06" + | "2018-09-24" + | "2018-10-31" + | "2018-11-08" + | "2019-02-11" + | "2019-02-19" + | "2019-03-14" + | "2019-05-16" + | "2019-08-14" + | "2019-09-09" + | "2019-10-08" + | "2019-10-17" + | "2019-11-05" + | "2019-12-03" + | "2020-03-02" + | "2020-08-27" + | "2022-08-01" + | "2022-11-15" + | "2023-08-16" + | "2023-10-16" + | "2024-04-10" + | "2024-06-20" + | "2024-09-30.acacia" + | "2024-10-28.acacia" + | "2024-11-20.acacia" + | "2024-12-18.acacia" + | "2025-01-27.acacia" + | "2025-02-24.acacia" + | "2025-03-01.dashboard" + | "2025-03-31.basil" + ) + | undefined + connect?: boolean | undefined + description?: (string | "") | undefined + enabled_events: ( + | "*" + | "account.application.authorized" + | "account.application.deauthorized" + | "account.external_account.created" + | "account.external_account.deleted" + | "account.external_account.updated" + | "account.updated" + | "application_fee.created" + | "application_fee.refund.updated" + | "application_fee.refunded" + | "balance.available" + | "billing.alert.triggered" + | "billing_portal.configuration.created" + | "billing_portal.configuration.updated" + | "billing_portal.session.created" + | "capability.updated" + | "cash_balance.funds_available" + | "charge.captured" + | "charge.dispute.closed" + | "charge.dispute.created" + | "charge.dispute.funds_reinstated" + | "charge.dispute.funds_withdrawn" + | "charge.dispute.updated" + | "charge.expired" + | "charge.failed" + | "charge.pending" + | "charge.refund.updated" + | "charge.refunded" + | "charge.succeeded" + | "charge.updated" + | "checkout.session.async_payment_failed" + | "checkout.session.async_payment_succeeded" + | "checkout.session.completed" + | "checkout.session.expired" + | "climate.order.canceled" + | "climate.order.created" + | "climate.order.delayed" + | "climate.order.delivered" + | "climate.order.product_substituted" + | "climate.product.created" + | "climate.product.pricing_updated" + | "coupon.created" + | "coupon.deleted" + | "coupon.updated" + | "credit_note.created" + | "credit_note.updated" + | "credit_note.voided" + | "customer.created" + | "customer.deleted" + | "customer.discount.created" + | "customer.discount.deleted" + | "customer.discount.updated" + | "customer.source.created" + | "customer.source.deleted" + | "customer.source.expiring" + | "customer.source.updated" + | "customer.subscription.created" + | "customer.subscription.deleted" + | "customer.subscription.paused" + | "customer.subscription.pending_update_applied" + | "customer.subscription.pending_update_expired" + | "customer.subscription.resumed" + | "customer.subscription.trial_will_end" + | "customer.subscription.updated" + | "customer.tax_id.created" + | "customer.tax_id.deleted" + | "customer.tax_id.updated" + | "customer.updated" + | "customer_cash_balance_transaction.created" + | "entitlements.active_entitlement_summary.updated" + | "file.created" + | "financial_connections.account.created" + | "financial_connections.account.deactivated" + | "financial_connections.account.disconnected" + | "financial_connections.account.reactivated" + | "financial_connections.account.refreshed_balance" + | "financial_connections.account.refreshed_ownership" + | "financial_connections.account.refreshed_transactions" + | "identity.verification_session.canceled" + | "identity.verification_session.created" + | "identity.verification_session.processing" + | "identity.verification_session.redacted" + | "identity.verification_session.requires_input" + | "identity.verification_session.verified" + | "invoice.created" + | "invoice.deleted" + | "invoice.finalization_failed" + | "invoice.finalized" + | "invoice.marked_uncollectible" + | "invoice.overdue" + | "invoice.overpaid" + | "invoice.paid" + | "invoice.payment_action_required" + | "invoice.payment_failed" + | "invoice.payment_succeeded" + | "invoice.sent" + | "invoice.upcoming" + | "invoice.updated" + | "invoice.voided" + | "invoice.will_be_due" + | "invoiceitem.created" + | "invoiceitem.deleted" + | "issuing_authorization.created" + | "issuing_authorization.request" + | "issuing_authorization.updated" + | "issuing_card.created" + | "issuing_card.updated" + | "issuing_cardholder.created" + | "issuing_cardholder.updated" + | "issuing_dispute.closed" + | "issuing_dispute.created" + | "issuing_dispute.funds_reinstated" + | "issuing_dispute.funds_rescinded" + | "issuing_dispute.submitted" + | "issuing_dispute.updated" + | "issuing_personalization_design.activated" + | "issuing_personalization_design.deactivated" + | "issuing_personalization_design.rejected" + | "issuing_personalization_design.updated" + | "issuing_token.created" + | "issuing_token.updated" + | "issuing_transaction.created" + | "issuing_transaction.purchase_details_receipt_updated" + | "issuing_transaction.updated" + | "mandate.updated" + | "payment_intent.amount_capturable_updated" + | "payment_intent.canceled" + | "payment_intent.created" + | "payment_intent.partially_funded" + | "payment_intent.payment_failed" + | "payment_intent.processing" + | "payment_intent.requires_action" + | "payment_intent.succeeded" + | "payment_link.created" + | "payment_link.updated" + | "payment_method.attached" + | "payment_method.automatically_updated" + | "payment_method.detached" + | "payment_method.updated" + | "payout.canceled" + | "payout.created" + | "payout.failed" + | "payout.paid" + | "payout.reconciliation_completed" + | "payout.updated" + | "person.created" + | "person.deleted" + | "person.updated" + | "plan.created" + | "plan.deleted" + | "plan.updated" + | "price.created" + | "price.deleted" + | "price.updated" + | "product.created" + | "product.deleted" + | "product.updated" + | "promotion_code.created" + | "promotion_code.updated" + | "quote.accepted" + | "quote.canceled" + | "quote.created" + | "quote.finalized" + | "radar.early_fraud_warning.created" + | "radar.early_fraud_warning.updated" + | "refund.created" + | "refund.failed" + | "refund.updated" + | "reporting.report_run.failed" + | "reporting.report_run.succeeded" + | "reporting.report_type.updated" + | "review.closed" + | "review.opened" + | "setup_intent.canceled" + | "setup_intent.created" + | "setup_intent.requires_action" + | "setup_intent.setup_failed" + | "setup_intent.succeeded" + | "sigma.scheduled_query_run.created" + | "source.canceled" + | "source.chargeable" + | "source.failed" + | "source.mandate_notification" + | "source.refund_attributes_required" + | "source.transaction.created" + | "source.transaction.updated" + | "subscription_schedule.aborted" + | "subscription_schedule.canceled" + | "subscription_schedule.completed" + | "subscription_schedule.created" + | "subscription_schedule.expiring" + | "subscription_schedule.released" + | "subscription_schedule.updated" + | "tax.settings.updated" + | "tax_rate.created" + | "tax_rate.updated" + | "terminal.reader.action_failed" + | "terminal.reader.action_succeeded" + | "test_helpers.test_clock.advancing" + | "test_helpers.test_clock.created" + | "test_helpers.test_clock.deleted" + | "test_helpers.test_clock.internal_failure" + | "test_helpers.test_clock.ready" + | "topup.canceled" + | "topup.created" + | "topup.failed" + | "topup.reversed" + | "topup.succeeded" + | "transfer.created" + | "transfer.reversed" + | "transfer.updated" + | "treasury.credit_reversal.created" + | "treasury.credit_reversal.posted" + | "treasury.debit_reversal.completed" + | "treasury.debit_reversal.created" + | "treasury.debit_reversal.initial_credit_granted" + | "treasury.financial_account.closed" + | "treasury.financial_account.created" + | "treasury.financial_account.features_status_updated" + | "treasury.inbound_transfer.canceled" + | "treasury.inbound_transfer.created" + | "treasury.inbound_transfer.failed" + | "treasury.inbound_transfer.succeeded" + | "treasury.outbound_payment.canceled" + | "treasury.outbound_payment.created" + | "treasury.outbound_payment.expected_arrival_date_updated" + | "treasury.outbound_payment.failed" + | "treasury.outbound_payment.posted" + | "treasury.outbound_payment.returned" + | "treasury.outbound_payment.tracking_details_updated" + | "treasury.outbound_transfer.canceled" + | "treasury.outbound_transfer.created" + | "treasury.outbound_transfer.expected_arrival_date_updated" + | "treasury.outbound_transfer.failed" + | "treasury.outbound_transfer.posted" + | "treasury.outbound_transfer.returned" + | "treasury.outbound_transfer.tracking_details_updated" + | "treasury.received_credit.created" + | "treasury.received_credit.failed" + | "treasury.received_credit.succeeded" + | "treasury.received_debit.created" + )[] + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + url: string +} + +export type t_PostWebhookEndpointsWebhookEndpointParamSchema = { + webhook_endpoint: string +} + +export type t_PostWebhookEndpointsWebhookEndpointRequestBodySchema = { + description?: (string | "") | undefined + disabled?: boolean | undefined + enabled_events?: + | ( + | "*" + | "account.application.authorized" + | "account.application.deauthorized" + | "account.external_account.created" + | "account.external_account.deleted" + | "account.external_account.updated" + | "account.updated" + | "application_fee.created" + | "application_fee.refund.updated" + | "application_fee.refunded" + | "balance.available" + | "billing.alert.triggered" + | "billing_portal.configuration.created" + | "billing_portal.configuration.updated" + | "billing_portal.session.created" + | "capability.updated" + | "cash_balance.funds_available" + | "charge.captured" + | "charge.dispute.closed" + | "charge.dispute.created" + | "charge.dispute.funds_reinstated" + | "charge.dispute.funds_withdrawn" + | "charge.dispute.updated" + | "charge.expired" + | "charge.failed" + | "charge.pending" + | "charge.refund.updated" + | "charge.refunded" + | "charge.succeeded" + | "charge.updated" + | "checkout.session.async_payment_failed" + | "checkout.session.async_payment_succeeded" + | "checkout.session.completed" + | "checkout.session.expired" + | "climate.order.canceled" + | "climate.order.created" + | "climate.order.delayed" + | "climate.order.delivered" + | "climate.order.product_substituted" + | "climate.product.created" + | "climate.product.pricing_updated" + | "coupon.created" + | "coupon.deleted" + | "coupon.updated" + | "credit_note.created" + | "credit_note.updated" + | "credit_note.voided" + | "customer.created" + | "customer.deleted" + | "customer.discount.created" + | "customer.discount.deleted" + | "customer.discount.updated" + | "customer.source.created" + | "customer.source.deleted" + | "customer.source.expiring" + | "customer.source.updated" + | "customer.subscription.created" + | "customer.subscription.deleted" + | "customer.subscription.paused" + | "customer.subscription.pending_update_applied" + | "customer.subscription.pending_update_expired" + | "customer.subscription.resumed" + | "customer.subscription.trial_will_end" + | "customer.subscription.updated" + | "customer.tax_id.created" + | "customer.tax_id.deleted" + | "customer.tax_id.updated" + | "customer.updated" + | "customer_cash_balance_transaction.created" + | "entitlements.active_entitlement_summary.updated" + | "file.created" + | "financial_connections.account.created" + | "financial_connections.account.deactivated" + | "financial_connections.account.disconnected" + | "financial_connections.account.reactivated" + | "financial_connections.account.refreshed_balance" + | "financial_connections.account.refreshed_ownership" + | "financial_connections.account.refreshed_transactions" + | "identity.verification_session.canceled" + | "identity.verification_session.created" + | "identity.verification_session.processing" + | "identity.verification_session.redacted" + | "identity.verification_session.requires_input" + | "identity.verification_session.verified" + | "invoice.created" + | "invoice.deleted" + | "invoice.finalization_failed" + | "invoice.finalized" + | "invoice.marked_uncollectible" + | "invoice.overdue" + | "invoice.overpaid" + | "invoice.paid" + | "invoice.payment_action_required" + | "invoice.payment_failed" + | "invoice.payment_succeeded" + | "invoice.sent" + | "invoice.upcoming" + | "invoice.updated" + | "invoice.voided" + | "invoice.will_be_due" + | "invoiceitem.created" + | "invoiceitem.deleted" + | "issuing_authorization.created" + | "issuing_authorization.request" + | "issuing_authorization.updated" + | "issuing_card.created" + | "issuing_card.updated" + | "issuing_cardholder.created" + | "issuing_cardholder.updated" + | "issuing_dispute.closed" + | "issuing_dispute.created" + | "issuing_dispute.funds_reinstated" + | "issuing_dispute.funds_rescinded" + | "issuing_dispute.submitted" + | "issuing_dispute.updated" + | "issuing_personalization_design.activated" + | "issuing_personalization_design.deactivated" + | "issuing_personalization_design.rejected" + | "issuing_personalization_design.updated" + | "issuing_token.created" + | "issuing_token.updated" + | "issuing_transaction.created" + | "issuing_transaction.purchase_details_receipt_updated" + | "issuing_transaction.updated" + | "mandate.updated" + | "payment_intent.amount_capturable_updated" + | "payment_intent.canceled" + | "payment_intent.created" + | "payment_intent.partially_funded" + | "payment_intent.payment_failed" + | "payment_intent.processing" + | "payment_intent.requires_action" + | "payment_intent.succeeded" + | "payment_link.created" + | "payment_link.updated" + | "payment_method.attached" + | "payment_method.automatically_updated" + | "payment_method.detached" + | "payment_method.updated" + | "payout.canceled" + | "payout.created" + | "payout.failed" + | "payout.paid" + | "payout.reconciliation_completed" + | "payout.updated" + | "person.created" + | "person.deleted" + | "person.updated" + | "plan.created" + | "plan.deleted" + | "plan.updated" + | "price.created" + | "price.deleted" + | "price.updated" + | "product.created" + | "product.deleted" + | "product.updated" + | "promotion_code.created" + | "promotion_code.updated" + | "quote.accepted" + | "quote.canceled" + | "quote.created" + | "quote.finalized" + | "radar.early_fraud_warning.created" + | "radar.early_fraud_warning.updated" + | "refund.created" + | "refund.failed" + | "refund.updated" + | "reporting.report_run.failed" + | "reporting.report_run.succeeded" + | "reporting.report_type.updated" + | "review.closed" + | "review.opened" + | "setup_intent.canceled" + | "setup_intent.created" + | "setup_intent.requires_action" + | "setup_intent.setup_failed" + | "setup_intent.succeeded" + | "sigma.scheduled_query_run.created" + | "source.canceled" + | "source.chargeable" + | "source.failed" + | "source.mandate_notification" + | "source.refund_attributes_required" + | "source.transaction.created" + | "source.transaction.updated" + | "subscription_schedule.aborted" + | "subscription_schedule.canceled" + | "subscription_schedule.completed" + | "subscription_schedule.created" + | "subscription_schedule.expiring" + | "subscription_schedule.released" + | "subscription_schedule.updated" + | "tax.settings.updated" + | "tax_rate.created" + | "tax_rate.updated" + | "terminal.reader.action_failed" + | "terminal.reader.action_succeeded" + | "test_helpers.test_clock.advancing" + | "test_helpers.test_clock.created" + | "test_helpers.test_clock.deleted" + | "test_helpers.test_clock.internal_failure" + | "test_helpers.test_clock.ready" + | "topup.canceled" + | "topup.created" + | "topup.failed" + | "topup.reversed" + | "topup.succeeded" + | "transfer.created" + | "transfer.reversed" + | "transfer.updated" + | "treasury.credit_reversal.created" + | "treasury.credit_reversal.posted" + | "treasury.debit_reversal.completed" + | "treasury.debit_reversal.created" + | "treasury.debit_reversal.initial_credit_granted" + | "treasury.financial_account.closed" + | "treasury.financial_account.created" + | "treasury.financial_account.features_status_updated" + | "treasury.inbound_transfer.canceled" + | "treasury.inbound_transfer.created" + | "treasury.inbound_transfer.failed" + | "treasury.inbound_transfer.succeeded" + | "treasury.outbound_payment.canceled" + | "treasury.outbound_payment.created" + | "treasury.outbound_payment.expected_arrival_date_updated" + | "treasury.outbound_payment.failed" + | "treasury.outbound_payment.posted" + | "treasury.outbound_payment.returned" + | "treasury.outbound_payment.tracking_details_updated" + | "treasury.outbound_transfer.canceled" + | "treasury.outbound_transfer.created" + | "treasury.outbound_transfer.expected_arrival_date_updated" + | "treasury.outbound_transfer.failed" + | "treasury.outbound_transfer.posted" + | "treasury.outbound_transfer.returned" + | "treasury.outbound_transfer.tracking_details_updated" + | "treasury.received_credit.created" + | "treasury.received_credit.failed" + | "treasury.received_credit.succeeded" + | "treasury.received_debit.created" + )[] + | undefined + expand?: string[] | undefined + metadata?: + | ( + | { + [key: string]: string | undefined + } + | "" + ) + | undefined + url?: string | undefined +} diff --git a/integration-tests/typescript-express/src/generated/stripe.yaml/schemas.ts b/integration-tests/typescript-express/src/generated/stripe.yaml/schemas.ts new file mode 100644 index 000000000..da4aee0de --- /dev/null +++ b/integration-tests/typescript-express/src/generated/stripe.yaml/schemas.ts @@ -0,0 +1,16738 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_account, + t_account_branding_settings, + t_account_invoices_settings, + t_account_settings, + t_api_errors, + t_application_fee, + t_automatic_tax, + t_balance_transaction, + t_bank_account, + t_bank_connections_resource_accountholder, + t_billing_alert, + t_billing_bill_resource_invoicing_parents_invoice_parent, + t_billing_bill_resource_invoicing_parents_invoice_subscription_parent, + t_billing_credit_balance_summary, + t_billing_credit_balance_transaction, + t_billing_credit_grant, + t_billing_credit_grants_resource_balance_credit, + t_billing_credit_grants_resource_balance_credits_application_invoice_voided, + t_billing_credit_grants_resource_balance_credits_applied, + t_billing_credit_grants_resource_balance_debit, + t_capability, + t_card, + t_charge, + t_charge_transfer_data, + t_checkout_session, + t_confirmation_token, + t_confirmation_tokens_resource_payment_method_preview, + t_connect_account_reference, + t_connect_collection_transfer, + t_credit_note, + t_credit_note_line_item, + t_credit_note_refund, + t_credit_notes_pretax_credit_amount, + t_customer, + t_customer_balance_resource_cash_balance_transaction_resource_adjusted_for_overdraft, + t_customer_balance_resource_cash_balance_transaction_resource_applied_to_payment_transaction, + t_customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction, + t_customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance, + t_customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction, + t_customer_balance_transaction, + t_customer_cash_balance_transaction, + t_customer_session, + t_deleted_discount, + t_discount, + t_discounts_resource_discount_amount, + t_discounts_resource_stackable_discount, + t_dispute, + t_dispute_evidence, + t_error, + t_external_account, + t_fee_refund, + t_file, + t_file_link, + t_financial_connections_account, + t_financial_connections_session, + t_inbound_transfers, + t_inbound_transfers_payment_method_details_us_bank_account, + t_invoice, + t_invoice_payment, + t_invoice_setting_customer_setting, + t_invoice_setting_quote_setting, + t_invoice_setting_subscription_schedule_phase_setting, + t_invoice_setting_subscription_schedule_setting, + t_invoiceitem, + t_invoices_payments_invoice_payment_associated_payment, + t_invoices_resource_from_invoice, + t_invoices_resource_pretax_credit_amount, + t_issuing_authorization, + t_issuing_card, + t_issuing_cardholder, + t_issuing_cardholder_id_document, + t_issuing_cardholder_individual, + t_issuing_cardholder_verification, + t_issuing_dispute, + t_issuing_dispute_canceled_evidence, + t_issuing_dispute_duplicate_evidence, + t_issuing_dispute_evidence, + t_issuing_dispute_fraudulent_evidence, + t_issuing_dispute_merchandise_not_as_described_evidence, + t_issuing_dispute_no_valid_authorization_evidence, + t_issuing_dispute_not_received_evidence, + t_issuing_dispute_other_evidence, + t_issuing_dispute_service_not_as_described_evidence, + t_issuing_personalization_design, + t_issuing_token, + t_issuing_transaction, + t_item, + t_legal_entity_company, + t_legal_entity_company_verification, + t_legal_entity_company_verification_document, + t_legal_entity_person_verification, + t_legal_entity_person_verification_document, + t_line_item, + t_line_items_discount_amount, + t_mandate, + t_outbound_payments_payment_method_details, + t_outbound_payments_payment_method_details_us_bank_account, + t_outbound_transfers_payment_method_details, + t_outbound_transfers_payment_method_details_us_bank_account, + t_payment_intent, + t_payment_link, + t_payment_links_resource_automatic_tax, + t_payment_links_resource_invoice_creation, + t_payment_links_resource_invoice_settings, + t_payment_links_resource_subscription_data, + t_payment_links_resource_subscription_data_invoice_settings, + t_payment_links_resource_transfer_data, + t_payment_method, + t_payment_method_card, + t_payment_method_card_generated_card, + t_payment_method_details, + t_payment_method_details_bancontact, + t_payment_method_details_ideal, + t_payment_method_details_sofort, + t_payment_method_details_us_bank_account, + t_payment_method_sepa_debit, + t_payment_pages_checkout_session_automatic_tax, + t_payment_pages_checkout_session_discount, + t_payment_pages_checkout_session_invoice_creation, + t_payment_pages_checkout_session_invoice_settings, + t_payment_pages_checkout_session_total_details, + t_payment_pages_checkout_session_total_details_resource_breakdown, + t_payment_source, + t_payout, + t_person, + t_plan, + t_price, + t_product, + t_promotion_code, + t_quote, + t_quotes_resource_automatic_tax, + t_quotes_resource_computed, + t_quotes_resource_from_quote, + t_quotes_resource_recurring, + t_quotes_resource_total_details, + t_quotes_resource_total_details_resource_breakdown, + t_quotes_resource_transfer_data, + t_quotes_resource_upfront, + t_radar_early_fraud_warning, + t_refund, + t_reporting_report_run, + t_review, + t_scheduled_query_run, + t_schedules_phase_automatic_tax, + t_sepa_debit_generated_from, + t_setup_attempt, + t_setup_attempt_payment_method_details, + t_setup_attempt_payment_method_details_bancontact, + t_setup_attempt_payment_method_details_card_present, + t_setup_attempt_payment_method_details_ideal, + t_setup_attempt_payment_method_details_sofort, + t_setup_intent, + t_subscription, + t_subscription_automatic_tax, + t_subscription_item, + t_subscription_schedule, + t_subscription_schedule_add_invoice_item, + t_subscription_schedule_configuration_item, + t_subscription_schedule_phase_configuration, + t_subscription_schedules_resource_default_settings, + t_subscription_schedules_resource_default_settings_automatic_tax, + t_subscription_transfer_data, + t_subscriptions_resource_pending_update, + t_subscriptions_resource_subscription_invoice_settings, + t_tax_i_ds_owner, + t_tax_id, + t_terminal_configuration, + t_terminal_configuration_configuration_resource_device_type_specific_config, + t_terminal_reader, + t_terminal_reader_reader_resource_process_payment_intent_action, + t_terminal_reader_reader_resource_process_setup_intent_action, + t_terminal_reader_reader_resource_reader_action, + t_terminal_reader_reader_resource_refund_payment_action, + t_thresholds_resource_usage_alert_filter, + t_thresholds_resource_usage_threshold_config, + t_token, + t_topup, + t_transfer, + t_transfer_data, + t_transfer_reversal, + t_treasury_credit_reversal, + t_treasury_debit_reversal, + t_treasury_inbound_transfer, + t_treasury_outbound_payment, + t_treasury_outbound_payments_resource_returned_status, + t_treasury_outbound_transfer, + t_treasury_outbound_transfers_resource_returned_details, + t_treasury_received_credit, + t_treasury_received_credits_resource_linked_flows, + t_treasury_received_credits_resource_source_flows_details, + t_treasury_received_debit, + t_treasury_transaction, + t_treasury_transaction_entry, + t_treasury_transactions_resource_flow_details, +} from "./models" +import { z } from "zod" + +export const PermissiveBoolean = z.preprocess((value) => { + if (typeof value === "string" && (value === "true" || value === "false")) { + return value === "true" + } else if (typeof value === "number" && (value === 1 || value === 0)) { + return value === 1 + } + return value +}, z.boolean()) + +export const s_account_annual_revenue = z.object({ + amount: z.coerce.number().nullable().optional(), + currency: z.string().nullable().optional(), + fiscal_year_end: z.string().max(5000).nullable().optional(), +}) + +export const s_account_bacs_debit_payments_settings = z.object({ + display_name: z.string().max(5000).nullable().optional(), + service_user_number: z.string().max(5000).nullable().optional(), +}) + +export const s_account_capabilities = z.object({ + acss_debit_payments: z.enum(["active", "inactive", "pending"]).optional(), + affirm_payments: z.enum(["active", "inactive", "pending"]).optional(), + afterpay_clearpay_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + alma_payments: z.enum(["active", "inactive", "pending"]).optional(), + amazon_pay_payments: z.enum(["active", "inactive", "pending"]).optional(), + au_becs_debit_payments: z.enum(["active", "inactive", "pending"]).optional(), + bacs_debit_payments: z.enum(["active", "inactive", "pending"]).optional(), + bancontact_payments: z.enum(["active", "inactive", "pending"]).optional(), + bank_transfer_payments: z.enum(["active", "inactive", "pending"]).optional(), + billie_payments: z.enum(["active", "inactive", "pending"]).optional(), + blik_payments: z.enum(["active", "inactive", "pending"]).optional(), + boleto_payments: z.enum(["active", "inactive", "pending"]).optional(), + card_issuing: z.enum(["active", "inactive", "pending"]).optional(), + card_payments: z.enum(["active", "inactive", "pending"]).optional(), + cartes_bancaires_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + cashapp_payments: z.enum(["active", "inactive", "pending"]).optional(), + eps_payments: z.enum(["active", "inactive", "pending"]).optional(), + fpx_payments: z.enum(["active", "inactive", "pending"]).optional(), + gb_bank_transfer_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + giropay_payments: z.enum(["active", "inactive", "pending"]).optional(), + grabpay_payments: z.enum(["active", "inactive", "pending"]).optional(), + ideal_payments: z.enum(["active", "inactive", "pending"]).optional(), + india_international_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + jcb_payments: z.enum(["active", "inactive", "pending"]).optional(), + jp_bank_transfer_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + kakao_pay_payments: z.enum(["active", "inactive", "pending"]).optional(), + klarna_payments: z.enum(["active", "inactive", "pending"]).optional(), + konbini_payments: z.enum(["active", "inactive", "pending"]).optional(), + kr_card_payments: z.enum(["active", "inactive", "pending"]).optional(), + legacy_payments: z.enum(["active", "inactive", "pending"]).optional(), + link_payments: z.enum(["active", "inactive", "pending"]).optional(), + mobilepay_payments: z.enum(["active", "inactive", "pending"]).optional(), + multibanco_payments: z.enum(["active", "inactive", "pending"]).optional(), + mx_bank_transfer_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + naver_pay_payments: z.enum(["active", "inactive", "pending"]).optional(), + nz_bank_account_becs_debit_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + oxxo_payments: z.enum(["active", "inactive", "pending"]).optional(), + p24_payments: z.enum(["active", "inactive", "pending"]).optional(), + pay_by_bank_payments: z.enum(["active", "inactive", "pending"]).optional(), + payco_payments: z.enum(["active", "inactive", "pending"]).optional(), + paynow_payments: z.enum(["active", "inactive", "pending"]).optional(), + promptpay_payments: z.enum(["active", "inactive", "pending"]).optional(), + revolut_pay_payments: z.enum(["active", "inactive", "pending"]).optional(), + samsung_pay_payments: z.enum(["active", "inactive", "pending"]).optional(), + satispay_payments: z.enum(["active", "inactive", "pending"]).optional(), + sepa_bank_transfer_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + sepa_debit_payments: z.enum(["active", "inactive", "pending"]).optional(), + sofort_payments: z.enum(["active", "inactive", "pending"]).optional(), + swish_payments: z.enum(["active", "inactive", "pending"]).optional(), + tax_reporting_us_1099_k: z.enum(["active", "inactive", "pending"]).optional(), + tax_reporting_us_1099_misc: z + .enum(["active", "inactive", "pending"]) + .optional(), + transfers: z.enum(["active", "inactive", "pending"]).optional(), + treasury: z.enum(["active", "inactive", "pending"]).optional(), + twint_payments: z.enum(["active", "inactive", "pending"]).optional(), + us_bank_account_ach_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + us_bank_transfer_payments: z + .enum(["active", "inactive", "pending"]) + .optional(), + zip_payments: z.enum(["active", "inactive", "pending"]).optional(), +}) + +export const s_account_dashboard_settings = z.object({ + display_name: z.string().max(5000).nullable().optional(), + timezone: z.string().max(5000).nullable().optional(), +}) + +export const s_account_decline_charge_on = z.object({ + avs_failure: PermissiveBoolean, + cvc_failure: PermissiveBoolean, +}) + +export const s_account_group_membership = z.object({ + payments_pricing: z.string().max(5000).nullable().optional(), +}) + +export const s_account_link = z.object({ + created: z.coerce.number(), + expires_at: z.coerce.number(), + object: z.enum(["account_link"]), + url: z.string().max(5000), +}) + +export const s_account_monthly_estimated_revenue = z.object({ + amount: z.coerce.number(), + currency: z.string(), +}) + +export const s_account_payments_settings = z.object({ + statement_descriptor: z.string().max(5000).nullable().optional(), + statement_descriptor_kana: z.string().max(5000).nullable().optional(), + statement_descriptor_kanji: z.string().max(5000).nullable().optional(), +}) + +export const s_account_requirements_alternative = z.object({ + alternative_fields_due: z.array(z.string().max(5000)), + original_fields_due: z.array(z.string().max(5000)), +}) + +export const s_account_requirements_error = z.object({ + code: z.enum([ + "information_missing", + "invalid_address_city_state_postal_code", + "invalid_address_highway_contract_box", + "invalid_address_private_mailbox", + "invalid_business_profile_name", + "invalid_business_profile_name_denylisted", + "invalid_company_name_denylisted", + "invalid_dob_age_over_maximum", + "invalid_dob_age_under_18", + "invalid_dob_age_under_minimum", + "invalid_product_description_length", + "invalid_product_description_url_match", + "invalid_representative_country", + "invalid_signator", + "invalid_statement_descriptor_business_mismatch", + "invalid_statement_descriptor_denylisted", + "invalid_statement_descriptor_length", + "invalid_statement_descriptor_prefix_denylisted", + "invalid_statement_descriptor_prefix_mismatch", + "invalid_street_address", + "invalid_tax_id", + "invalid_tax_id_format", + "invalid_tos_acceptance", + "invalid_url_denylisted", + "invalid_url_format", + "invalid_url_web_presence_detected", + "invalid_url_website_business_information_mismatch", + "invalid_url_website_empty", + "invalid_url_website_inaccessible", + "invalid_url_website_inaccessible_geoblocked", + "invalid_url_website_inaccessible_password_protected", + "invalid_url_website_incomplete", + "invalid_url_website_incomplete_cancellation_policy", + "invalid_url_website_incomplete_customer_service_details", + "invalid_url_website_incomplete_legal_restrictions", + "invalid_url_website_incomplete_refund_policy", + "invalid_url_website_incomplete_return_policy", + "invalid_url_website_incomplete_terms_and_conditions", + "invalid_url_website_incomplete_under_construction", + "invalid_url_website_other", + "invalid_value_other", + "verification_directors_mismatch", + "verification_document_address_mismatch", + "verification_document_address_missing", + "verification_document_corrupt", + "verification_document_country_not_supported", + "verification_document_directors_mismatch", + "verification_document_dob_mismatch", + "verification_document_duplicate_type", + "verification_document_expired", + "verification_document_failed_copy", + "verification_document_failed_greyscale", + "verification_document_failed_other", + "verification_document_failed_test_mode", + "verification_document_fraudulent", + "verification_document_id_number_mismatch", + "verification_document_id_number_missing", + "verification_document_incomplete", + "verification_document_invalid", + "verification_document_issue_or_expiry_date_missing", + "verification_document_manipulated", + "verification_document_missing_back", + "verification_document_missing_front", + "verification_document_name_mismatch", + "verification_document_name_missing", + "verification_document_nationality_mismatch", + "verification_document_not_readable", + "verification_document_not_signed", + "verification_document_not_uploaded", + "verification_document_photo_mismatch", + "verification_document_too_large", + "verification_document_type_not_supported", + "verification_extraneous_directors", + "verification_failed_address_match", + "verification_failed_authorizer_authority", + "verification_failed_business_iec_number", + "verification_failed_document_match", + "verification_failed_id_number_match", + "verification_failed_keyed_identity", + "verification_failed_keyed_match", + "verification_failed_name_match", + "verification_failed_other", + "verification_failed_representative_authority", + "verification_failed_residential_address", + "verification_failed_tax_id_match", + "verification_failed_tax_id_not_issued", + "verification_missing_directors", + "verification_missing_executives", + "verification_missing_owners", + "verification_rejected_ownership_exemption_reason", + "verification_requires_additional_memorandum_of_associations", + "verification_requires_additional_proof_of_registration", + "verification_supportability", + ]), + reason: z.string().max(5000), + requirement: z.string().max(5000), +}) + +export const s_account_sepa_debit_payments_settings = z.object({ + creditor_id: z.string().max(5000).optional(), +}) + +export const s_account_terms_of_service = z.object({ + date: z.coerce.number().nullable().optional(), + ip: z.string().max(5000).nullable().optional(), + user_agent: z.string().max(5000).optional(), +}) + +export const s_account_tos_acceptance = z.object({ + date: z.coerce.number().nullable().optional(), + ip: z.string().max(5000).nullable().optional(), + service_agreement: z.string().max(5000).optional(), + user_agent: z.string().max(5000).nullable().optional(), +}) + +export const s_account_unification_account_controller_fees = z.object({ + payer: z.enum([ + "account", + "application", + "application_custom", + "application_express", + ]), +}) + +export const s_account_unification_account_controller_losses = z.object({ + payments: z.enum(["application", "stripe"]), +}) + +export const s_account_unification_account_controller_stripe_dashboard = + z.object({ type: z.enum(["express", "full", "none"]) }) + +export const s_address = z.object({ + city: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + line1: z.string().max(5000).nullable().optional(), + line2: z.string().max(5000).nullable().optional(), + postal_code: z.string().max(5000).nullable().optional(), + state: z.string().max(5000).nullable().optional(), +}) + +export const s_apple_pay_domain = z.object({ + created: z.coerce.number(), + domain_name: z.string().max(5000), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["apple_pay_domain"]), +}) + +export const s_application = z.object({ + id: z.string().max(5000), + name: z.string().max(5000).nullable().optional(), + object: z.enum(["application"]), +}) + +export const s_balance_amount_by_source_type = z.object({ + bank_account: z.coerce.number().optional(), + card: z.coerce.number().optional(), + fpx: z.coerce.number().optional(), +}) + +export const s_bank_connections_resource_balance_api_resource_cash_balance = + z.object({ available: z.record(z.coerce.number()).nullable().optional() }) + +export const s_bank_connections_resource_balance_api_resource_credit_balance = + z.object({ used: z.record(z.coerce.number()).nullable().optional() }) + +export const s_bank_connections_resource_balance_refresh = z.object({ + last_attempted_at: z.coerce.number(), + next_refresh_available_at: z.coerce.number().nullable().optional(), + status: z.enum(["failed", "pending", "succeeded"]), +}) + +export const s_bank_connections_resource_link_account_session_filters = + z.object({ + account_subcategories: z + .array( + z.enum([ + "checking", + "credit_card", + "line_of_credit", + "mortgage", + "savings", + ]), + ) + .nullable() + .optional(), + countries: z.array(z.string().max(5000)).nullable().optional(), + }) + +export const s_bank_connections_resource_ownership_refresh = z.object({ + last_attempted_at: z.coerce.number(), + next_refresh_available_at: z.coerce.number().nullable().optional(), + status: z.enum(["failed", "pending", "succeeded"]), +}) + +export const s_bank_connections_resource_transaction_refresh = z.object({ + id: z.string().max(5000), + last_attempted_at: z.coerce.number(), + next_refresh_available_at: z.coerce.number().nullable().optional(), + status: z.enum(["failed", "pending", "succeeded"]), +}) + +export const s_bank_connections_resource_transaction_resource_status_transitions = + z.object({ + posted_at: z.coerce.number().nullable().optional(), + void_at: z.coerce.number().nullable().optional(), + }) + +export const s_billing_bill_resource_invoice_item_parents_invoice_item_subscription_parent = + z.object({ + subscription: z.string().max(5000), + subscription_item: z.string().max(5000).optional(), + }) + +export const s_billing_bill_resource_invoicing_lines_common_credited_items = + z.object({ + invoice: z.string().max(5000), + invoice_line_items: z.array(z.string().max(5000)), + }) + +export const s_billing_bill_resource_invoicing_parents_invoice_quote_parent = + z.object({ quote: z.string().max(5000) }) + +export const s_billing_bill_resource_invoicing_pricing_pricing_price_details = + z.object({ price: z.string().max(5000), product: z.string().max(5000) }) + +export const s_billing_bill_resource_invoicing_taxes_tax_rate_details = + z.object({ tax_rate: z.string().max(5000) }) + +export const s_billing_clocks_resource_status_details_advancing_status_details = + z.object({ target_frozen_time: z.coerce.number() }) + +export const s_billing_credit_grants_resource_applicable_price = z.object({ + id: z.string().max(5000).nullable().optional(), +}) + +export const s_billing_credit_grants_resource_monetary_amount = z.object({ + currency: z.string().max(5000), + value: z.coerce.number(), +}) + +export const s_billing_meter_event = z.object({ + created: z.coerce.number(), + event_name: z.string().max(100), + identifier: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["billing.meter_event"]), + payload: z.record(z.string().max(100)), + timestamp: z.coerce.number(), +}) + +export const s_billing_meter_event_summary = z.object({ + aggregated_value: z.coerce.number(), + end_time: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + meter: z.string().max(5000), + object: z.enum(["billing.meter_event_summary"]), + start_time: z.coerce.number(), +}) + +export const s_billing_meter_resource_aggregation_settings = z.object({ + formula: z.enum(["count", "last", "sum"]), +}) + +export const s_billing_meter_resource_billing_meter_event_adjustment_cancel = + z.object({ identifier: z.string().max(100).nullable().optional() }) + +export const s_billing_meter_resource_billing_meter_status_transitions = + z.object({ deactivated_at: z.coerce.number().nullable().optional() }) + +export const s_billing_meter_resource_billing_meter_value = z.object({ + event_payload_key: z.string().max(5000), +}) + +export const s_billing_meter_resource_customer_mapping_settings = z.object({ + event_payload_key: z.string().max(5000), + type: z.enum(["by_id"]), +}) + +export const s_cancellation_details = z.object({ + comment: z.string().max(5000).nullable().optional(), + feedback: z + .enum([ + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ]) + .nullable() + .optional(), + reason: z + .enum(["cancellation_requested", "payment_disputed", "payment_failed"]) + .nullable() + .optional(), +}) + +export const s_card_issuing_account_terms_of_service = z.object({ + date: z.coerce.number().nullable().optional(), + ip: z.string().max(5000).nullable().optional(), + user_agent: z.string().max(5000).optional(), +}) + +export const s_card_mandate_payment_method_details = z.object({}) + +export const s_charge_fraud_details = z.object({ + stripe_report: z.string().max(5000).optional(), + user_report: z.string().max(5000).optional(), +}) + +export const s_checkout_acss_debit_mandate_options = z.object({ + custom_mandate_url: z.string().max(5000).optional(), + default_for: z.array(z.enum(["invoice", "subscription"])).optional(), + interval_description: z.string().max(5000).nullable().optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .nullable() + .optional(), + transaction_type: z.enum(["business", "personal"]).nullable().optional(), +}) + +export const s_checkout_affirm_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_afterpay_clearpay_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_alipay_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_amazon_pay_payment_method_options = z.object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_checkout_au_becs_debit_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), + target_date: z.string().max(5000).optional(), +}) + +export const s_checkout_bancontact_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_boleto_payment_method_options = z.object({ + expires_after_days: z.coerce.number(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), +}) + +export const s_checkout_card_installments_options = z.object({ + enabled: PermissiveBoolean.optional(), +}) + +export const s_checkout_cashapp_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_eps_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_fpx_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_giropay_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_grab_pay_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_ideal_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_kakao_pay_payment_method_options = z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_checkout_klarna_payment_method_options = z.object({ + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), +}) + +export const s_checkout_konbini_payment_method_options = z.object({ + expires_after_days: z.coerce.number().nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_kr_card_payment_method_options = z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_checkout_link_payment_method_options = z.object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_checkout_mobilepay_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_multibanco_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_naver_pay_payment_method_options = z.object({ + capture_method: z.enum(["manual"]).optional(), +}) + +export const s_checkout_oxxo_payment_method_options = z.object({ + expires_after_days: z.coerce.number(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_p24_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_payco_payment_method_options = z.object({ + capture_method: z.enum(["manual"]).optional(), +}) + +export const s_checkout_payment_method_options_mandate_options_bacs_debit = + z.object({ reference_prefix: z.string().max(5000).optional() }) + +export const s_checkout_payment_method_options_mandate_options_sepa_debit = + z.object({ reference_prefix: z.string().max(5000).optional() }) + +export const s_checkout_paynow_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_paypal_payment_method_options = z.object({ + capture_method: z.enum(["manual"]).optional(), + preferred_locale: z.string().max(5000).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_checkout_pix_payment_method_options = z.object({ + expires_after_seconds: z.coerce.number().nullable().optional(), +}) + +export const s_checkout_revolut_pay_payment_method_options = z.object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_checkout_samsung_pay_payment_method_options = z.object({ + capture_method: z.enum(["manual"]).optional(), +}) + +export const s_checkout_sofort_payment_method_options = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_swish_payment_method_options = z.object({ + reference: z.string().max(5000).nullable().optional(), +}) + +export const s_climate_removals_beneficiary = z.object({ + public_name: z.string().max(5000), +}) + +export const s_climate_removals_location = z.object({ + city: z.string().max(5000).nullable().optional(), + country: z.string().max(5000), + latitude: z.coerce.number().nullable().optional(), + longitude: z.coerce.number().nullable().optional(), + region: z.string().max(5000).nullable().optional(), +}) + +export const s_climate_removals_products_price = z.object({ + amount_fees: z.coerce.number(), + amount_subtotal: z.coerce.number(), + amount_total: z.coerce.number(), +}) + +export const s_confirmation_tokens_resource_mandate_data_resource_customer_acceptance_resource_online = + z.object({ + ip_address: z.string().max(5000).nullable().optional(), + user_agent: z.string().max(5000).nullable().optional(), + }) + +export const s_confirmation_tokens_resource_payment_method_options_resource_card = + z.object({ cvc_token: z.string().max(5000).nullable().optional() }) + +export const s_connect_embedded_account_features_claim = z.object({ + disable_stripe_user_authentication: PermissiveBoolean, + external_account_collection: PermissiveBoolean, +}) + +export const s_connect_embedded_base_features = z.object({}) + +export const s_connect_embedded_financial_account_features = z.object({ + disable_stripe_user_authentication: PermissiveBoolean, + external_account_collection: PermissiveBoolean, + send_money: PermissiveBoolean, + transfer_balance: PermissiveBoolean, +}) + +export const s_connect_embedded_financial_account_transactions_features = + z.object({ card_spend_dispute_management: PermissiveBoolean }) + +export const s_connect_embedded_issuing_card_features = z.object({ + card_management: PermissiveBoolean, + card_spend_dispute_management: PermissiveBoolean, + cardholder_management: PermissiveBoolean, + spend_control_management: PermissiveBoolean, +}) + +export const s_connect_embedded_issuing_cards_list_features = z.object({ + card_management: PermissiveBoolean, + card_spend_dispute_management: PermissiveBoolean, + cardholder_management: PermissiveBoolean, + disable_stripe_user_authentication: PermissiveBoolean, + spend_control_management: PermissiveBoolean, +}) + +export const s_connect_embedded_payments_features = z.object({ + capture_payments: PermissiveBoolean, + destination_on_behalf_of_charge_management: PermissiveBoolean, + dispute_management: PermissiveBoolean, + refund_management: PermissiveBoolean, +}) + +export const s_connect_embedded_payouts_features = z.object({ + disable_stripe_user_authentication: PermissiveBoolean, + edit_payout_schedule: PermissiveBoolean, + external_account_collection: PermissiveBoolean, + instant_payouts: PermissiveBoolean, + standard_payouts: PermissiveBoolean, +}) + +export const s_country_spec_verification_field_details = z.object({ + additional: z.array(z.string().max(5000)), + minimum: z.array(z.string().max(5000)), +}) + +export const s_coupon_applies_to = z.object({ + products: z.array(z.string().max(5000)), +}) + +export const s_coupon_currency_option = z.object({ + amount_off: z.coerce.number(), +}) + +export const s_custom_unit_amount = z.object({ + maximum: z.coerce.number().nullable().optional(), + minimum: z.coerce.number().nullable().optional(), + preset: z.coerce.number().nullable().optional(), +}) + +export const s_customer_balance_customer_balance_settings = z.object({ + reconciliation_mode: z.enum(["automatic", "manual"]), + using_merchant_default: PermissiveBoolean, +}) + +export const s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_eu_bank_transfer = + z.object({ + bic: z.string().max(5000).nullable().optional(), + iban_last4: z.string().max(5000).nullable().optional(), + sender_name: z.string().max(5000).nullable().optional(), + }) + +export const s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_gb_bank_transfer = + z.object({ + account_number_last4: z.string().max(5000).nullable().optional(), + sender_name: z.string().max(5000).nullable().optional(), + sort_code: z.string().max(5000).nullable().optional(), + }) + +export const s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_jp_bank_transfer = + z.object({ + sender_bank: z.string().max(5000).nullable().optional(), + sender_branch: z.string().max(5000).nullable().optional(), + sender_name: z.string().max(5000).nullable().optional(), + }) + +export const s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_us_bank_transfer = + z.object({ + network: z.enum(["ach", "domestic_wire_us", "swift"]).optional(), + sender_name: z.string().max(5000).nullable().optional(), + }) + +export const s_customer_session_resource_components_resource_buy_button = + z.object({ enabled: PermissiveBoolean }) + +export const s_customer_session_resource_components_resource_payment_element_resource_features = + z.object({ + payment_method_allow_redisplay_filters: z.array( + z.enum(["always", "limited", "unspecified"]), + ), + payment_method_redisplay: z.enum(["disabled", "enabled"]), + payment_method_redisplay_limit: z.coerce.number().nullable().optional(), + payment_method_remove: z.enum(["disabled", "enabled"]), + payment_method_save: z.enum(["disabled", "enabled"]), + payment_method_save_usage: z + .enum(["off_session", "on_session"]) + .nullable() + .optional(), + }) + +export const s_customer_session_resource_components_resource_pricing_table = + z.object({ enabled: PermissiveBoolean }) + +export const s_customer_tax_location = z.object({ + country: z.string().max(5000), + source: z.enum([ + "billing_address", + "ip_address", + "payment_method", + "shipping_destination", + ]), + state: z.string().max(5000).nullable().optional(), +}) + +export const s_deleted_account = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["account"]), +}) + +export const s_deleted_apple_pay_domain = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["apple_pay_domain"]), +}) + +export const s_deleted_application = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + name: z.string().max(5000).nullable().optional(), + object: z.enum(["application"]), +}) + +export const s_deleted_bank_account = z.object({ + currency: z.string().max(5000).nullable().optional(), + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["bank_account"]), +}) + +export const s_deleted_card = z.object({ + currency: z.string().max(5000).nullable().optional(), + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["card"]), +}) + +export const s_deleted_coupon = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["coupon"]), +}) + +export const s_deleted_customer = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["customer"]), +}) + +export const s_deleted_invoice = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["invoice"]), +}) + +export const s_deleted_invoiceitem = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["invoiceitem"]), +}) + +export const s_deleted_person = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["person"]), +}) + +export const s_deleted_plan = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["plan"]), +}) + +export const s_deleted_price = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["price"]), +}) + +export const s_deleted_product = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["product"]), +}) + +export const s_deleted_product_feature = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["product_feature"]), +}) + +export const s_deleted_radar_value_list = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["radar.value_list"]), +}) + +export const s_deleted_radar_value_list_item = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["radar.value_list_item"]), +}) + +export const s_deleted_subscription_item = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["subscription_item"]), +}) + +export const s_deleted_tax_id = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["tax_id"]), +}) + +export const s_deleted_terminal_configuration = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["terminal.configuration"]), +}) + +export const s_deleted_terminal_location = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["terminal.location"]), +}) + +export const s_deleted_terminal_reader = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["terminal.reader"]), +}) + +export const s_deleted_test_helpers_test_clock = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["test_helpers.test_clock"]), +}) + +export const s_deleted_webhook_endpoint = z.object({ + deleted: PermissiveBoolean, + id: z.string().max(5000), + object: z.enum(["webhook_endpoint"]), +}) + +export const s_destination_details_unimplemented = z.object({}) + +export const s_dispute_enhanced_eligibility_visa_compelling_evidence3 = + z.object({ + required_actions: z.array( + z.enum([ + "missing_customer_identifiers", + "missing_disputed_transaction_description", + "missing_merchandise_or_services", + "missing_prior_undisputed_transaction_description", + "missing_prior_undisputed_transactions", + ]), + ), + status: z.enum(["not_qualified", "qualified", "requires_action"]), + }) + +export const s_dispute_enhanced_eligibility_visa_compliance = z.object({ + status: z.enum(["fee_acknowledged", "requires_fee_acknowledgement"]), +}) + +export const s_dispute_enhanced_evidence_visa_compliance = z.object({ + fee_acknowledged: PermissiveBoolean, +}) + +export const s_dispute_payment_method_details_amazon_pay = z.object({ + dispute_type: z.enum(["chargeback", "claim"]).nullable().optional(), +}) + +export const s_dispute_payment_method_details_card = z.object({ + brand: z.string().max(5000), + case_type: z.enum(["chargeback", "inquiry"]), + network_reason_code: z.string().max(5000).nullable().optional(), +}) + +export const s_dispute_payment_method_details_klarna = z.object({ + reason_code: z.string().max(5000).nullable().optional(), +}) + +export const s_dispute_payment_method_details_paypal = z.object({ + case_id: z.string().max(5000).nullable().optional(), + reason_code: z.string().max(5000).nullable().optional(), +}) + +export const s_dispute_transaction_shipping_address = z.object({ + city: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + line1: z.string().max(5000).nullable().optional(), + line2: z.string().max(5000).nullable().optional(), + postal_code: z.string().max(5000).nullable().optional(), + state: z.string().max(5000).nullable().optional(), +}) + +export const s_email_sent = z.object({ + email_sent_at: z.coerce.number(), + email_sent_to: z.string().max(5000), +}) + +export const s_entitlements_feature = z.object({ + active: PermissiveBoolean, + id: z.string().max(5000), + livemode: PermissiveBoolean, + lookup_key: z.string().max(5000), + metadata: z.record(z.string().max(500)), + name: z.string().max(80), + object: z.enum(["entitlements.feature"]), +}) + +export const s_ephemeral_key = z.object({ + created: z.coerce.number(), + expires: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["ephemeral_key"]), + secret: z.string().max(5000).optional(), +}) + +export const s_exchange_rate = z.object({ + id: z.string().max(5000), + object: z.enum(["exchange_rate"]), + rates: z.record(z.coerce.number()), +}) + +export const s_fee = z.object({ + amount: z.coerce.number(), + application: z.string().max(5000).nullable().optional(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + type: z.string().max(5000), +}) + +export const s_financial_connections_account_owner = z.object({ + email: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + name: z.string().max(5000), + object: z.enum(["financial_connections.account_owner"]), + ownership: z.string().max(5000), + phone: z.string().max(5000).nullable().optional(), + raw_address: z.string().max(5000).nullable().optional(), + refreshed_at: z.coerce.number().nullable().optional(), +}) + +export const s_financial_reporting_finance_report_run_run_parameters = z.object( + { + columns: z.array(z.string().max(5000)).optional(), + connected_account: z.string().max(5000).optional(), + currency: z.string().optional(), + interval_end: z.coerce.number().optional(), + interval_start: z.coerce.number().optional(), + payout: z.string().max(5000).optional(), + reporting_category: z.string().max(5000).optional(), + timezone: z.string().max(5000).optional(), + }, +) + +export const s_forwarded_request_context = z.object({ + destination_duration: z.coerce.number(), + destination_ip_address: z.string().max(5000), +}) + +export const s_forwarded_request_header = z.object({ + name: z.string().max(5000), + value: z.string().max(5000), +}) + +export const s_gelato_data_document_report_date_of_birth = z.object({ + day: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + year: z.coerce.number().nullable().optional(), +}) + +export const s_gelato_data_document_report_expiration_date = z.object({ + day: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + year: z.coerce.number().nullable().optional(), +}) + +export const s_gelato_data_document_report_issued_date = z.object({ + day: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + year: z.coerce.number().nullable().optional(), +}) + +export const s_gelato_data_id_number_report_date = z.object({ + day: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + year: z.coerce.number().nullable().optional(), +}) + +export const s_gelato_data_verified_outputs_date = z.object({ + day: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + year: z.coerce.number().nullable().optional(), +}) + +export const s_gelato_document_report_error = z.object({ + code: z + .enum([ + "document_expired", + "document_type_not_supported", + "document_unverified_other", + ]) + .nullable() + .optional(), + reason: z.string().max(5000).nullable().optional(), +}) + +export const s_gelato_email_report_error = z.object({ + code: z + .enum(["email_unverified_other", "email_verification_declined"]) + .nullable() + .optional(), + reason: z.string().max(5000).nullable().optional(), +}) + +export const s_gelato_id_number_report_error = z.object({ + code: z + .enum([ + "id_number_insufficient_document_data", + "id_number_mismatch", + "id_number_unverified_other", + ]) + .nullable() + .optional(), + reason: z.string().max(5000).nullable().optional(), +}) + +export const s_gelato_phone_report_error = z.object({ + code: z + .enum(["phone_unverified_other", "phone_verification_declined"]) + .nullable() + .optional(), + reason: z.string().max(5000).nullable().optional(), +}) + +export const s_gelato_provided_details = z.object({ + email: z.string().max(5000).optional(), + phone: z.string().max(5000).optional(), +}) + +export const s_gelato_report_document_options = z.object({ + allowed_types: z + .array(z.enum(["driving_license", "id_card", "passport"])) + .optional(), + require_id_number: PermissiveBoolean.optional(), + require_live_capture: PermissiveBoolean.optional(), + require_matching_selfie: PermissiveBoolean.optional(), +}) + +export const s_gelato_report_id_number_options = z.object({}) + +export const s_gelato_selfie_report_error = z.object({ + code: z + .enum([ + "selfie_document_missing_photo", + "selfie_face_mismatch", + "selfie_manipulated", + "selfie_unverified_other", + ]) + .nullable() + .optional(), + reason: z.string().max(5000).nullable().optional(), +}) + +export const s_gelato_session_document_options = z.object({ + allowed_types: z + .array(z.enum(["driving_license", "id_card", "passport"])) + .optional(), + require_id_number: PermissiveBoolean.optional(), + require_live_capture: PermissiveBoolean.optional(), + require_matching_selfie: PermissiveBoolean.optional(), +}) + +export const s_gelato_session_email_options = z.object({ + require_verification: PermissiveBoolean.optional(), +}) + +export const s_gelato_session_id_number_options = z.object({}) + +export const s_gelato_session_last_error = z.object({ + code: z + .enum([ + "abandoned", + "consent_declined", + "country_not_supported", + "device_not_supported", + "document_expired", + "document_type_not_supported", + "document_unverified_other", + "email_unverified_other", + "email_verification_declined", + "id_number_insufficient_document_data", + "id_number_mismatch", + "id_number_unverified_other", + "phone_unverified_other", + "phone_verification_declined", + "selfie_document_missing_photo", + "selfie_face_mismatch", + "selfie_manipulated", + "selfie_unverified_other", + "under_supported_age", + ]) + .nullable() + .optional(), + reason: z.string().max(5000).nullable().optional(), +}) + +export const s_gelato_session_phone_options = z.object({ + require_verification: PermissiveBoolean.optional(), +}) + +export const s_internal_card = z.object({ + brand: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number().nullable().optional(), + exp_year: z.coerce.number().nullable().optional(), + last4: z.string().max(5000).nullable().optional(), +}) + +export const s_invoice_installments_card = z.object({ + enabled: PermissiveBoolean.nullable().optional(), +}) + +export const s_invoice_item_threshold_reason = z.object({ + line_item_ids: z.array(z.string().max(5000)), + usage_gte: z.coerce.number(), +}) + +export const s_invoice_line_item_period = z.object({ + end: z.coerce.number(), + start: z.coerce.number(), +}) + +export const s_invoice_mandate_options_card = z.object({ + amount: z.coerce.number().nullable().optional(), + amount_type: z.enum(["fixed", "maximum"]).nullable().optional(), + description: z.string().max(200).nullable().optional(), +}) + +export const s_invoice_payment_method_options_acss_debit_mandate_options = + z.object({ + transaction_type: z.enum(["business", "personal"]).nullable().optional(), + }) + +export const s_invoice_payment_method_options_bancontact = z.object({ + preferred_language: z.enum(["de", "en", "fr", "nl"]), +}) + +export const s_invoice_payment_method_options_customer_balance_bank_transfer_eu_bank_transfer = + z.object({ country: z.enum(["BE", "DE", "ES", "FR", "IE", "NL"]) }) + +export const s_invoice_payment_method_options_konbini = z.object({}) + +export const s_invoice_payment_method_options_sepa_debit = z.object({}) + +export const s_invoice_payment_method_options_us_bank_account_linked_account_options_filters = + z.object({ + account_subcategories: z.array(z.enum(["checking", "savings"])).optional(), + }) + +export const s_invoice_rendering_pdf = z.object({ + page_size: z.enum(["a4", "auto", "letter"]).nullable().optional(), +}) + +export const s_invoice_rendering_template = z.object({ + created: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + nickname: z.string().max(5000).nullable().optional(), + object: z.enum(["invoice_rendering_template"]), + status: z.enum(["active", "archived"]), + version: z.coerce.number(), +}) + +export const s_invoice_setting_checkout_rendering_options = z.object({ + amount_tax_display: z.string().max(5000).nullable().optional(), +}) + +export const s_invoice_setting_custom_field = z.object({ + name: z.string().max(5000), + value: z.string().max(5000), +}) + +export const s_invoice_setting_customer_rendering_options = z.object({ + amount_tax_display: z.string().max(5000).nullable().optional(), + template: z.string().max(5000).nullable().optional(), +}) + +export const s_invoices_payments_invoice_payment_status_transitions = z.object({ + canceled_at: z.coerce.number().nullable().optional(), + paid_at: z.coerce.number().nullable().optional(), +}) + +export const s_invoices_resource_confirmation_secret = z.object({ + client_secret: z.string().max(5000), + type: z.string().max(5000), +}) + +export const s_invoices_resource_invoice_tax_id = z.object({ + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "unknown", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string().max(5000).nullable().optional(), +}) + +export const s_invoices_resource_status_transitions = z.object({ + finalized_at: z.coerce.number().nullable().optional(), + marked_uncollectible_at: z.coerce.number().nullable().optional(), + paid_at: z.coerce.number().nullable().optional(), + voided_at: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_authorization_amount_details = z.object({ + atm_fee: z.coerce.number().nullable().optional(), + cashback_amount: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_authorization_authentication_exemption = z.object({ + claimed_by: z.enum(["acquirer", "issuer"]), + type: z.enum([ + "low_value_transaction", + "transaction_risk_analysis", + "unknown", + ]), +}) + +export const s_issuing_authorization_fleet_cardholder_prompt_data = z.object({ + alphanumeric_id: z.string().max(5000).nullable().optional(), + driver_id: z.string().max(5000).nullable().optional(), + odometer: z.coerce.number().nullable().optional(), + unspecified_id: z.string().max(5000).nullable().optional(), + user_id: z.string().max(5000).nullable().optional(), + vehicle_number: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_authorization_fleet_fuel_price_data = z.object({ + gross_amount_decimal: z.string().nullable().optional(), +}) + +export const s_issuing_authorization_fleet_non_fuel_price_data = z.object({ + gross_amount_decimal: z.string().nullable().optional(), +}) + +export const s_issuing_authorization_fleet_tax_data = z.object({ + local_amount_decimal: z.string().nullable().optional(), + national_amount_decimal: z.string().nullable().optional(), +}) + +export const s_issuing_authorization_fraud_challenge = z.object({ + channel: z.enum(["sms"]), + status: z.enum([ + "expired", + "pending", + "rejected", + "undeliverable", + "verified", + ]), + undeliverable_reason: z + .enum(["no_phone_number", "unsupported_phone_number"]) + .nullable() + .optional(), +}) + +export const s_issuing_authorization_fuel_data = z.object({ + industry_product_code: z.string().max(5000).nullable().optional(), + quantity_decimal: z.string().nullable().optional(), + type: z + .enum([ + "diesel", + "other", + "unleaded_plus", + "unleaded_regular", + "unleaded_super", + ]) + .nullable() + .optional(), + unit: z + .enum([ + "charging_minute", + "imperial_gallon", + "kilogram", + "kilowatt_hour", + "liter", + "other", + "pound", + "us_gallon", + ]) + .nullable() + .optional(), + unit_cost_decimal: z.string().nullable().optional(), +}) + +export const s_issuing_authorization_merchant_data = z.object({ + category: z.string().max(5000), + category_code: z.string().max(5000), + city: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + network_id: z.string().max(5000), + postal_code: z.string().max(5000).nullable().optional(), + state: z.string().max(5000).nullable().optional(), + tax_id: z.string().max(5000).nullable().optional(), + terminal_id: z.string().max(5000).nullable().optional(), + url: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_authorization_network_data = z.object({ + acquiring_institution_id: z.string().max(5000).nullable().optional(), + system_trace_audit_number: z.string().max(5000).nullable().optional(), + transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_authorization_three_d_secure = z.object({ + result: z.enum([ + "attempt_acknowledged", + "authenticated", + "failed", + "required", + ]), +}) + +export const s_issuing_authorization_treasury = z.object({ + received_credits: z.array(z.string().max(5000)), + received_debits: z.array(z.string().max(5000)), + transaction: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_card_apple_pay = z.object({ + eligible: PermissiveBoolean, + ineligible_reason: z + .enum([ + "missing_agreement", + "missing_cardholder_contact", + "unsupported_region", + ]) + .nullable() + .optional(), +}) + +export const s_issuing_card_google_pay = z.object({ + eligible: PermissiveBoolean, + ineligible_reason: z + .enum([ + "missing_agreement", + "missing_cardholder_contact", + "unsupported_region", + ]) + .nullable() + .optional(), +}) + +export const s_issuing_card_shipping_customs = z.object({ + eori_number: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_card_spending_limit = z.object({ + amount: z.coerce.number(), + categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .nullable() + .optional(), + interval: z.enum([ + "all_time", + "daily", + "monthly", + "per_authorization", + "weekly", + "yearly", + ]), +}) + +export const s_issuing_cardholder_company = z.object({ + tax_id_provided: PermissiveBoolean, +}) + +export const s_issuing_cardholder_individual_dob = z.object({ + day: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + year: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_cardholder_requirements = z.object({ + disabled_reason: z + .enum([ + "listed", + "rejected.listed", + "requirements.past_due", + "under_review", + ]) + .nullable() + .optional(), + past_due: z + .array( + z.enum([ + "company.tax_id", + "individual.card_issuing.user_terms_acceptance.date", + "individual.card_issuing.user_terms_acceptance.ip", + "individual.dob.day", + "individual.dob.month", + "individual.dob.year", + "individual.first_name", + "individual.last_name", + "individual.verification.document", + ]), + ) + .nullable() + .optional(), +}) + +export const s_issuing_cardholder_spending_limit = z.object({ + amount: z.coerce.number(), + categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .nullable() + .optional(), + interval: z.enum([ + "all_time", + "daily", + "monthly", + "per_authorization", + "weekly", + "yearly", + ]), +}) + +export const s_issuing_cardholder_user_terms_acceptance = z.object({ + date: z.coerce.number().nullable().optional(), + ip: z.string().max(5000).nullable().optional(), + user_agent: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_dispute_treasury = z.object({ + debit_reversal: z.string().max(5000).nullable().optional(), + received_debit: z.string().max(5000), +}) + +export const s_issuing_network_token_address = z.object({ + line1: z.string().max(5000), + postal_code: z.string().max(5000), +}) + +export const s_issuing_network_token_device = z.object({ + device_fingerprint: z.string().max(5000).optional(), + ip_address: z.string().max(5000).optional(), + location: z.string().max(5000).optional(), + name: z.string().max(5000).optional(), + phone_number: z.string().max(5000).optional(), + type: z.enum(["other", "phone", "watch"]).optional(), +}) + +export const s_issuing_network_token_mastercard = z.object({ + card_reference_id: z.string().max(5000).optional(), + token_reference_id: z.string().max(5000), + token_requestor_id: z.string().max(5000), + token_requestor_name: z.string().max(5000).optional(), +}) + +export const s_issuing_network_token_visa = z.object({ + card_reference_id: z.string().max(5000), + token_reference_id: z.string().max(5000), + token_requestor_id: z.string().max(5000), + token_risk_score: z.string().max(5000).optional(), +}) + +export const s_issuing_personalization_design_carrier_text = z.object({ + footer_body: z.string().max(5000).nullable().optional(), + footer_title: z.string().max(5000).nullable().optional(), + header_body: z.string().max(5000).nullable().optional(), + header_title: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_personalization_design_preferences = z.object({ + is_default: PermissiveBoolean, + is_platform_default: PermissiveBoolean.nullable().optional(), +}) + +export const s_issuing_personalization_design_rejection_reasons = z.object({ + card_logo: z + .array( + z.enum([ + "geographic_location", + "inappropriate", + "network_name", + "non_binary_image", + "non_fiat_currency", + "other", + "other_entity", + "promotional_material", + ]), + ) + .nullable() + .optional(), + carrier_text: z + .array( + z.enum([ + "geographic_location", + "inappropriate", + "network_name", + "non_fiat_currency", + "other", + "other_entity", + "promotional_material", + ]), + ) + .nullable() + .optional(), +}) + +export const s_issuing_physical_bundle_features = z.object({ + card_logo: z.enum(["optional", "required", "unsupported"]), + carrier_text: z.enum(["optional", "required", "unsupported"]), + second_line: z.enum(["optional", "required", "unsupported"]), +}) + +export const s_issuing_settlement = z.object({ + bin: z.string().max(5000), + clearing_date: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + id: z.string().max(5000), + interchange_fees_amount: z.coerce.number(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + net_total_amount: z.coerce.number(), + network: z.enum(["maestro", "visa"]), + network_fees_amount: z.coerce.number(), + network_settlement_identifier: z.string().max(5000), + object: z.enum(["issuing.settlement"]), + settlement_service: z.string().max(5000), + status: z.enum(["complete", "pending"]), + transaction_amount: z.coerce.number(), + transaction_count: z.coerce.number(), +}) + +export const s_issuing_transaction_amount_details = z.object({ + atm_fee: z.coerce.number().nullable().optional(), + cashback_amount: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_transaction_fleet_cardholder_prompt_data = z.object({ + driver_id: z.string().max(5000).nullable().optional(), + odometer: z.coerce.number().nullable().optional(), + unspecified_id: z.string().max(5000).nullable().optional(), + user_id: z.string().max(5000).nullable().optional(), + vehicle_number: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_transaction_fleet_fuel_price_data = z.object({ + gross_amount_decimal: z.string().nullable().optional(), +}) + +export const s_issuing_transaction_fleet_non_fuel_price_data = z.object({ + gross_amount_decimal: z.string().nullable().optional(), +}) + +export const s_issuing_transaction_fleet_tax_data = z.object({ + local_amount_decimal: z.string().nullable().optional(), + national_amount_decimal: z.string().nullable().optional(), +}) + +export const s_issuing_transaction_flight_data_leg = z.object({ + arrival_airport_code: z.string().max(5000).nullable().optional(), + carrier: z.string().max(5000).nullable().optional(), + departure_airport_code: z.string().max(5000).nullable().optional(), + flight_number: z.string().max(5000).nullable().optional(), + service_class: z.string().max(5000).nullable().optional(), + stopover_allowed: PermissiveBoolean.nullable().optional(), +}) + +export const s_issuing_transaction_fuel_data = z.object({ + industry_product_code: z.string().max(5000).nullable().optional(), + quantity_decimal: z.string().nullable().optional(), + type: z.string().max(5000), + unit: z.string().max(5000), + unit_cost_decimal: z.string(), +}) + +export const s_issuing_transaction_lodging_data = z.object({ + check_in_at: z.coerce.number().nullable().optional(), + nights: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_transaction_network_data = z.object({ + authorization_code: z.string().max(5000).nullable().optional(), + processing_date: z.string().max(5000).nullable().optional(), + transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_transaction_receipt_data = z.object({ + description: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number().nullable().optional(), + total: z.coerce.number().nullable().optional(), + unit_cost: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_transaction_treasury = z.object({ + received_credit: z.string().max(5000).nullable().optional(), + received_debit: z.string().max(5000).nullable().optional(), +}) + +export const s_klarna_address = z.object({ + country: z.string().max(5000).nullable().optional(), +}) + +export const s_legal_entity_directorship_declaration = z.object({ + date: z.coerce.number().nullable().optional(), + ip: z.string().max(5000).nullable().optional(), + user_agent: z.string().max(5000).nullable().optional(), +}) + +export const s_legal_entity_dob = z.object({ + day: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + year: z.coerce.number().nullable().optional(), +}) + +export const s_legal_entity_japan_address = z.object({ + city: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + line1: z.string().max(5000).nullable().optional(), + line2: z.string().max(5000).nullable().optional(), + postal_code: z.string().max(5000).nullable().optional(), + state: z.string().max(5000).nullable().optional(), + town: z.string().max(5000).nullable().optional(), +}) + +export const s_legal_entity_ubo_declaration = z.object({ + date: z.coerce.number().nullable().optional(), + ip: z.string().max(5000).nullable().optional(), + user_agent: z.string().max(5000).nullable().optional(), +}) + +export const s_login_link = z.object({ + created: z.coerce.number(), + object: z.enum(["login_link"]), + url: z.string().max(5000), +}) + +export const s_mandate_acss_debit = z.object({ + default_for: z.array(z.enum(["invoice", "subscription"])).optional(), + interval_description: z.string().max(5000).nullable().optional(), + payment_schedule: z.enum(["combined", "interval", "sporadic"]), + transaction_type: z.enum(["business", "personal"]), +}) + +export const s_mandate_amazon_pay = z.object({}) + +export const s_mandate_au_becs_debit = z.object({ url: z.string().max(5000) }) + +export const s_mandate_bacs_debit = z.object({ + network_status: z.enum(["accepted", "pending", "refused", "revoked"]), + reference: z.string().max(5000), + revocation_reason: z + .enum([ + "account_closed", + "bank_account_restricted", + "bank_ownership_changed", + "could_not_process", + "debit_not_authorized", + ]) + .nullable() + .optional(), + url: z.string().max(5000), +}) + +export const s_mandate_cashapp = z.object({}) + +export const s_mandate_kakao_pay = z.object({}) + +export const s_mandate_kr_card = z.object({}) + +export const s_mandate_link = z.object({}) + +export const s_mandate_multi_use = z.object({}) + +export const s_mandate_naver_pay = z.object({}) + +export const s_mandate_nz_bank_account = z.object({}) + +export const s_mandate_paypal = z.object({ + billing_agreement_id: z.string().max(5000).nullable().optional(), + payer_id: z.string().max(5000).nullable().optional(), +}) + +export const s_mandate_revolut_pay = z.object({}) + +export const s_mandate_sepa_debit = z.object({ + reference: z.string().max(5000), + url: z.string().max(5000), +}) + +export const s_mandate_single_use = z.object({ + amount: z.coerce.number(), + currency: z.string(), +}) + +export const s_mandate_us_bank_account = z.object({ + collection_method: z.enum(["paper"]).optional(), +}) + +export const s_networks = z.object({ + available: z.array(z.string().max(5000)), + preferred: z.string().max(5000).nullable().optional(), +}) + +export const s_notification_event_data = z.object({ + object: z.object({}), + previous_attributes: z.object({}).optional(), +}) + +export const s_notification_event_request = z.object({ + id: z.string().max(5000).nullable().optional(), + idempotency_key: z.string().max(5000).nullable().optional(), +}) + +export const s_offline_acceptance = z.object({}) + +export const s_online_acceptance = z.object({ + ip_address: z.string().max(5000).nullable().optional(), + user_agent: z.string().max(5000).nullable().optional(), +}) + +export const s_outbound_payments_payment_method_details_financial_account = + z.object({ id: z.string().max(5000), network: z.enum(["stripe"]) }) + +export const s_outbound_transfers_payment_method_details_financial_account = + z.object({ id: z.string().max(5000), network: z.enum(["stripe"]) }) + +export const s_package_dimensions = z.object({ + height: z.coerce.number(), + length: z.coerce.number(), + weight: z.coerce.number(), + width: z.coerce.number(), +}) + +export const s_payment_flows_amount_details_client_resource_tip = z.object({ + amount: z.coerce.number().optional(), +}) + +export const s_payment_flows_automatic_payment_methods_payment_intent = + z.object({ + allow_redirects: z.enum(["always", "never"]).optional(), + enabled: PermissiveBoolean, + }) + +export const s_payment_flows_automatic_payment_methods_setup_intent = z.object({ + allow_redirects: z.enum(["always", "never"]).optional(), + enabled: PermissiveBoolean.nullable().optional(), +}) + +export const s_payment_flows_payment_intent_presentment_details = z.object({ + presentment_amount: z.coerce.number(), + presentment_currency: z.string().max(5000), +}) + +export const s_payment_flows_private_payment_methods_alipay = z.object({}) + +export const s_payment_flows_private_payment_methods_alipay_details = z.object({ + buyer_id: z.string().max(5000).optional(), + fingerprint: z.string().max(5000).nullable().optional(), + transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_extended_authorization_extended_authorization = + z.object({ status: z.enum(["disabled", "enabled"]) }) + +export const s_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_incremental_authorization_incremental_authorization = + z.object({ status: z.enum(["available", "unavailable"]) }) + +export const s_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_overcapture_overcapture = + z.object({ + maximum_amount_capturable: z.coerce.number(), + status: z.enum(["available", "unavailable"]), + }) + +export const s_payment_flows_private_payment_methods_card_details_api_resource_multicapture = + z.object({ status: z.enum(["available", "unavailable"]) }) + +export const s_payment_flows_private_payment_methods_card_present_common_wallet = + z.object({ + type: z.enum(["apple_pay", "google_pay", "samsung_pay", "unknown"]), + }) + +export const s_payment_flows_private_payment_methods_kakao_pay_payment_method_options = + z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), + }) + +export const s_payment_flows_private_payment_methods_klarna_dob = z.object({ + day: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + year: z.coerce.number().nullable().optional(), +}) + +export const s_payment_flows_private_payment_methods_naver_pay_payment_method_options = + z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), + }) + +export const s_payment_flows_private_payment_methods_payco_payment_method_options = + z.object({ capture_method: z.enum(["manual"]).optional() }) + +export const s_payment_flows_private_payment_methods_samsung_pay_payment_method_options = + z.object({ capture_method: z.enum(["manual"]).optional() }) + +export const s_payment_flows_private_payment_methods_us_bank_account_linked_account_options_filters = + z.object({ + account_subcategories: z.array(z.enum(["checking", "savings"])).optional(), + }) + +export const s_payment_intent_next_action_alipay_handle_redirect = z.object({ + native_data: z.string().max(5000).nullable().optional(), + native_url: z.string().max(5000).nullable().optional(), + return_url: z.string().max(5000).nullable().optional(), + url: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_intent_next_action_boleto = z.object({ + expires_at: z.coerce.number().nullable().optional(), + hosted_voucher_url: z.string().max(5000).nullable().optional(), + number: z.string().max(5000).nullable().optional(), + pdf: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_intent_next_action_card_await_notification = z.object({ + charge_attempt_at: z.coerce.number().nullable().optional(), + customer_approval_required: PermissiveBoolean.nullable().optional(), +}) + +export const s_payment_intent_next_action_cashapp_qr_code = z.object({ + expires_at: z.coerce.number(), + image_url_png: z.string().max(5000), + image_url_svg: z.string().max(5000), +}) + +export const s_payment_intent_next_action_display_multibanco_details = z.object( + { + entity: z.string().max(5000).nullable().optional(), + expires_at: z.coerce.number().nullable().optional(), + hosted_voucher_url: z.string().max(5000).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), + }, +) + +export const s_payment_intent_next_action_display_oxxo_details = z.object({ + expires_after: z.coerce.number().nullable().optional(), + hosted_voucher_url: z.string().max(5000).nullable().optional(), + number: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_intent_next_action_konbini_familymart = z.object({ + confirmation_number: z.string().max(5000).optional(), + payment_code: z.string().max(5000), +}) + +export const s_payment_intent_next_action_konbini_lawson = z.object({ + confirmation_number: z.string().max(5000).optional(), + payment_code: z.string().max(5000), +}) + +export const s_payment_intent_next_action_konbini_ministop = z.object({ + confirmation_number: z.string().max(5000).optional(), + payment_code: z.string().max(5000), +}) + +export const s_payment_intent_next_action_konbini_seicomart = z.object({ + confirmation_number: z.string().max(5000).optional(), + payment_code: z.string().max(5000), +}) + +export const s_payment_intent_next_action_paynow_display_qr_code = z.object({ + data: z.string().max(5000), + hosted_instructions_url: z.string().max(5000).nullable().optional(), + image_url_png: z.string().max(5000), + image_url_svg: z.string().max(5000), +}) + +export const s_payment_intent_next_action_pix_display_qr_code = z.object({ + data: z.string().max(5000).optional(), + expires_at: z.coerce.number().optional(), + hosted_instructions_url: z.string().max(5000).optional(), + image_url_png: z.string().max(5000).optional(), + image_url_svg: z.string().max(5000).optional(), +}) + +export const s_payment_intent_next_action_promptpay_display_qr_code = z.object({ + data: z.string().max(5000), + hosted_instructions_url: z.string().max(5000), + image_url_png: z.string().max(5000), + image_url_svg: z.string().max(5000), +}) + +export const s_payment_intent_next_action_redirect_to_url = z.object({ + return_url: z.string().max(5000).nullable().optional(), + url: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_intent_next_action_swish_qr_code = z.object({ + data: z.string().max(5000), + image_url_png: z.string().max(5000), + image_url_svg: z.string().max(5000), +}) + +export const s_payment_intent_next_action_verify_with_microdeposits = z.object({ + arrival_date: z.coerce.number(), + hosted_verification_url: z.string().max(5000), + microdeposit_type: z + .enum(["amounts", "descriptor_code"]) + .nullable() + .optional(), +}) + +export const s_payment_intent_next_action_wechat_pay_display_qr_code = z.object( + { + data: z.string().max(5000), + hosted_instructions_url: z.string().max(5000), + image_data_url: z.string().max(5000), + image_url_png: z.string().max(5000), + image_url_svg: z.string().max(5000), + }, +) + +export const s_payment_intent_next_action_wechat_pay_redirect_to_android_app = + z.object({ + app_id: z.string().max(5000), + nonce_str: z.string().max(5000), + package: z.string().max(5000), + partner_id: z.string().max(5000), + prepay_id: z.string().max(5000), + sign: z.string().max(5000), + timestamp: z.string().max(5000), + }) + +export const s_payment_intent_next_action_wechat_pay_redirect_to_ios_app = + z.object({ native_url: z.string().max(5000) }) + +export const s_payment_intent_payment_method_options_au_becs_debit = z.object({ + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + target_date: z.string().max(5000).optional(), +}) + +export const s_payment_intent_payment_method_options_blik = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_intent_payment_method_options_eps = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_intent_payment_method_options_link = z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_intent_payment_method_options_mandate_options_acss_debit = + z.object({ + custom_mandate_url: z.string().max(5000).optional(), + interval_description: z.string().max(5000).nullable().optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .nullable() + .optional(), + transaction_type: z.enum(["business", "personal"]).nullable().optional(), + }) + +export const s_payment_intent_payment_method_options_mandate_options_bacs_debit = + z.object({ reference_prefix: z.string().max(5000).optional() }) + +export const s_payment_intent_payment_method_options_mandate_options_sepa_debit = + z.object({ reference_prefix: z.string().max(5000).optional() }) + +export const s_payment_intent_payment_method_options_mobilepay = z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_intent_payment_method_options_nz_bank_account = z.object( + { + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + }, +) + +export const s_payment_intent_payment_method_options_swish = z.object({ + reference: z.string().max(35).nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_intent_processing_customer_notification = z.object({ + approval_requested: PermissiveBoolean.nullable().optional(), + completes_at: z.coerce.number().nullable().optional(), +}) + +export const s_payment_links_resource_completed_sessions = z.object({ + count: z.coerce.number(), + limit: z.coerce.number(), +}) + +export const s_payment_links_resource_completion_behavior_confirmation_page = + z.object({ custom_message: z.string().max(5000).nullable().optional() }) + +export const s_payment_links_resource_completion_behavior_redirect = z.object({ + url: z.string().max(5000), +}) + +export const s_payment_links_resource_custom_fields_dropdown_option = z.object({ + label: z.string().max(5000), + value: z.string().max(5000), +}) + +export const s_payment_links_resource_custom_fields_label = z.object({ + custom: z.string().max(5000).nullable().optional(), + type: z.enum(["custom"]), +}) + +export const s_payment_links_resource_custom_fields_numeric = z.object({ + default_value: z.string().max(5000).nullable().optional(), + maximum_length: z.coerce.number().nullable().optional(), + minimum_length: z.coerce.number().nullable().optional(), +}) + +export const s_payment_links_resource_custom_fields_text = z.object({ + default_value: z.string().max(5000).nullable().optional(), + maximum_length: z.coerce.number().nullable().optional(), + minimum_length: z.coerce.number().nullable().optional(), +}) + +export const s_payment_links_resource_custom_text_position = z.object({ + message: z.string().max(500), +}) + +export const s_payment_links_resource_optional_item_adjustable_quantity = + z.object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().nullable().optional(), + minimum: z.coerce.number().nullable().optional(), + }) + +export const s_payment_links_resource_payment_intent_data = z.object({ + capture_method: z + .enum(["automatic", "automatic_async", "manual"]) + .nullable() + .optional(), + description: z.string().max(5000).nullable().optional(), + metadata: z.record(z.string().max(500)), + setup_future_usage: z + .enum(["off_session", "on_session"]) + .nullable() + .optional(), + statement_descriptor: z.string().max(5000).nullable().optional(), + statement_descriptor_suffix: z.string().max(5000).nullable().optional(), + transfer_group: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_links_resource_payment_method_reuse_agreement = z.object( + { position: z.enum(["auto", "hidden"]) }, +) + +export const s_payment_links_resource_phone_number_collection = z.object({ + enabled: PermissiveBoolean, +}) + +export const s_payment_links_resource_shipping_address_collection = z.object({ + allowed_countries: z.array( + z.enum([ + "AC", + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MK", + "ML", + "MM", + "MN", + "MO", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TA", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + "ZZ", + ]), + ), +}) + +export const s_payment_links_resource_tax_id_collection = z.object({ + enabled: PermissiveBoolean, + required: z.enum(["if_supported", "never"]), +}) + +export const s_payment_method_acss_debit = z.object({ + bank_name: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + institution_number: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + transit_number: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_affirm = z.object({}) + +export const s_payment_method_afterpay_clearpay = z.object({}) + +export const s_payment_method_alma = z.object({}) + +export const s_payment_method_amazon_pay = z.object({}) + +export const s_payment_method_au_becs_debit = z.object({ + bsb_number: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_bacs_debit = z.object({ + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + sort_code: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_bancontact = z.object({}) + +export const s_payment_method_billie = z.object({}) + +export const s_payment_method_blik = z.object({}) + +export const s_payment_method_boleto = z.object({ + tax_id: z.string().max(5000), +}) + +export const s_payment_method_card_checks = z.object({ + address_line1_check: z.string().max(5000).nullable().optional(), + address_postal_code_check: z.string().max(5000).nullable().optional(), + cvc_check: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_card_present_networks = z.object({ + available: z.array(z.string().max(5000)), + preferred: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_card_wallet_amex_express_checkout = z.object({}) + +export const s_payment_method_card_wallet_apple_pay = z.object({}) + +export const s_payment_method_card_wallet_google_pay = z.object({}) + +export const s_payment_method_card_wallet_link = z.object({}) + +export const s_payment_method_card_wallet_samsung_pay = z.object({}) + +export const s_payment_method_cashapp = z.object({ + buyer_id: z.string().max(5000).nullable().optional(), + cashtag: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_config_biz_payment_method_configuration_details = + z.object({ + id: z.string().max(5000), + parent: z.string().max(5000).nullable().optional(), + }) + +export const s_payment_method_config_resource_display_preference = z.object({ + overridable: PermissiveBoolean.nullable().optional(), + preference: z.enum(["none", "off", "on"]), + value: z.enum(["off", "on"]), +}) + +export const s_payment_method_customer_balance = z.object({}) + +export const s_payment_method_details_ach_credit_transfer = z.object({ + account_number: z.string().max(5000).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + routing_number: z.string().max(5000).nullable().optional(), + swift_code: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_ach_debit = z.object({ + account_holder_type: z.enum(["company", "individual"]).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + routing_number: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_acss_debit = z.object({ + bank_name: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + institution_number: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.string().max(5000).optional(), + transit_number: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_affirm = z.object({ + transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_afterpay_clearpay = z.object({ + order_id: z.string().max(5000).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_alma = z.object({}) + +export const s_payment_method_details_au_becs_debit = z.object({ + bsb_number: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.string().max(5000).optional(), +}) + +export const s_payment_method_details_bacs_debit = z.object({ + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.string().max(5000).nullable().optional(), + sort_code: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_billie = z.object({}) + +export const s_payment_method_details_blik = z.object({ + buyer_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_boleto = z.object({ + tax_id: z.string().max(5000), +}) + +export const s_payment_method_details_card_checks = z.object({ + address_line1_check: z.string().max(5000).nullable().optional(), + address_postal_code_check: z.string().max(5000).nullable().optional(), + cvc_check: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_card_installments_plan = z.object({ + count: z.coerce.number().nullable().optional(), + interval: z.enum(["month"]).nullable().optional(), + type: z.enum(["fixed_count"]), +}) + +export const s_payment_method_details_card_network_token = z.object({ + used: PermissiveBoolean, +}) + +export const s_payment_method_details_card_present_offline = z.object({ + stored_at: z.coerce.number().nullable().optional(), + type: z.enum(["deferred"]).nullable().optional(), +}) + +export const s_payment_method_details_card_present_receipt = z.object({ + account_type: z.enum(["checking", "credit", "prepaid", "unknown"]).optional(), + application_cryptogram: z.string().max(5000).nullable().optional(), + application_preferred_name: z.string().max(5000).nullable().optional(), + authorization_code: z.string().max(5000).nullable().optional(), + authorization_response_code: z.string().max(5000).nullable().optional(), + cardholder_verification_method: z.string().max(5000).nullable().optional(), + dedicated_file_name: z.string().max(5000).nullable().optional(), + terminal_verification_results: z.string().max(5000).nullable().optional(), + transaction_status_information: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_card_wallet_amex_express_checkout = + z.object({}) + +export const s_payment_method_details_card_wallet_apple_pay = z.object({}) + +export const s_payment_method_details_card_wallet_google_pay = z.object({}) + +export const s_payment_method_details_card_wallet_link = z.object({}) + +export const s_payment_method_details_card_wallet_samsung_pay = z.object({}) + +export const s_payment_method_details_cashapp = z.object({ + buyer_id: z.string().max(5000).nullable().optional(), + cashtag: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_customer_balance = z.object({}) + +export const s_payment_method_details_eps = z.object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .nullable() + .optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_fpx = z.object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), + transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_giropay = z.object({ + bank_code: z.string().max(5000).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + bic: z.string().max(5000).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_grabpay = z.object({ + transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_interac_present_receipt = z.object({ + account_type: z.enum(["checking", "savings", "unknown"]).optional(), + application_cryptogram: z.string().max(5000).nullable().optional(), + application_preferred_name: z.string().max(5000).nullable().optional(), + authorization_code: z.string().max(5000).nullable().optional(), + authorization_response_code: z.string().max(5000).nullable().optional(), + cardholder_verification_method: z.string().max(5000).nullable().optional(), + dedicated_file_name: z.string().max(5000).nullable().optional(), + terminal_verification_results: z.string().max(5000).nullable().optional(), + transaction_status_information: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_kakao_pay = z.object({ + buyer_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_konbini_store = z.object({ + chain: z + .enum(["familymart", "lawson", "ministop", "seicomart"]) + .nullable() + .optional(), +}) + +export const s_payment_method_details_kr_card = z.object({ + brand: z + .enum([ + "bc", + "citi", + "hana", + "hyundai", + "jeju", + "jeonbuk", + "kakaobank", + "kbank", + "kdbbank", + "kookmin", + "kwangju", + "lotte", + "mg", + "nh", + "post", + "samsung", + "savingsbank", + "shinhan", + "shinhyup", + "suhyup", + "tossbank", + "woori", + ]) + .nullable() + .optional(), + buyer_id: z.string().max(5000).nullable().optional(), + last4: z.string().max(4).nullable().optional(), +}) + +export const s_payment_method_details_link = z.object({ + country: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_multibanco = z.object({ + entity: z.string().max(5000).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_naver_pay = z.object({ + buyer_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_nz_bank_account = z.object({ + account_holder_name: z.string().max(5000).nullable().optional(), + bank_code: z.string().max(5000), + bank_name: z.string().max(5000), + branch_code: z.string().max(5000), + last4: z.string().max(5000), + suffix: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_oxxo = z.object({ + number: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_p24 = z.object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .nullable() + .optional(), + reference: z.string().max(5000).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_passthrough_card = z.object({ + brand: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number().nullable().optional(), + exp_year: z.coerce.number().nullable().optional(), + funding: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_pay_by_bank = z.object({}) + +export const s_payment_method_details_payco = z.object({ + buyer_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_paynow = z.object({ + reference: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_pix = z.object({ + bank_transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_promptpay = z.object({ + reference: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_samsung_pay = z.object({ + buyer_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_satispay = z.object({}) + +export const s_payment_method_details_sepa_debit = z.object({ + bank_code: z.string().max(5000).nullable().optional(), + branch_code: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_stripe_account = z.object({}) + +export const s_payment_method_details_swish = z.object({ + fingerprint: z.string().max(5000).nullable().optional(), + payment_reference: z.string().max(5000).nullable().optional(), + verified_phone_last4: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_twint = z.object({}) + +export const s_payment_method_details_wechat = z.object({}) + +export const s_payment_method_details_wechat_pay = z.object({ + fingerprint: z.string().max(5000).nullable().optional(), + transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_zip = z.object({}) + +export const s_payment_method_domain_resource_payment_method_status_details = + z.object({ error_message: z.string().max(5000) }) + +export const s_payment_method_eps = z.object({ + bank: z + .enum([ + "arzte_und_apotheker_bank", + "austrian_anadi_bank_ag", + "bank_austria", + "bankhaus_carl_spangler", + "bankhaus_schelhammer_und_schattera_ag", + "bawag_psk_ag", + "bks_bank_ag", + "brull_kallmus_bank_ag", + "btv_vier_lander_bank", + "capital_bank_grawe_gruppe_ag", + "deutsche_bank_ag", + "dolomitenbank", + "easybank_ag", + "erste_bank_und_sparkassen", + "hypo_alpeadriabank_international_ag", + "hypo_bank_burgenland_aktiengesellschaft", + "hypo_noe_lb_fur_niederosterreich_u_wien", + "hypo_oberosterreich_salzburg_steiermark", + "hypo_tirol_bank_ag", + "hypo_vorarlberg_bank_ag", + "marchfelder_bank", + "oberbank_ag", + "raiffeisen_bankengruppe_osterreich", + "schoellerbank_ag", + "sparda_bank_wien", + "volksbank_gruppe", + "volkskreditbank_ag", + "vr_bank_braunau", + ]) + .nullable() + .optional(), +}) + +export const s_payment_method_fpx = z.object({ + bank: z.enum([ + "affin_bank", + "agrobank", + "alliance_bank", + "ambank", + "bank_islam", + "bank_muamalat", + "bank_of_china", + "bank_rakyat", + "bsn", + "cimb", + "deutsche_bank", + "hong_leong_bank", + "hsbc", + "kfh", + "maybank2e", + "maybank2u", + "ocbc", + "pb_enterprise", + "public_bank", + "rhb", + "standard_chartered", + "uob", + ]), +}) + +export const s_payment_method_giropay = z.object({}) + +export const s_payment_method_grabpay = z.object({}) + +export const s_payment_method_ideal = z.object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .nullable() + .optional(), + bic: z + .enum([ + "ABNANL2A", + "ASNBNL21", + "BITSNL2A", + "BUNQNL2A", + "FVLBNL22", + "HANDNL2A", + "INGBNL2A", + "KNABNL2H", + "MOYONL21", + "NNBANL2G", + "NTSBDEB1", + "RABONL2U", + "RBRBNL21", + "REVOIE23", + "REVOLT21", + "SNSBNL2A", + "TRIONL2U", + ]) + .nullable() + .optional(), +}) + +export const s_payment_method_kakao_pay = z.object({}) + +export const s_payment_method_konbini = z.object({}) + +export const s_payment_method_kr_card = z.object({ + brand: z + .enum([ + "bc", + "citi", + "hana", + "hyundai", + "jeju", + "jeonbuk", + "kakaobank", + "kbank", + "kdbbank", + "kookmin", + "kwangju", + "lotte", + "mg", + "nh", + "post", + "samsung", + "savingsbank", + "shinhan", + "shinhyup", + "suhyup", + "tossbank", + "woori", + ]) + .nullable() + .optional(), + last4: z.string().max(4).nullable().optional(), +}) + +export const s_payment_method_link = z.object({ + email: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_mobilepay = z.object({}) + +export const s_payment_method_multibanco = z.object({}) + +export const s_payment_method_naver_pay = z.object({ + buyer_id: z.string().max(5000).nullable().optional(), + funding: z.enum(["card", "points"]), +}) + +export const s_payment_method_nz_bank_account = z.object({ + account_holder_name: z.string().max(5000).nullable().optional(), + bank_code: z.string().max(5000), + bank_name: z.string().max(5000), + branch_code: z.string().max(5000), + last4: z.string().max(5000), + suffix: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_options_affirm = z.object({ + capture_method: z.enum(["manual"]).optional(), + preferred_locale: z.string().max(30).optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_afterpay_clearpay = z.object({ + capture_method: z.enum(["manual"]).optional(), + reference: z.string().max(5000).nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_alipay = z.object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_method_options_alma = z.object({ + capture_method: z.enum(["manual"]).optional(), +}) + +export const s_payment_method_options_amazon_pay = z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_method_options_bancontact = z.object({ + preferred_language: z.enum(["de", "en", "fr", "nl"]), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_method_options_boleto = z.object({ + expires_after_days: z.coerce.number(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), +}) + +export const s_payment_method_options_card_mandate_options = z.object({ + amount: z.coerce.number(), + amount_type: z.enum(["fixed", "maximum"]), + description: z.string().max(200).nullable().optional(), + end_date: z.coerce.number().nullable().optional(), + interval: z.enum(["day", "month", "sporadic", "week", "year"]), + interval_count: z.coerce.number().nullable().optional(), + reference: z.string().max(80), + start_date: z.coerce.number(), + supported_types: z + .array(z.enum(["india"])) + .nullable() + .optional(), +}) + +export const s_payment_method_options_card_present_routing = z.object({ + requested_priority: z + .enum(["domestic", "international"]) + .nullable() + .optional(), +}) + +export const s_payment_method_options_cashapp = z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), +}) + +export const s_payment_method_options_customer_balance_eu_bank_account = + z.object({ country: z.enum(["BE", "DE", "ES", "FR", "IE", "NL"]) }) + +export const s_payment_method_options_fpx = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_giropay = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_grabpay = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_ideal = z.object({ + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_method_options_interac_present = z.object({}) + +export const s_payment_method_options_klarna = z.object({ + capture_method: z.enum(["manual"]).optional(), + preferred_locale: z.string().max(5000).nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_konbini = z.object({ + confirmation_number: z.string().max(5000).nullable().optional(), + expires_after_days: z.coerce.number().nullable().optional(), + expires_at: z.coerce.number().nullable().optional(), + product_description: z.string().max(5000).nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_kr_card = z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_method_options_multibanco = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_oxxo = z.object({ + expires_after_days: z.coerce.number(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_p24 = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_pay_by_bank = z.object({}) + +export const s_payment_method_options_paynow = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_paypal = z.object({ + capture_method: z.enum(["manual"]).optional(), + preferred_locale: z.string().max(5000).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_method_options_pix = z.object({ + expires_after_seconds: z.coerce.number().nullable().optional(), + expires_at: z.coerce.number().nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_promptpay = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_revolut_pay = z.object({ + capture_method: z.enum(["manual"]).optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_method_options_sofort = z.object({ + preferred_language: z + .enum(["de", "en", "es", "fr", "it", "nl", "pl"]) + .nullable() + .optional(), + setup_future_usage: z.enum(["none", "off_session"]).optional(), +}) + +export const s_payment_method_options_twint = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_us_bank_account_mandate_options = + z.object({ collection_method: z.enum(["paper"]).optional() }) + +export const s_payment_method_options_wechat_pay = z.object({ + app_id: z.string().max(5000).nullable().optional(), + client: z.enum(["android", "ios", "web"]).nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_options_zip = z.object({ + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_oxxo = z.object({}) + +export const s_payment_method_p24 = z.object({ + bank: z + .enum([ + "alior_bank", + "bank_millennium", + "bank_nowy_bfg_sa", + "bank_pekao_sa", + "banki_spbdzielcze", + "blik", + "bnp_paribas", + "boz", + "citi_handlowy", + "credit_agricole", + "envelobank", + "etransfer_pocztowy24", + "getin_bank", + "ideabank", + "ing", + "inteligo", + "mbank_mtransfer", + "nest_przelew", + "noble_pay", + "pbac_z_ipko", + "plus_bank", + "santander_przelew24", + "tmobile_usbugi_bankowe", + "toyota_bank", + "velobank", + "volkswagen_bank", + ]) + .nullable() + .optional(), +}) + +export const s_payment_method_pay_by_bank = z.object({}) + +export const s_payment_method_payco = z.object({}) + +export const s_payment_method_paynow = z.object({}) + +export const s_payment_method_paypal = z.object({ + country: z.string().max(5000).nullable().optional(), + payer_email: z.string().max(5000).nullable().optional(), + payer_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_pix = z.object({}) + +export const s_payment_method_promptpay = z.object({}) + +export const s_payment_method_revolut_pay = z.object({}) + +export const s_payment_method_samsung_pay = z.object({}) + +export const s_payment_method_satispay = z.object({}) + +export const s_payment_method_sofort = z.object({ + country: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_swish = z.object({}) + +export const s_payment_method_twint = z.object({}) + +export const s_payment_method_us_bank_account_blocked = z.object({ + network_code: z + .enum([ + "R02", + "R03", + "R04", + "R05", + "R07", + "R08", + "R10", + "R11", + "R16", + "R20", + "R29", + "R31", + ]) + .nullable() + .optional(), + reason: z + .enum([ + "bank_account_closed", + "bank_account_frozen", + "bank_account_invalid_details", + "bank_account_restricted", + "bank_account_unusable", + "debit_not_authorized", + ]) + .nullable() + .optional(), +}) + +export const s_payment_method_wechat_pay = z.object({}) + +export const s_payment_method_zip = z.object({}) + +export const s_payment_pages_checkout_session_adaptive_pricing = z.object({ + enabled: PermissiveBoolean, +}) + +export const s_payment_pages_checkout_session_after_expiration_recovery = + z.object({ + allow_promotion_codes: PermissiveBoolean, + enabled: PermissiveBoolean, + expires_at: z.coerce.number().nullable().optional(), + url: z.string().max(5000).nullable().optional(), + }) + +export const s_payment_pages_checkout_session_consent = z.object({ + promotions: z.enum(["opt_in", "opt_out"]).nullable().optional(), + terms_of_service: z.enum(["accepted"]).nullable().optional(), +}) + +export const s_payment_pages_checkout_session_currency_conversion = z.object({ + amount_subtotal: z.coerce.number(), + amount_total: z.coerce.number(), + fx_rate: z.string(), + source_currency: z.string().max(5000), +}) + +export const s_payment_pages_checkout_session_custom_fields_label = z.object({ + custom: z.string().max(5000).nullable().optional(), + type: z.enum(["custom"]), +}) + +export const s_payment_pages_checkout_session_custom_fields_numeric = z.object({ + default_value: z.string().max(5000).nullable().optional(), + maximum_length: z.coerce.number().nullable().optional(), + minimum_length: z.coerce.number().nullable().optional(), + value: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_pages_checkout_session_custom_fields_option = z.object({ + label: z.string().max(5000), + value: z.string().max(5000), +}) + +export const s_payment_pages_checkout_session_custom_fields_text = z.object({ + default_value: z.string().max(5000).nullable().optional(), + maximum_length: z.coerce.number().nullable().optional(), + minimum_length: z.coerce.number().nullable().optional(), + value: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_pages_checkout_session_custom_text_position = z.object({ + message: z.string().max(500), +}) + +export const s_payment_pages_checkout_session_optional_item_adjustable_quantity = + z.object({ + enabled: PermissiveBoolean, + maximum: z.coerce.number().nullable().optional(), + minimum: z.coerce.number().nullable().optional(), + }) + +export const s_payment_pages_checkout_session_payment_method_reuse_agreement = + z.object({ position: z.enum(["auto", "hidden"]) }) + +export const s_payment_pages_checkout_session_permissions = z.object({ + update_shipping_details: z + .enum(["client_only", "server_only"]) + .nullable() + .optional(), +}) + +export const s_payment_pages_checkout_session_phone_number_collection = + z.object({ enabled: PermissiveBoolean }) + +export const s_payment_pages_checkout_session_saved_payment_method_options = + z.object({ + allow_redisplay_filters: z + .array(z.enum(["always", "limited", "unspecified"])) + .nullable() + .optional(), + payment_method_remove: z + .enum(["disabled", "enabled"]) + .nullable() + .optional(), + payment_method_save: z.enum(["disabled", "enabled"]).nullable().optional(), + }) + +export const s_payment_pages_checkout_session_shipping_address_collection = + z.object({ + allowed_countries: z.array( + z.enum([ + "AC", + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MK", + "ML", + "MM", + "MN", + "MO", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TA", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VN", + "VU", + "WF", + "WS", + "XK", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + "ZZ", + ]), + ), + }) + +export const s_payment_pages_checkout_session_tax_id = z.object({ + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "unknown", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_pages_checkout_session_tax_id_collection = z.object({ + enabled: PermissiveBoolean, + required: z.enum(["if_supported", "never"]), +}) + +export const s_payment_pages_private_card_payment_method_options_resource_restrictions = + z.object({ + brands_blocked: z + .array( + z.enum([ + "american_express", + "discover_global_network", + "mastercard", + "visa", + ]), + ) + .optional(), + }) + +export const s_payouts_trace_id = z.object({ + status: z.string().max(5000), + value: z.string().max(5000).nullable().optional(), +}) + +export const s_paypal_seller_protection = z.object({ + dispute_categories: z + .array(z.enum(["fraudulent", "product_not_received"])) + .nullable() + .optional(), + status: z.enum(["eligible", "not_eligible", "partially_eligible"]), +}) + +export const s_person_additional_tos_acceptance = z.object({ + date: z.coerce.number().nullable().optional(), + ip: z.string().max(5000).nullable().optional(), + user_agent: z.string().max(5000).nullable().optional(), +}) + +export const s_person_relationship = z.object({ + authorizer: PermissiveBoolean.nullable().optional(), + director: PermissiveBoolean.nullable().optional(), + executive: PermissiveBoolean.nullable().optional(), + legal_guardian: PermissiveBoolean.nullable().optional(), + owner: PermissiveBoolean.nullable().optional(), + percent_ownership: z.coerce.number().nullable().optional(), + representative: PermissiveBoolean.nullable().optional(), + title: z.string().max(5000).nullable().optional(), +}) + +export const s_plan_tier = z.object({ + flat_amount: z.coerce.number().nullable().optional(), + flat_amount_decimal: z.string().nullable().optional(), + unit_amount: z.coerce.number().nullable().optional(), + unit_amount_decimal: z.string().nullable().optional(), + up_to: z.coerce.number().nullable().optional(), +}) + +export const s_platform_earning_fee_source = z.object({ + charge: z.string().max(5000).optional(), + payout: z.string().max(5000).optional(), + type: z.enum(["charge", "payout"]), +}) + +export const s_portal_business_profile = z.object({ + headline: z.string().max(5000).nullable().optional(), + privacy_policy_url: z.string().max(5000).nullable().optional(), + terms_of_service_url: z.string().max(5000).nullable().optional(), +}) + +export const s_portal_customer_update = z.object({ + allowed_updates: z.array( + z.enum(["address", "email", "name", "phone", "shipping", "tax_id"]), + ), + enabled: PermissiveBoolean, +}) + +export const s_portal_flows_after_completion_hosted_confirmation = z.object({ + custom_message: z.string().max(5000).nullable().optional(), +}) + +export const s_portal_flows_after_completion_redirect = z.object({ + return_url: z.string().max(5000), +}) + +export const s_portal_flows_coupon_offer = z.object({ + coupon: z.string().max(5000), +}) + +export const s_portal_flows_flow_subscription_update = z.object({ + subscription: z.string().max(5000), +}) + +export const s_portal_flows_subscription_update_confirm_discount = z.object({ + coupon: z.string().max(5000).nullable().optional(), + promotion_code: z.string().max(5000).nullable().optional(), +}) + +export const s_portal_flows_subscription_update_confirm_item = z.object({ + id: z.string().max(5000).nullable().optional(), + price: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number().optional(), +}) + +export const s_portal_invoice_list = z.object({ enabled: PermissiveBoolean }) + +export const s_portal_login_page = z.object({ + enabled: PermissiveBoolean, + url: z.string().max(5000).nullable().optional(), +}) + +export const s_portal_payment_method_update = z.object({ + enabled: PermissiveBoolean, +}) + +export const s_portal_resource_schedule_update_at_period_end_condition = + z.object({ type: z.enum(["decreasing_item_amount", "shortening_interval"]) }) + +export const s_portal_subscription_cancellation_reason = z.object({ + enabled: PermissiveBoolean, + options: z.array( + z.enum([ + "customer_service", + "low_quality", + "missing_features", + "other", + "switched_service", + "too_complex", + "too_expensive", + "unused", + ]), + ), +}) + +export const s_portal_subscription_update_product = z.object({ + prices: z.array(z.string().max(5000)), + product: z.string().max(5000), +}) + +export const s_price_tier = z.object({ + flat_amount: z.coerce.number().nullable().optional(), + flat_amount_decimal: z.string().nullable().optional(), + unit_amount: z.coerce.number().nullable().optional(), + unit_amount_decimal: z.string().nullable().optional(), + up_to: z.coerce.number().nullable().optional(), +}) + +export const s_product_marketing_feature = z.object({ + name: z.string().max(5000).optional(), +}) + +export const s_promotion_code_currency_option = z.object({ + minimum_amount: z.coerce.number(), +}) + +export const s_quotes_resource_status_transitions = z.object({ + accepted_at: z.coerce.number().nullable().optional(), + canceled_at: z.coerce.number().nullable().optional(), + finalized_at: z.coerce.number().nullable().optional(), +}) + +export const s_quotes_resource_subscription_data_subscription_data = z.object({ + description: z.string().max(5000).nullable().optional(), + effective_date: z.coerce.number().nullable().optional(), + metadata: z.record(z.string().max(500)).nullable().optional(), + trial_period_days: z.coerce.number().nullable().optional(), +}) + +export const s_radar_radar_options = z.object({ + session: z.string().max(5000).optional(), +}) + +export const s_radar_review_resource_location = z.object({ + city: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + latitude: z.coerce.number().nullable().optional(), + longitude: z.coerce.number().nullable().optional(), + region: z.string().max(5000).nullable().optional(), +}) + +export const s_radar_review_resource_session = z.object({ + browser: z.string().max(5000).nullable().optional(), + device: z.string().max(5000).nullable().optional(), + platform: z.string().max(5000).nullable().optional(), + version: z.string().max(5000).nullable().optional(), +}) + +export const s_radar_value_list_item = z.object({ + created: z.coerce.number(), + created_by: z.string().max(5000), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["radar.value_list_item"]), + value: z.string().max(5000), + value_list: z.string().max(5000), +}) + +export const s_received_payment_method_details_financial_account = z.object({ + id: z.string().max(5000), + network: z.enum(["stripe"]), +}) + +export const s_recurring = z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number(), + meter: z.string().max(5000).nullable().optional(), + usage_type: z.enum(["licensed", "metered"]), +}) + +export const s_refund_destination_details_blik = z.object({ + network_decline_code: z.string().max(5000).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_br_bank_transfer = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_card = z.object({ + reference: z.string().max(5000).optional(), + reference_status: z.string().max(5000).optional(), + reference_type: z.string().max(5000).optional(), + type: z.enum(["pending", "refund", "reversal"]), +}) + +export const s_refund_destination_details_eu_bank_transfer = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_gb_bank_transfer = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_jp_bank_transfer = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_multibanco = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_mx_bank_transfer = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_p24 = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_swish = z.object({ + network_decline_code: z.string().max(5000).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_th_bank_transfer = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_refund_destination_details_us_bank_transfer = z.object({ + reference: z.string().max(5000).nullable().optional(), + reference_status: z.string().max(5000).nullable().optional(), +}) + +export const s_reporting_report_type = z.object({ + data_available_end: z.coerce.number(), + data_available_start: z.coerce.number(), + default_columns: z.array(z.string().max(5000)).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.enum(["reporting.report_type"]), + updated: z.coerce.number(), + version: z.coerce.number(), +}) + +export const s_reserve_transaction = z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + object: z.enum(["reserve_transaction"]), +}) + +export const s_rule = z.object({ + action: z.string().max(5000), + id: z.string().max(5000), + predicate: z.string().max(5000), +}) + +export const s_secret_service_resource_scope = z.object({ + type: z.enum(["account", "user"]), + user: z.string().max(5000).optional(), +}) + +export const s_setup_attempt_payment_method_details_acss_debit = z.object({}) + +export const s_setup_attempt_payment_method_details_amazon_pay = z.object({}) + +export const s_setup_attempt_payment_method_details_au_becs_debit = z.object({}) + +export const s_setup_attempt_payment_method_details_bacs_debit = z.object({}) + +export const s_setup_attempt_payment_method_details_boleto = z.object({}) + +export const s_setup_attempt_payment_method_details_card_checks = z.object({ + address_line1_check: z.string().max(5000).nullable().optional(), + address_postal_code_check: z.string().max(5000).nullable().optional(), + cvc_check: z.string().max(5000).nullable().optional(), +}) + +export const s_setup_attempt_payment_method_details_cashapp = z.object({}) + +export const s_setup_attempt_payment_method_details_kakao_pay = z.object({}) + +export const s_setup_attempt_payment_method_details_klarna = z.object({}) + +export const s_setup_attempt_payment_method_details_kr_card = z.object({}) + +export const s_setup_attempt_payment_method_details_link = z.object({}) + +export const s_setup_attempt_payment_method_details_naver_pay = z.object({ + buyer_id: z.string().max(5000).optional(), +}) + +export const s_setup_attempt_payment_method_details_nz_bank_account = z.object( + {}, +) + +export const s_setup_attempt_payment_method_details_paypal = z.object({}) + +export const s_setup_attempt_payment_method_details_revolut_pay = z.object({}) + +export const s_setup_attempt_payment_method_details_sepa_debit = z.object({}) + +export const s_setup_attempt_payment_method_details_us_bank_account = z.object( + {}, +) + +export const s_setup_intent_next_action_redirect_to_url = z.object({ + return_url: z.string().max(5000).nullable().optional(), + url: z.string().max(5000).nullable().optional(), +}) + +export const s_setup_intent_next_action_verify_with_microdeposits = z.object({ + arrival_date: z.coerce.number(), + hosted_verification_url: z.string().max(5000), + microdeposit_type: z + .enum(["amounts", "descriptor_code"]) + .nullable() + .optional(), +}) + +export const s_setup_intent_payment_method_options_amazon_pay = z.object({}) + +export const s_setup_intent_payment_method_options_card_mandate_options = + z.object({ + amount: z.coerce.number(), + amount_type: z.enum(["fixed", "maximum"]), + currency: z.string(), + description: z.string().max(200).nullable().optional(), + end_date: z.coerce.number().nullable().optional(), + interval: z.enum(["day", "month", "sporadic", "week", "year"]), + interval_count: z.coerce.number().nullable().optional(), + reference: z.string().max(80), + start_date: z.coerce.number(), + supported_types: z + .array(z.enum(["india"])) + .nullable() + .optional(), + }) + +export const s_setup_intent_payment_method_options_card_present = z.object({}) + +export const s_setup_intent_payment_method_options_link = z.object({}) + +export const s_setup_intent_payment_method_options_mandate_options_acss_debit = + z.object({ + custom_mandate_url: z.string().max(5000).optional(), + default_for: z.array(z.enum(["invoice", "subscription"])).optional(), + interval_description: z.string().max(5000).nullable().optional(), + payment_schedule: z + .enum(["combined", "interval", "sporadic"]) + .nullable() + .optional(), + transaction_type: z.enum(["business", "personal"]).nullable().optional(), + }) + +export const s_setup_intent_payment_method_options_mandate_options_bacs_debit = + z.object({ reference_prefix: z.string().max(5000).optional() }) + +export const s_setup_intent_payment_method_options_mandate_options_sepa_debit = + z.object({ reference_prefix: z.string().max(5000).optional() }) + +export const s_setup_intent_payment_method_options_paypal = z.object({ + billing_agreement_id: z.string().max(5000).nullable().optional(), +}) + +export const s_setup_intent_type_specific_payment_method_options_client = + z.object({ + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + +export const s_shipping_rate_currency_option = z.object({ + amount: z.coerce.number(), + tax_behavior: z.enum(["exclusive", "inclusive", "unspecified"]), +}) + +export const s_shipping_rate_delivery_estimate_bound = z.object({ + unit: z.enum(["business_day", "day", "hour", "month", "week"]), + value: z.coerce.number(), +}) + +export const s_sigma_scheduled_query_run_error = z.object({ + message: z.string().max(5000), +}) + +export const s_sigma_sigma_api_query = z.object({ + created: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.enum(["sigma.sigma_api_query"]), + sql: z.string().max(5000), +}) + +export const s_source_code_verification_flow = z.object({ + attempts_remaining: z.coerce.number(), + status: z.string().max(5000), +}) + +export const s_source_mandate_notification_acss_debit_data = z.object({ + statement_descriptor: z.string().max(5000).optional(), +}) + +export const s_source_mandate_notification_bacs_debit_data = z.object({ + last4: z.string().max(5000).optional(), +}) + +export const s_source_mandate_notification_sepa_debit_data = z.object({ + creditor_identifier: z.string().max(5000).optional(), + last4: z.string().max(5000).optional(), + mandate_reference: z.string().max(5000).optional(), +}) + +export const s_source_order_item = z.object({ + amount: z.coerce.number().nullable().optional(), + currency: z.string().max(5000).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + parent: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number().optional(), + type: z.string().max(5000).nullable().optional(), +}) + +export const s_source_receiver_flow = z.object({ + address: z.string().max(5000).nullable().optional(), + amount_charged: z.coerce.number(), + amount_received: z.coerce.number(), + amount_returned: z.coerce.number(), + refund_attributes_method: z.string().max(5000), + refund_attributes_status: z.string().max(5000), +}) + +export const s_source_redirect_flow = z.object({ + failure_reason: z.string().max(5000).nullable().optional(), + return_url: z.string().max(5000), + status: z.string().max(5000), + url: z.string().max(2048), +}) + +export const s_source_transaction_ach_credit_transfer_data = z.object({ + customer_data: z.string().max(5000).optional(), + fingerprint: z.string().max(5000).optional(), + last4: z.string().max(5000).optional(), + routing_number: z.string().max(5000).optional(), +}) + +export const s_source_transaction_chf_credit_transfer_data = z.object({ + reference: z.string().max(5000).optional(), + sender_address_country: z.string().max(5000).optional(), + sender_address_line1: z.string().max(5000).optional(), + sender_iban: z.string().max(5000).optional(), + sender_name: z.string().max(5000).optional(), +}) + +export const s_source_transaction_gbp_credit_transfer_data = z.object({ + fingerprint: z.string().max(5000).optional(), + funding_method: z.string().max(5000).optional(), + last4: z.string().max(5000).optional(), + reference: z.string().max(5000).optional(), + sender_account_number: z.string().max(5000).optional(), + sender_name: z.string().max(5000).optional(), + sender_sort_code: z.string().max(5000).optional(), +}) + +export const s_source_transaction_paper_check_data = z.object({ + available_at: z.string().max(5000).optional(), + invoices: z.string().max(5000).optional(), +}) + +export const s_source_transaction_sepa_credit_transfer_data = z.object({ + reference: z.string().max(5000).optional(), + sender_iban: z.string().max(5000).optional(), + sender_name: z.string().max(5000).optional(), +}) + +export const s_source_type_ach_credit_transfer = z.object({ + account_number: z.string().nullable().optional(), + bank_name: z.string().nullable().optional(), + fingerprint: z.string().nullable().optional(), + refund_account_holder_name: z.string().nullable().optional(), + refund_account_holder_type: z.string().nullable().optional(), + refund_routing_number: z.string().nullable().optional(), + routing_number: z.string().nullable().optional(), + swift_code: z.string().nullable().optional(), +}) + +export const s_source_type_ach_debit = z.object({ + bank_name: z.string().nullable().optional(), + country: z.string().nullable().optional(), + fingerprint: z.string().nullable().optional(), + last4: z.string().nullable().optional(), + routing_number: z.string().nullable().optional(), + type: z.string().nullable().optional(), +}) + +export const s_source_type_acss_debit = z.object({ + bank_address_city: z.string().nullable().optional(), + bank_address_line_1: z.string().nullable().optional(), + bank_address_line_2: z.string().nullable().optional(), + bank_address_postal_code: z.string().nullable().optional(), + bank_name: z.string().nullable().optional(), + category: z.string().nullable().optional(), + country: z.string().nullable().optional(), + fingerprint: z.string().nullable().optional(), + last4: z.string().nullable().optional(), + routing_number: z.string().nullable().optional(), +}) + +export const s_source_type_alipay = z.object({ + data_string: z.string().nullable().optional(), + native_url: z.string().nullable().optional(), + statement_descriptor: z.string().nullable().optional(), +}) + +export const s_source_type_au_becs_debit = z.object({ + bsb_number: z.string().nullable().optional(), + fingerprint: z.string().nullable().optional(), + last4: z.string().nullable().optional(), +}) + +export const s_source_type_bancontact = z.object({ + bank_code: z.string().nullable().optional(), + bank_name: z.string().nullable().optional(), + bic: z.string().nullable().optional(), + iban_last4: z.string().nullable().optional(), + preferred_language: z.string().nullable().optional(), + statement_descriptor: z.string().nullable().optional(), +}) + +export const s_source_type_card = z.object({ + address_line1_check: z.string().nullable().optional(), + address_zip_check: z.string().nullable().optional(), + brand: z.string().nullable().optional(), + country: z.string().nullable().optional(), + cvc_check: z.string().nullable().optional(), + dynamic_last4: z.string().nullable().optional(), + exp_month: z.coerce.number().nullable().optional(), + exp_year: z.coerce.number().nullable().optional(), + fingerprint: z.string().optional(), + funding: z.string().nullable().optional(), + last4: z.string().nullable().optional(), + name: z.string().nullable().optional(), + three_d_secure: z.string().optional(), + tokenization_method: z.string().nullable().optional(), +}) + +export const s_source_type_card_present = z.object({ + application_cryptogram: z.string().optional(), + application_preferred_name: z.string().optional(), + authorization_code: z.string().nullable().optional(), + authorization_response_code: z.string().optional(), + brand: z.string().nullable().optional(), + country: z.string().nullable().optional(), + cvm_type: z.string().optional(), + data_type: z.string().nullable().optional(), + dedicated_file_name: z.string().optional(), + emv_auth_data: z.string().optional(), + evidence_customer_signature: z.string().nullable().optional(), + evidence_transaction_certificate: z.string().nullable().optional(), + exp_month: z.coerce.number().nullable().optional(), + exp_year: z.coerce.number().nullable().optional(), + fingerprint: z.string().optional(), + funding: z.string().nullable().optional(), + last4: z.string().nullable().optional(), + pos_device_id: z.string().nullable().optional(), + pos_entry_mode: z.string().optional(), + read_method: z.string().nullable().optional(), + reader: z.string().nullable().optional(), + terminal_verification_results: z.string().optional(), + transaction_status_information: z.string().optional(), +}) + +export const s_source_type_eps = z.object({ + reference: z.string().nullable().optional(), + statement_descriptor: z.string().nullable().optional(), +}) + +export const s_source_type_giropay = z.object({ + bank_code: z.string().nullable().optional(), + bank_name: z.string().nullable().optional(), + bic: z.string().nullable().optional(), + statement_descriptor: z.string().nullable().optional(), +}) + +export const s_source_type_ideal = z.object({ + bank: z.string().nullable().optional(), + bic: z.string().nullable().optional(), + iban_last4: z.string().nullable().optional(), + statement_descriptor: z.string().nullable().optional(), +}) + +export const s_source_type_klarna = z.object({ + background_image_url: z.string().optional(), + client_token: z.string().nullable().optional(), + first_name: z.string().optional(), + last_name: z.string().optional(), + locale: z.string().optional(), + logo_url: z.string().optional(), + page_title: z.string().optional(), + pay_later_asset_urls_descriptive: z.string().optional(), + pay_later_asset_urls_standard: z.string().optional(), + pay_later_name: z.string().optional(), + pay_later_redirect_url: z.string().optional(), + pay_now_asset_urls_descriptive: z.string().optional(), + pay_now_asset_urls_standard: z.string().optional(), + pay_now_name: z.string().optional(), + pay_now_redirect_url: z.string().optional(), + pay_over_time_asset_urls_descriptive: z.string().optional(), + pay_over_time_asset_urls_standard: z.string().optional(), + pay_over_time_name: z.string().optional(), + pay_over_time_redirect_url: z.string().optional(), + payment_method_categories: z.string().optional(), + purchase_country: z.string().optional(), + purchase_type: z.string().optional(), + redirect_url: z.string().optional(), + shipping_delay: z.coerce.number().optional(), + shipping_first_name: z.string().optional(), + shipping_last_name: z.string().optional(), +}) + +export const s_source_type_multibanco = z.object({ + entity: z.string().nullable().optional(), + reference: z.string().nullable().optional(), + refund_account_holder_address_city: z.string().nullable().optional(), + refund_account_holder_address_country: z.string().nullable().optional(), + refund_account_holder_address_line1: z.string().nullable().optional(), + refund_account_holder_address_line2: z.string().nullable().optional(), + refund_account_holder_address_postal_code: z.string().nullable().optional(), + refund_account_holder_address_state: z.string().nullable().optional(), + refund_account_holder_name: z.string().nullable().optional(), + refund_iban: z.string().nullable().optional(), +}) + +export const s_source_type_p24 = z.object({ + reference: z.string().nullable().optional(), +}) + +export const s_source_type_sepa_debit = z.object({ + bank_code: z.string().nullable().optional(), + branch_code: z.string().nullable().optional(), + country: z.string().nullable().optional(), + fingerprint: z.string().nullable().optional(), + last4: z.string().nullable().optional(), + mandate_reference: z.string().nullable().optional(), + mandate_url: z.string().nullable().optional(), +}) + +export const s_source_type_sofort = z.object({ + bank_code: z.string().nullable().optional(), + bank_name: z.string().nullable().optional(), + bic: z.string().nullable().optional(), + country: z.string().nullable().optional(), + iban_last4: z.string().nullable().optional(), + preferred_language: z.string().nullable().optional(), + statement_descriptor: z.string().nullable().optional(), +}) + +export const s_source_type_three_d_secure = z.object({ + address_line1_check: z.string().nullable().optional(), + address_zip_check: z.string().nullable().optional(), + authenticated: PermissiveBoolean.nullable().optional(), + brand: z.string().nullable().optional(), + card: z.string().nullable().optional(), + country: z.string().nullable().optional(), + customer: z.string().nullable().optional(), + cvc_check: z.string().nullable().optional(), + dynamic_last4: z.string().nullable().optional(), + exp_month: z.coerce.number().nullable().optional(), + exp_year: z.coerce.number().nullable().optional(), + fingerprint: z.string().optional(), + funding: z.string().nullable().optional(), + last4: z.string().nullable().optional(), + name: z.string().nullable().optional(), + three_d_secure: z.string().optional(), + tokenization_method: z.string().nullable().optional(), +}) + +export const s_source_type_wechat = z.object({ + prepay_id: z.string().optional(), + qr_code_url: z.string().nullable().optional(), + statement_descriptor: z.string().optional(), +}) + +export const s_subscription_pending_invoice_item_interval = z.object({ + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number(), +}) + +export const s_subscription_schedule_current_phase = z.object({ + end_date: z.coerce.number(), + start_date: z.coerce.number(), +}) + +export const s_subscriptions_resource_billing_cycle_anchor_config = z.object({ + day_of_month: z.coerce.number(), + hour: z.coerce.number().nullable().optional(), + minute: z.coerce.number().nullable().optional(), + month: z.coerce.number().nullable().optional(), + second: z.coerce.number().nullable().optional(), +}) + +export const s_subscriptions_resource_pause_collection = z.object({ + behavior: z.enum(["keep_as_draft", "mark_uncollectible", "void"]), + resumes_at: z.coerce.number().nullable().optional(), +}) + +export const s_subscriptions_trials_resource_end_behavior = z.object({ + missing_payment_method: z.enum(["cancel", "create_invoice", "pause"]), +}) + +export const s_tax_code = z.object({ + description: z.string().max(5000), + id: z.string().max(5000), + name: z.string().max(5000), + object: z.enum(["tax_code"]), +}) + +export const s_tax_deducted_at_source = z.object({ + id: z.string().max(5000), + object: z.enum(["tax_deducted_at_source"]), + period_end: z.coerce.number(), + period_start: z.coerce.number(), + tax_deduction_account_number: z.string().max(5000), +}) + +export const s_tax_id_verification = z.object({ + status: z.enum(["pending", "unavailable", "unverified", "verified"]), + verified_address: z.string().max(5000).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_tax_product_registrations_resource_country_options_ca_province_standard = + z.object({ province: z.string().max(5000) }) + +export const s_tax_product_registrations_resource_country_options_default = + z.object({ type: z.enum(["standard"]) }) + +export const s_tax_product_registrations_resource_country_options_default_inbound_goods = + z.object({ type: z.enum(["standard"]) }) + +export const s_tax_product_registrations_resource_country_options_eu_standard = + z.object({ place_of_supply_scheme: z.enum(["small_seller", "standard"]) }) + +export const s_tax_product_registrations_resource_country_options_simplified = + z.object({ type: z.enum(["simplified"]) }) + +export const s_tax_product_registrations_resource_country_options_us_local_amusement_tax = + z.object({ jurisdiction: z.string().max(5000) }) + +export const s_tax_product_registrations_resource_country_options_us_local_lease_tax = + z.object({ jurisdiction: z.string().max(5000) }) + +export const s_tax_product_registrations_resource_country_options_us_state_sales_tax_election = + z.object({ + jurisdiction: z.string().max(5000).optional(), + type: z.enum([ + "local_use_tax", + "simplified_sellers_use_tax", + "single_local_use_tax", + ]), + }) + +export const s_tax_product_resource_customer_details_resource_tax_id = z.object( + { + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "unknown", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string().max(5000), + }, +) + +export const s_tax_product_resource_jurisdiction = z.object({ + country: z.string().max(5000), + display_name: z.string().max(5000), + level: z.enum(["city", "country", "county", "district", "state"]), + state: z.string().max(5000).nullable().optional(), +}) + +export const s_tax_product_resource_line_item_tax_rate_details = z.object({ + display_name: z.string().max(5000), + percentage_decimal: z.string().max(5000), + tax_type: z.enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "retail_delivery_fee", + "rst", + "sales_tax", + "service_tax", + "vat", + ]), +}) + +export const s_tax_product_resource_postal_address = z.object({ + city: z.string().max(5000).nullable().optional(), + country: z.string().max(5000), + line1: z.string().max(5000).nullable().optional(), + line2: z.string().max(5000).nullable().optional(), + postal_code: z.string().max(5000).nullable().optional(), + state: z.string().max(5000).nullable().optional(), +}) + +export const s_tax_product_resource_tax_settings_defaults = z.object({ + tax_behavior: z + .enum(["exclusive", "inclusive", "inferred_by_currency"]) + .nullable() + .optional(), + tax_code: z.string().max(5000).nullable().optional(), +}) + +export const s_tax_product_resource_tax_settings_status_details_resource_active = + z.object({}) + +export const s_tax_product_resource_tax_settings_status_details_resource_pending = + z.object({ + missing_fields: z.array(z.string().max(5000)).nullable().optional(), + }) + +export const s_tax_product_resource_tax_transaction_line_item_resource_reversal = + z.object({ original_line_item: z.string().max(5000) }) + +export const s_tax_product_resource_tax_transaction_resource_reversal = + z.object({ original_transaction: z.string().max(5000).nullable().optional() }) + +export const s_tax_product_resource_tax_transaction_shipping_cost = z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + shipping_rate: z.string().max(5000).optional(), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_code: z.string().max(5000), +}) + +export const s_tax_rate_flat_amount = z.object({ + amount: z.coerce.number(), + currency: z.string().max(5000), +}) + +export const s_terminal_configuration_configuration_resource_currency_specific_config = + z.object({ + fixed_amounts: z.array(z.coerce.number()).nullable().optional(), + percentages: z.array(z.coerce.number()).nullable().optional(), + smart_tip_threshold: z.coerce.number().optional(), + }) + +export const s_terminal_configuration_configuration_resource_enterprise_peap_wifi = + z.object({ + ca_certificate_file: z.string().max(5000).optional(), + password: z.string().max(5000), + ssid: z.string().max(5000), + username: z.string().max(5000), + }) + +export const s_terminal_configuration_configuration_resource_enterprise_tls_wifi = + z.object({ + ca_certificate_file: z.string().max(5000).optional(), + client_certificate_file: z.string().max(5000), + private_key_file: z.string().max(5000), + private_key_file_password: z.string().max(5000).optional(), + ssid: z.string().max(5000), + }) + +export const s_terminal_configuration_configuration_resource_offline_config = + z.object({ enabled: PermissiveBoolean.nullable().optional() }) + +export const s_terminal_configuration_configuration_resource_personal_psk_wifi = + z.object({ password: z.string().max(5000), ssid: z.string().max(5000) }) + +export const s_terminal_configuration_configuration_resource_reboot_window = + z.object({ end_hour: z.coerce.number(), start_hour: z.coerce.number() }) + +export const s_terminal_connection_token = z.object({ + location: z.string().max(5000).optional(), + object: z.enum(["terminal.connection_token"]), + secret: z.string().max(5000), +}) + +export const s_terminal_reader_reader_resource_line_item = z.object({ + amount: z.coerce.number(), + description: z.string().max(5000), + quantity: z.coerce.number(), +}) + +export const s_terminal_reader_reader_resource_process_setup_config = z.object({ + enable_customer_cancellation: PermissiveBoolean.optional(), +}) + +export const s_terminal_reader_reader_resource_refund_payment_config = z.object( + { enable_customer_cancellation: PermissiveBoolean.optional() }, +) + +export const s_terminal_reader_reader_resource_tipping_config = z.object({ + amount_eligible: z.coerce.number().optional(), +}) + +export const s_three_d_secure_details = z.object({ + authentication_flow: z + .enum(["challenge", "frictionless"]) + .nullable() + .optional(), + electronic_commerce_indicator: z + .enum(["01", "02", "05", "06", "07"]) + .nullable() + .optional(), + result: z + .enum([ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ]) + .nullable() + .optional(), + result_reason: z + .enum([ + "abandoned", + "bypassed", + "canceled", + "card_not_enrolled", + "network_not_supported", + "protocol_error", + "rejected", + ]) + .nullable() + .optional(), + transaction_id: z.string().max(5000).nullable().optional(), + version: z.enum(["1.0.2", "2.1.0", "2.2.0"]).nullable().optional(), +}) + +export const s_three_d_secure_details_charge = z.object({ + authentication_flow: z + .enum(["challenge", "frictionless"]) + .nullable() + .optional(), + electronic_commerce_indicator: z + .enum(["01", "02", "05", "06", "07"]) + .nullable() + .optional(), + exemption_indicator: z.enum(["low_risk", "none"]).nullable().optional(), + exemption_indicator_applied: PermissiveBoolean.optional(), + result: z + .enum([ + "attempt_acknowledged", + "authenticated", + "exempted", + "failed", + "not_supported", + "processing_error", + ]) + .nullable() + .optional(), + result_reason: z + .enum([ + "abandoned", + "bypassed", + "canceled", + "card_not_enrolled", + "network_not_supported", + "protocol_error", + "rejected", + ]) + .nullable() + .optional(), + transaction_id: z.string().max(5000).nullable().optional(), + version: z.enum(["1.0.2", "2.1.0", "2.2.0"]).nullable().optional(), +}) + +export const s_three_d_secure_usage = z.object({ supported: PermissiveBoolean }) + +export const s_token_card_networks = z.object({ + preferred: z.string().max(5000).nullable().optional(), +}) + +export const s_transfer_schedule = z.object({ + delay_days: z.coerce.number(), + interval: z.string().max(5000), + monthly_anchor: z.coerce.number().optional(), + weekly_anchor: z.string().max(5000).optional(), +}) + +export const s_transform_quantity = z.object({ + divide_by: z.coerce.number(), + round: z.enum(["down", "up"]), +}) + +export const s_transform_usage = z.object({ + divide_by: z.coerce.number(), + round: z.enum(["down", "up"]), +}) + +export const s_treasury_financial_accounts_resource_aba_record = z.object({ + account_holder_name: z.string().max(5000), + account_number: z.string().max(5000).nullable().optional(), + account_number_last4: z.string().max(5000), + bank_name: z.string().max(5000), + routing_number: z.string().max(5000), +}) + +export const s_treasury_financial_accounts_resource_balance = z.object({ + cash: z.record(z.coerce.number()), + inbound_pending: z.record(z.coerce.number()), + outbound_pending: z.record(z.coerce.number()), +}) + +export const s_treasury_financial_accounts_resource_closed_status_details = + z.object({ + reasons: z.array( + z.enum(["account_rejected", "closed_by_platform", "other"]), + ), + }) + +export const s_treasury_financial_accounts_resource_platform_restrictions = + z.object({ + inbound_flows: z.enum(["restricted", "unrestricted"]).nullable().optional(), + outbound_flows: z + .enum(["restricted", "unrestricted"]) + .nullable() + .optional(), + }) + +export const s_treasury_financial_accounts_resource_toggles_setting_status_details = + z.object({ + code: z.enum([ + "activating", + "capability_not_requested", + "financial_account_closed", + "rejected_other", + "rejected_unsupported_business", + "requirements_past_due", + "requirements_pending_verification", + "restricted_by_platform", + "restricted_other", + ]), + resolution: z + .enum(["contact_stripe", "provide_information", "remove_restriction"]) + .nullable() + .optional(), + restriction: z.enum(["inbound_flows", "outbound_flows"]).optional(), + }) + +export const s_treasury_inbound_transfers_resource_failure_details = z.object({ + code: z.enum([ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "debit_not_authorized", + "incorrect_account_holder_address", + "incorrect_account_holder_name", + "incorrect_account_holder_tax_id", + "insufficient_funds", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ]), +}) + +export const s_treasury_inbound_transfers_resource_inbound_transfer_resource_linked_flows = + z.object({ received_debit: z.string().max(5000).nullable().optional() }) + +export const s_treasury_inbound_transfers_resource_inbound_transfer_resource_status_transitions = + z.object({ + canceled_at: z.coerce.number().nullable().optional(), + failed_at: z.coerce.number().nullable().optional(), + succeeded_at: z.coerce.number().nullable().optional(), + }) + +export const s_treasury_outbound_payments_resource_ach_tracking_details = + z.object({ trace_id: z.string().max(5000) }) + +export const s_treasury_outbound_payments_resource_outbound_payment_resource_end_user_details = + z.object({ + ip_address: z.string().max(5000).nullable().optional(), + present: PermissiveBoolean, + }) + +export const s_treasury_outbound_payments_resource_outbound_payment_resource_status_transitions = + z.object({ + canceled_at: z.coerce.number().nullable().optional(), + failed_at: z.coerce.number().nullable().optional(), + posted_at: z.coerce.number().nullable().optional(), + returned_at: z.coerce.number().nullable().optional(), + }) + +export const s_treasury_outbound_payments_resource_us_domestic_wire_tracking_details = + z.object({ + chips: z.string().max(5000).nullable().optional(), + imad: z.string().max(5000).nullable().optional(), + omad: z.string().max(5000).nullable().optional(), + }) + +export const s_treasury_outbound_transfers_resource_ach_tracking_details = + z.object({ trace_id: z.string().max(5000) }) + +export const s_treasury_outbound_transfers_resource_status_transitions = + z.object({ + canceled_at: z.coerce.number().nullable().optional(), + failed_at: z.coerce.number().nullable().optional(), + posted_at: z.coerce.number().nullable().optional(), + returned_at: z.coerce.number().nullable().optional(), + }) + +export const s_treasury_outbound_transfers_resource_us_domestic_wire_tracking_details = + z.object({ + chips: z.string().max(5000).nullable().optional(), + imad: z.string().max(5000).nullable().optional(), + omad: z.string().max(5000).nullable().optional(), + }) + +export const s_treasury_received_credits_resource_reversal_details = z.object({ + deadline: z.coerce.number().nullable().optional(), + restricted_reason: z + .enum([ + "already_reversed", + "deadline_passed", + "network_restricted", + "other", + "source_flow_restricted", + ]) + .nullable() + .optional(), +}) + +export const s_treasury_received_credits_resource_status_transitions = z.object( + { posted_at: z.coerce.number().nullable().optional() }, +) + +export const s_treasury_received_debits_resource_debit_reversal_linked_flows = + z.object({ issuing_dispute: z.string().max(5000).nullable().optional() }) + +export const s_treasury_received_debits_resource_linked_flows = z.object({ + debit_reversal: z.string().max(5000).nullable().optional(), + inbound_transfer: z.string().max(5000).nullable().optional(), + issuing_authorization: z.string().max(5000).nullable().optional(), + issuing_transaction: z.string().max(5000).nullable().optional(), + payout: z.string().max(5000).nullable().optional(), +}) + +export const s_treasury_received_debits_resource_reversal_details = z.object({ + deadline: z.coerce.number().nullable().optional(), + restricted_reason: z + .enum([ + "already_reversed", + "deadline_passed", + "network_restricted", + "other", + "source_flow_restricted", + ]) + .nullable() + .optional(), +}) + +export const s_treasury_received_debits_resource_status_transitions = z.object({ + completed_at: z.coerce.number().nullable().optional(), +}) + +export const s_treasury_shared_resource_initiating_payment_method_details_us_bank_account = + z.object({ + bank_name: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + routing_number: z.string().max(5000).nullable().optional(), + }) + +export const s_treasury_transactions_resource_abstract_transaction_resource_status_transitions = + z.object({ + posted_at: z.coerce.number().nullable().optional(), + void_at: z.coerce.number().nullable().optional(), + }) + +export const s_treasury_transactions_resource_balance_impact = z.object({ + cash: z.coerce.number(), + inbound_pending: z.coerce.number(), + outbound_pending: z.coerce.number(), +}) + +export const s_us_bank_account_networks = z.object({ + preferred: z.string().max(5000).nullable().optional(), + supported: z.array(z.enum(["ach", "us_domestic_wire"])), +}) + +export const s_verification_session_redaction = z.object({ + status: z.enum(["processing", "redacted"]), +}) + +export const s_webhook_endpoint = z.object({ + api_version: z.string().max(5000).nullable().optional(), + application: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + description: z.string().max(5000).nullable().optional(), + enabled_events: z.array(z.string().max(5000)), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["webhook_endpoint"]), + secret: z.string().max(5000).optional(), + status: z.string().max(5000), + url: z.string().max(5000), +}) + +export const s_account_business_profile = z.object({ + annual_revenue: s_account_annual_revenue.nullable().optional(), + estimated_worker_count: z.coerce.number().nullable().optional(), + mcc: z.string().max(5000).nullable().optional(), + monthly_estimated_revenue: s_account_monthly_estimated_revenue.optional(), + name: z.string().max(5000).nullable().optional(), + product_description: z.string().max(40000).nullable().optional(), + support_address: s_address.nullable().optional(), + support_email: z.string().max(5000).nullable().optional(), + support_phone: z.string().max(5000).nullable().optional(), + support_url: z.string().max(5000).nullable().optional(), + url: z.string().max(5000).nullable().optional(), +}) + +export const s_account_capability_future_requirements = z.object({ + alternatives: z + .array(s_account_requirements_alternative) + .nullable() + .optional(), + current_deadline: z.coerce.number().nullable().optional(), + currently_due: z.array(z.string().max(5000)), + disabled_reason: z + .enum([ + "other", + "paused.inactivity", + "pending.onboarding", + "pending.review", + "platform_disabled", + "platform_paused", + "rejected.inactivity", + "rejected.other", + "rejected.unsupported_business", + "requirements.fields_needed", + ]) + .nullable() + .optional(), + errors: z.array(s_account_requirements_error), + eventually_due: z.array(z.string().max(5000)), + past_due: z.array(z.string().max(5000)), + pending_verification: z.array(z.string().max(5000)), +}) + +export const s_account_capability_requirements = z.object({ + alternatives: z + .array(s_account_requirements_alternative) + .nullable() + .optional(), + current_deadline: z.coerce.number().nullable().optional(), + currently_due: z.array(z.string().max(5000)), + disabled_reason: z + .enum([ + "other", + "paused.inactivity", + "pending.onboarding", + "pending.review", + "platform_disabled", + "platform_paused", + "rejected.inactivity", + "rejected.other", + "rejected.unsupported_business", + "requirements.fields_needed", + ]) + .nullable() + .optional(), + errors: z.array(s_account_requirements_error), + eventually_due: z.array(z.string().max(5000)), + past_due: z.array(z.string().max(5000)), + pending_verification: z.array(z.string().max(5000)), +}) + +export const s_account_card_issuing_settings = z.object({ + tos_acceptance: s_card_issuing_account_terms_of_service.optional(), +}) + +export const s_account_card_payments_settings = z.object({ + decline_on: s_account_decline_charge_on.optional(), + statement_descriptor_prefix: z.string().max(5000).nullable().optional(), + statement_descriptor_prefix_kana: z.string().max(5000).nullable().optional(), + statement_descriptor_prefix_kanji: z.string().max(5000).nullable().optional(), +}) + +export const s_account_future_requirements = z.object({ + alternatives: z + .array(s_account_requirements_alternative) + .nullable() + .optional(), + current_deadline: z.coerce.number().nullable().optional(), + currently_due: z.array(z.string().max(5000)).nullable().optional(), + disabled_reason: z + .enum([ + "action_required.requested_capabilities", + "listed", + "other", + "platform_paused", + "rejected.fraud", + "rejected.incomplete_verification", + "rejected.listed", + "rejected.other", + "rejected.platform_fraud", + "rejected.platform_other", + "rejected.platform_terms_of_service", + "rejected.terms_of_service", + "requirements.past_due", + "requirements.pending_verification", + "under_review", + ]) + .nullable() + .optional(), + errors: z.array(s_account_requirements_error).nullable().optional(), + eventually_due: z.array(z.string().max(5000)).nullable().optional(), + past_due: z.array(z.string().max(5000)).nullable().optional(), + pending_verification: z.array(z.string().max(5000)).nullable().optional(), +}) + +export const s_account_payout_settings = z.object({ + debit_negative_balances: PermissiveBoolean, + schedule: s_transfer_schedule, + statement_descriptor: z.string().max(5000).nullable().optional(), +}) + +export const s_account_requirements = z.object({ + alternatives: z + .array(s_account_requirements_alternative) + .nullable() + .optional(), + current_deadline: z.coerce.number().nullable().optional(), + currently_due: z.array(z.string().max(5000)).nullable().optional(), + disabled_reason: z + .enum([ + "action_required.requested_capabilities", + "listed", + "other", + "platform_paused", + "rejected.fraud", + "rejected.incomplete_verification", + "rejected.listed", + "rejected.other", + "rejected.platform_fraud", + "rejected.platform_other", + "rejected.platform_terms_of_service", + "rejected.terms_of_service", + "requirements.past_due", + "requirements.pending_verification", + "under_review", + ]) + .nullable() + .optional(), + errors: z.array(s_account_requirements_error).nullable().optional(), + eventually_due: z.array(z.string().max(5000)).nullable().optional(), + past_due: z.array(z.string().max(5000)).nullable().optional(), + pending_verification: z.array(z.string().max(5000)).nullable().optional(), +}) + +export const s_account_treasury_settings = z.object({ + tos_acceptance: s_account_terms_of_service.optional(), +}) + +export const s_account_unification_account_controller = z.object({ + fees: s_account_unification_account_controller_fees.optional(), + is_controller: PermissiveBoolean.optional(), + losses: s_account_unification_account_controller_losses.optional(), + requirement_collection: z.enum(["application", "stripe"]).optional(), + stripe_dashboard: + s_account_unification_account_controller_stripe_dashboard.optional(), + type: z.enum(["account", "application"]), +}) + +export const s_amazon_pay_underlying_payment_method_funding_details = z.object({ + card: s_payment_method_details_passthrough_card.optional(), + type: z.enum(["card"]).nullable().optional(), +}) + +export const s_apps_secret = z.object({ + created: z.coerce.number(), + deleted: PermissiveBoolean.optional(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.enum(["apps.secret"]), + payload: z.string().max(5000).nullable().optional(), + scope: s_secret_service_resource_scope, +}) + +export const s_balance_amount = z.object({ + amount: z.coerce.number(), + currency: z.string(), + source_types: s_balance_amount_by_source_type.optional(), +}) + +export const s_balance_net_available = z.object({ + amount: z.coerce.number(), + destination: z.string().max(5000), + source_types: s_balance_amount_by_source_type.optional(), +}) + +export const s_bank_connections_resource_balance = z.object({ + as_of: z.coerce.number(), + cash: s_bank_connections_resource_balance_api_resource_cash_balance.optional(), + credit: + s_bank_connections_resource_balance_api_resource_credit_balance.optional(), + current: z.record(z.coerce.number()), + type: z.enum(["cash", "credit"]), +}) + +export const s_billing_bill_resource_invoice_item_parents_invoice_item_parent = + z.object({ + subscription_details: + s_billing_bill_resource_invoice_item_parents_invoice_item_subscription_parent + .nullable() + .optional(), + type: z.enum(["subscription_details"]), + }) + +export const s_billing_bill_resource_invoicing_lines_common_proration_details = + z.object({ + credited_items: + s_billing_bill_resource_invoicing_lines_common_credited_items + .nullable() + .optional(), + }) + +export const s_billing_bill_resource_invoicing_pricing_pricing = z.object({ + price_details: + s_billing_bill_resource_invoicing_pricing_pricing_price_details.optional(), + type: z.enum(["price_details"]), + unit_amount_decimal: z.string().nullable().optional(), +}) + +export const s_billing_bill_resource_invoicing_taxes_tax = z.object({ + amount: z.coerce.number(), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_rate_details: s_billing_bill_resource_invoicing_taxes_tax_rate_details + .nullable() + .optional(), + taxability_reason: z.enum([ + "customer_exempt", + "not_available", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ]), + taxable_amount: z.coerce.number().nullable().optional(), + type: z.enum(["tax_rate_details"]), +}) + +export const s_billing_clocks_resource_status_details_status_details = z.object( + { + advancing: + s_billing_clocks_resource_status_details_advancing_status_details.optional(), + }, +) + +export const s_billing_credit_grants_resource_amount = z.object({ + monetary: s_billing_credit_grants_resource_monetary_amount + .nullable() + .optional(), + type: z.enum(["monetary"]), +}) + +export const s_billing_credit_grants_resource_scope = z.object({ + price_type: z.enum(["metered"]).optional(), + prices: z.array(s_billing_credit_grants_resource_applicable_price).optional(), +}) + +export const s_billing_details = z.object({ + address: s_address.nullable().optional(), + email: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + phone: z.string().max(5000).nullable().optional(), +}) + +export const s_billing_meter = z.object({ + created: z.coerce.number(), + customer_mapping: s_billing_meter_resource_customer_mapping_settings, + default_aggregation: s_billing_meter_resource_aggregation_settings, + display_name: z.string().max(5000), + event_name: z.string().max(5000), + event_time_window: z.enum(["day", "hour"]).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["billing.meter"]), + status: z.enum(["active", "inactive"]), + status_transitions: s_billing_meter_resource_billing_meter_status_transitions, + updated: z.coerce.number(), + value_settings: s_billing_meter_resource_billing_meter_value, +}) + +export const s_billing_meter_event_adjustment = z.object({ + cancel: s_billing_meter_resource_billing_meter_event_adjustment_cancel + .nullable() + .optional(), + event_name: z.string().max(100), + livemode: PermissiveBoolean, + object: z.enum(["billing.meter_event_adjustment"]), + status: z.enum(["complete", "pending"]), + type: z.enum(["cancel"]), +}) + +export const s_cash_balance = z.object({ + available: z.record(z.coerce.number()).nullable().optional(), + customer: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["cash_balance"]), + settings: s_customer_balance_customer_balance_settings, +}) + +export const s_charge_outcome = z.object({ + advice_code: z + .enum(["confirm_card_data", "do_not_try_again", "try_again_later"]) + .nullable() + .optional(), + network_advice_code: z.string().max(5000).nullable().optional(), + network_decline_code: z.string().max(5000).nullable().optional(), + network_status: z.string().max(5000).nullable().optional(), + reason: z.string().max(5000).nullable().optional(), + risk_level: z.string().max(5000).optional(), + risk_score: z.coerce.number().optional(), + rule: z.union([z.string().max(5000), s_rule]).optional(), + seller_message: z.string().max(5000).nullable().optional(), + type: z.string().max(5000), +}) + +export const s_checkout_acss_debit_payment_method_options = z.object({ + currency: z.enum(["cad", "usd"]).optional(), + mandate_options: s_checkout_acss_debit_mandate_options.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), +}) + +export const s_checkout_bacs_debit_payment_method_options = z.object({ + mandate_options: + s_checkout_payment_method_options_mandate_options_bacs_debit.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + target_date: z.string().max(5000).optional(), +}) + +export const s_checkout_card_payment_method_options = z.object({ + installments: s_checkout_card_installments_options.optional(), + request_extended_authorization: z.enum(["if_available", "never"]).optional(), + request_incremental_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_multicapture: z.enum(["if_available", "never"]).optional(), + request_overcapture: z.enum(["if_available", "never"]).optional(), + request_three_d_secure: z.enum(["any", "automatic", "challenge"]), + restrictions: + s_payment_pages_private_card_payment_method_options_resource_restrictions.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + statement_descriptor_suffix_kana: z.string().max(5000).optional(), + statement_descriptor_suffix_kanji: z.string().max(5000).optional(), +}) + +export const s_checkout_customer_balance_bank_transfer_payment_method_options = + z.object({ + eu_bank_transfer: + s_payment_method_options_customer_balance_eu_bank_account.optional(), + requested_address_types: z + .array( + z.enum(["aba", "iban", "sepa", "sort_code", "spei", "swift", "zengin"]), + ) + .optional(), + type: z + .enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]) + .nullable() + .optional(), + }) + +export const s_checkout_sepa_debit_payment_method_options = z.object({ + mandate_options: + s_checkout_payment_method_options_mandate_options_sepa_debit.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + target_date: z.string().max(5000).optional(), +}) + +export const s_climate_supplier = z.object({ + id: z.string().max(5000), + info_url: z.string().max(5000), + livemode: PermissiveBoolean, + locations: z.array(s_climate_removals_location), + name: z.string().max(5000), + object: z.enum(["climate.supplier"]), + removal_pathway: z.enum([ + "biomass_carbon_removal_and_storage", + "direct_air_capture", + "enhanced_weathering", + ]), +}) + +export const s_confirmation_tokens_resource_mandate_data_resource_customer_acceptance = + z.object({ + online: + s_confirmation_tokens_resource_mandate_data_resource_customer_acceptance_resource_online + .nullable() + .optional(), + type: z.string().max(5000), + }) + +export const s_confirmation_tokens_resource_payment_method_options = z.object({ + card: s_confirmation_tokens_resource_payment_method_options_resource_card + .nullable() + .optional(), +}) + +export const s_confirmation_tokens_resource_shipping = z.object({ + address: s_address, + name: z.string().max(5000), + phone: z.string().max(5000).nullable().optional(), +}) + +export const s_connect_embedded_account_config_claim = z.object({ + enabled: PermissiveBoolean, + features: s_connect_embedded_account_features_claim, +}) + +export const s_connect_embedded_base_config_claim = z.object({ + enabled: PermissiveBoolean, + features: s_connect_embedded_base_features, +}) + +export const s_connect_embedded_financial_account_config_claim = z.object({ + enabled: PermissiveBoolean, + features: s_connect_embedded_financial_account_features, +}) + +export const s_connect_embedded_financial_account_transactions_config_claim = + z.object({ + enabled: PermissiveBoolean, + features: s_connect_embedded_financial_account_transactions_features, + }) + +export const s_connect_embedded_issuing_card_config_claim = z.object({ + enabled: PermissiveBoolean, + features: s_connect_embedded_issuing_card_features, +}) + +export const s_connect_embedded_issuing_cards_list_config_claim = z.object({ + enabled: PermissiveBoolean, + features: s_connect_embedded_issuing_cards_list_features, +}) + +export const s_connect_embedded_payments_config_claim = z.object({ + enabled: PermissiveBoolean, + features: s_connect_embedded_payments_features, +}) + +export const s_connect_embedded_payouts_config = z.object({ + enabled: PermissiveBoolean, + features: s_connect_embedded_payouts_features, +}) + +export const s_country_spec_verification_fields = z.object({ + company: s_country_spec_verification_field_details, + individual: s_country_spec_verification_field_details, +}) + +export const s_coupon = z.object({ + amount_off: z.coerce.number().nullable().optional(), + applies_to: s_coupon_applies_to.optional(), + created: z.coerce.number(), + currency: z.string().nullable().optional(), + currency_options: z.record(s_coupon_currency_option).optional(), + duration: z.enum(["forever", "once", "repeating"]), + duration_in_months: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + max_redemptions: z.coerce.number().nullable().optional(), + metadata: z.record(z.string().max(500)).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + object: z.enum(["coupon"]), + percent_off: z.coerce.number().nullable().optional(), + redeem_by: z.coerce.number().nullable().optional(), + times_redeemed: z.coerce.number(), + valid: PermissiveBoolean, +}) + +export const s_currency_option = z.object({ + custom_unit_amount: s_custom_unit_amount.nullable().optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .nullable() + .optional(), + tiers: z.array(s_price_tier).optional(), + unit_amount: z.coerce.number().nullable().optional(), + unit_amount_decimal: z.string().nullable().optional(), +}) + +export const s_customer_acceptance = z.object({ + accepted_at: z.coerce.number().nullable().optional(), + offline: s_offline_acceptance.optional(), + online: s_online_acceptance.optional(), + type: z.enum(["offline", "online"]), +}) + +export const s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer = + z.object({ + eu_bank_transfer: + s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_eu_bank_transfer.optional(), + gb_bank_transfer: + s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_gb_bank_transfer.optional(), + jp_bank_transfer: + s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_jp_bank_transfer.optional(), + reference: z.string().max(5000).nullable().optional(), + type: z.enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]), + us_bank_transfer: + s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer_resource_us_bank_transfer.optional(), + }) + +export const s_customer_session_resource_components_resource_payment_element = + z.object({ + enabled: PermissiveBoolean, + features: + s_customer_session_resource_components_resource_payment_element_resource_features + .nullable() + .optional(), + }) + +export const s_customer_tax = z.object({ + automatic_tax: z.enum([ + "failed", + "not_collecting", + "supported", + "unrecognized_location", + ]), + ip_address: z.string().max(5000).nullable().optional(), + location: s_customer_tax_location.nullable().optional(), +}) + +export const s_deleted_external_account = z.union([ + s_deleted_bank_account, + s_deleted_card, +]) + +export const s_deleted_payment_source = z.union([ + s_deleted_bank_account, + s_deleted_card, +]) + +export const s_dispute_enhanced_eligibility = z.object({ + visa_compelling_evidence_3: + s_dispute_enhanced_eligibility_visa_compelling_evidence3.optional(), + visa_compliance: s_dispute_enhanced_eligibility_visa_compliance.optional(), +}) + +export const s_dispute_payment_method_details = z.object({ + amazon_pay: s_dispute_payment_method_details_amazon_pay.optional(), + card: s_dispute_payment_method_details_card.optional(), + klarna: s_dispute_payment_method_details_klarna.optional(), + paypal: s_dispute_payment_method_details_paypal.optional(), + type: z.enum(["amazon_pay", "card", "klarna", "paypal"]), +}) + +export const s_dispute_visa_compelling_evidence3_disputed_transaction = + z.object({ + customer_account_id: z.string().max(5000).nullable().optional(), + customer_device_fingerprint: z.string().max(5000).nullable().optional(), + customer_device_id: z.string().max(5000).nullable().optional(), + customer_email_address: z.string().max(5000).nullable().optional(), + customer_purchase_ip: z.string().max(5000).nullable().optional(), + merchandise_or_services: z + .enum(["merchandise", "services"]) + .nullable() + .optional(), + product_description: z.string().max(150000).nullable().optional(), + shipping_address: s_dispute_transaction_shipping_address + .nullable() + .optional(), + }) + +export const s_dispute_visa_compelling_evidence3_prior_undisputed_transaction = + z.object({ + charge: z.string().max(5000), + customer_account_id: z.string().max(5000).nullable().optional(), + customer_device_fingerprint: z.string().max(5000).nullable().optional(), + customer_device_id: z.string().max(5000).nullable().optional(), + customer_email_address: z.string().max(5000).nullable().optional(), + customer_purchase_ip: z.string().max(5000).nullable().optional(), + product_description: z.string().max(150000).nullable().optional(), + shipping_address: s_dispute_transaction_shipping_address + .nullable() + .optional(), + }) + +export const s_entitlements_active_entitlement = z.object({ + feature: z.union([z.string().max(5000), s_entitlements_feature]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + lookup_key: z.string().max(5000), + object: z.enum(["entitlements.active_entitlement"]), +}) + +export const s_event = z.object({ + account: z.string().max(5000).optional(), + api_version: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + data: s_notification_event_data, + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["event"]), + pending_webhooks: z.coerce.number(), + request: s_notification_event_request.nullable().optional(), + type: z.string().max(5000), +}) + +export const s_external_account_requirements = z.object({ + currently_due: z.array(z.string().max(5000)).nullable().optional(), + errors: z.array(s_account_requirements_error).nullable().optional(), + past_due: z.array(z.string().max(5000)).nullable().optional(), + pending_verification: z.array(z.string().max(5000)).nullable().optional(), +}) + +export const s_financial_connections_account_ownership = z.object({ + created: z.coerce.number(), + id: z.string().max(5000), + object: z.enum(["financial_connections.account_ownership"]), + owners: z.object({ + data: z.array(s_financial_connections_account_owner), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), +}) + +export const s_financial_connections_transaction = z.object({ + account: z.string().max(5000), + amount: z.coerce.number(), + currency: z.string().max(5000), + description: z.string().max(5000), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["financial_connections.transaction"]), + status: z.enum(["pending", "posted", "void"]), + status_transitions: + s_bank_connections_resource_transaction_resource_status_transitions, + transacted_at: z.coerce.number(), + transaction_refresh: z.string().max(5000), + updated: z.coerce.number(), +}) + +export const s_forwarded_request_details = z.object({ + body: z.string().max(5000), + headers: z.array(s_forwarded_request_header), + http_method: z.enum(["POST"]), +}) + +export const s_forwarded_response_details = z.object({ + body: z.string().max(5000), + headers: z.array(s_forwarded_request_header), + status: z.coerce.number(), +}) + +export const s_funding_instructions_bank_transfer_aba_record = z.object({ + account_holder_address: s_address, + account_holder_name: z.string().max(5000), + account_number: z.string().max(5000), + account_type: z.string().max(5000), + bank_address: s_address, + bank_name: z.string().max(5000), + routing_number: z.string().max(5000), +}) + +export const s_funding_instructions_bank_transfer_iban_record = z.object({ + account_holder_address: s_address, + account_holder_name: z.string().max(5000), + bank_address: s_address, + bic: z.string().max(5000), + country: z.string().max(5000), + iban: z.string().max(5000), +}) + +export const s_funding_instructions_bank_transfer_sort_code_record = z.object({ + account_holder_address: s_address, + account_holder_name: z.string().max(5000), + account_number: z.string().max(5000), + bank_address: s_address, + sort_code: z.string().max(5000), +}) + +export const s_funding_instructions_bank_transfer_spei_record = z.object({ + account_holder_address: s_address, + account_holder_name: z.string().max(5000), + bank_address: s_address, + bank_code: z.string().max(5000), + bank_name: z.string().max(5000), + clabe: z.string().max(5000), +}) + +export const s_funding_instructions_bank_transfer_swift_record = z.object({ + account_holder_address: s_address, + account_holder_name: z.string().max(5000), + account_number: z.string().max(5000), + account_type: z.string().max(5000), + bank_address: s_address, + bank_name: z.string().max(5000), + swift_code: z.string().max(5000), +}) + +export const s_funding_instructions_bank_transfer_zengin_record = z.object({ + account_holder_address: s_address, + account_holder_name: z.string().max(5000).nullable().optional(), + account_number: z.string().max(5000).nullable().optional(), + account_type: z.string().max(5000).nullable().optional(), + bank_address: s_address, + bank_code: z.string().max(5000).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + branch_code: z.string().max(5000).nullable().optional(), + branch_name: z.string().max(5000).nullable().optional(), +}) + +export const s_gelato_document_report = z.object({ + address: s_address.nullable().optional(), + dob: s_gelato_data_document_report_date_of_birth.nullable().optional(), + error: s_gelato_document_report_error.nullable().optional(), + expiration_date: s_gelato_data_document_report_expiration_date + .nullable() + .optional(), + files: z.array(z.string().max(5000)).nullable().optional(), + first_name: z.string().max(5000).nullable().optional(), + issued_date: s_gelato_data_document_report_issued_date.nullable().optional(), + issuing_country: z.string().max(5000).nullable().optional(), + last_name: z.string().max(5000).nullable().optional(), + number: z.string().max(5000).nullable().optional(), + status: z.enum(["unverified", "verified"]), + type: z + .enum(["driving_license", "id_card", "passport"]) + .nullable() + .optional(), +}) + +export const s_gelato_email_report = z.object({ + email: z.string().max(5000).nullable().optional(), + error: s_gelato_email_report_error.nullable().optional(), + status: z.enum(["unverified", "verified"]), +}) + +export const s_gelato_id_number_report = z.object({ + dob: s_gelato_data_id_number_report_date.nullable().optional(), + error: s_gelato_id_number_report_error.nullable().optional(), + first_name: z.string().max(5000).nullable().optional(), + id_number: z.string().max(5000).nullable().optional(), + id_number_type: z.enum(["br_cpf", "sg_nric", "us_ssn"]).nullable().optional(), + last_name: z.string().max(5000).nullable().optional(), + status: z.enum(["unverified", "verified"]), +}) + +export const s_gelato_phone_report = z.object({ + error: s_gelato_phone_report_error.nullable().optional(), + phone: z.string().max(5000).nullable().optional(), + status: z.enum(["unverified", "verified"]), +}) + +export const s_gelato_selfie_report = z.object({ + document: z.string().max(5000).nullable().optional(), + error: s_gelato_selfie_report_error.nullable().optional(), + selfie: z.string().max(5000).nullable().optional(), + status: z.enum(["unverified", "verified"]), +}) + +export const s_gelato_verification_report_options = z.object({ + document: s_gelato_report_document_options.optional(), + id_number: s_gelato_report_id_number_options.optional(), +}) + +export const s_gelato_verification_session_options = z.object({ + document: s_gelato_session_document_options.optional(), + email: s_gelato_session_email_options.optional(), + id_number: s_gelato_session_id_number_options.optional(), + phone: s_gelato_session_phone_options.optional(), +}) + +export const s_gelato_verified_outputs = z.object({ + address: s_address.nullable().optional(), + dob: s_gelato_data_verified_outputs_date.nullable().optional(), + email: z.string().max(5000).nullable().optional(), + first_name: z.string().max(5000).nullable().optional(), + id_number: z.string().max(5000).nullable().optional(), + id_number_type: z.enum(["br_cpf", "sg_nric", "us_ssn"]).nullable().optional(), + last_name: z.string().max(5000).nullable().optional(), + phone: z.string().max(5000).nullable().optional(), +}) + +export const s_invoice_payment_method_options_acss_debit = z.object({ + mandate_options: + s_invoice_payment_method_options_acss_debit_mandate_options.optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), +}) + +export const s_invoice_payment_method_options_card = z.object({ + installments: s_invoice_installments_card.optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .nullable() + .optional(), +}) + +export const s_invoice_payment_method_options_customer_balance_bank_transfer = + z.object({ + eu_bank_transfer: + s_invoice_payment_method_options_customer_balance_bank_transfer_eu_bank_transfer.optional(), + type: z.string().nullable().optional(), + }) + +export const s_invoice_payment_method_options_us_bank_account_linked_account_options = + z.object({ + filters: + s_invoice_payment_method_options_us_bank_account_linked_account_options_filters.optional(), + permissions: z + .array( + z.enum(["balances", "ownership", "payment_method", "transactions"]), + ) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .nullable() + .optional(), + }) + +export const s_invoice_threshold_reason = z.object({ + amount_gte: z.coerce.number().nullable().optional(), + item_reasons: z.array(s_invoice_item_threshold_reason), +}) + +export const s_invoices_resource_invoice_rendering = z.object({ + amount_tax_display: z.string().max(5000).nullable().optional(), + pdf: s_invoice_rendering_pdf.nullable().optional(), + template: z.string().max(5000).nullable().optional(), + template_version: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_authorization_fleet_reported_breakdown = z.object({ + fuel: s_issuing_authorization_fleet_fuel_price_data.nullable().optional(), + non_fuel: s_issuing_authorization_fleet_non_fuel_price_data + .nullable() + .optional(), + tax: s_issuing_authorization_fleet_tax_data.nullable().optional(), +}) + +export const s_issuing_authorization_pending_request = z.object({ + amount: z.coerce.number(), + amount_details: s_issuing_authorization_amount_details.nullable().optional(), + currency: z.string(), + is_amount_controllable: PermissiveBoolean, + merchant_amount: z.coerce.number(), + merchant_currency: z.string(), + network_risk_score: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_authorization_request = z.object({ + amount: z.coerce.number(), + amount_details: s_issuing_authorization_amount_details.nullable().optional(), + approved: PermissiveBoolean, + authorization_code: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + currency: z.string().max(5000), + merchant_amount: z.coerce.number(), + merchant_currency: z.string().max(5000), + network_risk_score: z.coerce.number().nullable().optional(), + reason: z.enum([ + "account_disabled", + "card_active", + "card_canceled", + "card_expired", + "card_inactive", + "cardholder_blocked", + "cardholder_inactive", + "cardholder_verification_required", + "insecure_authorization_method", + "insufficient_funds", + "network_fallback", + "not_allowed", + "pin_blocked", + "spending_controls", + "suspected_fraud", + "verification_failed", + "webhook_approved", + "webhook_declined", + "webhook_error", + "webhook_timeout", + ]), + reason_message: z.string().max(5000).nullable().optional(), + requested_at: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_authorization_verification_data = z.object({ + address_line1_check: z.enum(["match", "mismatch", "not_provided"]), + address_postal_code_check: z.enum(["match", "mismatch", "not_provided"]), + authentication_exemption: s_issuing_authorization_authentication_exemption + .nullable() + .optional(), + cvc_check: z.enum(["match", "mismatch", "not_provided"]), + expiry_check: z.enum(["match", "mismatch", "not_provided"]), + postal_code: z.string().max(5000).nullable().optional(), + three_d_secure: s_issuing_authorization_three_d_secure.nullable().optional(), +}) + +export const s_issuing_card_authorization_controls = z.object({ + allowed_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .nullable() + .optional(), + allowed_merchant_countries: z + .array(z.string().max(5000)) + .nullable() + .optional(), + blocked_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .nullable() + .optional(), + blocked_merchant_countries: z + .array(z.string().max(5000)) + .nullable() + .optional(), + spending_limits: z.array(s_issuing_card_spending_limit).nullable().optional(), + spending_limits_currency: z.string().nullable().optional(), +}) + +export const s_issuing_card_shipping_address_validation = z.object({ + mode: z.enum([ + "disabled", + "normalization_only", + "validation_and_normalization", + ]), + normalized_address: s_address.nullable().optional(), + result: z + .enum(["indeterminate", "likely_deliverable", "likely_undeliverable"]) + .nullable() + .optional(), +}) + +export const s_issuing_card_wallets = z.object({ + apple_pay: s_issuing_card_apple_pay, + google_pay: s_issuing_card_google_pay, + primary_account_identifier: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_cardholder_address = z.object({ address: s_address }) + +export const s_issuing_cardholder_authorization_controls = z.object({ + allowed_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .nullable() + .optional(), + allowed_merchant_countries: z + .array(z.string().max(5000)) + .nullable() + .optional(), + blocked_categories: z + .array( + z.enum([ + "ac_refrigeration_repair", + "accounting_bookkeeping_services", + "advertising_services", + "agricultural_cooperative", + "airlines_air_carriers", + "airports_flying_fields", + "ambulance_services", + "amusement_parks_carnivals", + "antique_reproductions", + "antique_shops", + "aquariums", + "architectural_surveying_services", + "art_dealers_and_galleries", + "artists_supply_and_craft_shops", + "auto_and_home_supply_stores", + "auto_body_repair_shops", + "auto_paint_shops", + "auto_service_shops", + "automated_cash_disburse", + "automated_fuel_dispensers", + "automobile_associations", + "automotive_parts_and_accessories_stores", + "automotive_tire_stores", + "bail_and_bond_payments", + "bakeries", + "bands_orchestras", + "barber_and_beauty_shops", + "betting_casino_gambling", + "bicycle_shops", + "billiard_pool_establishments", + "boat_dealers", + "boat_rentals_and_leases", + "book_stores", + "books_periodicals_and_newspapers", + "bowling_alleys", + "bus_lines", + "business_secretarial_schools", + "buying_shopping_services", + "cable_satellite_and_other_pay_television_and_radio", + "camera_and_photographic_supply_stores", + "candy_nut_and_confectionery_stores", + "car_and_truck_dealers_new_used", + "car_and_truck_dealers_used_only", + "car_rental_agencies", + "car_washes", + "carpentry_services", + "carpet_upholstery_cleaning", + "caterers", + "charitable_and_social_service_organizations_fundraising", + "chemicals_and_allied_products", + "child_care_services", + "childrens_and_infants_wear_stores", + "chiropodists_podiatrists", + "chiropractors", + "cigar_stores_and_stands", + "civic_social_fraternal_associations", + "cleaning_and_maintenance", + "clothing_rental", + "colleges_universities", + "commercial_equipment", + "commercial_footwear", + "commercial_photography_art_and_graphics", + "commuter_transport_and_ferries", + "computer_network_services", + "computer_programming", + "computer_repair", + "computer_software_stores", + "computers_peripherals_and_software", + "concrete_work_services", + "construction_materials", + "consulting_public_relations", + "correspondence_schools", + "cosmetic_stores", + "counseling_services", + "country_clubs", + "courier_services", + "court_costs", + "credit_reporting_agencies", + "cruise_lines", + "dairy_products_stores", + "dance_hall_studios_schools", + "dating_escort_services", + "dentists_orthodontists", + "department_stores", + "detective_agencies", + "digital_goods_applications", + "digital_goods_games", + "digital_goods_large_volume", + "digital_goods_media", + "direct_marketing_catalog_merchant", + "direct_marketing_combination_catalog_and_retail_merchant", + "direct_marketing_inbound_telemarketing", + "direct_marketing_insurance_services", + "direct_marketing_other", + "direct_marketing_outbound_telemarketing", + "direct_marketing_subscription", + "direct_marketing_travel", + "discount_stores", + "doctors", + "door_to_door_sales", + "drapery_window_covering_and_upholstery_stores", + "drinking_places", + "drug_stores_and_pharmacies", + "drugs_drug_proprietaries_and_druggist_sundries", + "dry_cleaners", + "durable_goods", + "duty_free_stores", + "eating_places_restaurants", + "educational_services", + "electric_razor_stores", + "electric_vehicle_charging", + "electrical_parts_and_equipment", + "electrical_services", + "electronics_repair_shops", + "electronics_stores", + "elementary_secondary_schools", + "emergency_services_gcas_visa_use_only", + "employment_temp_agencies", + "equipment_rental", + "exterminating_services", + "family_clothing_stores", + "fast_food_restaurants", + "financial_institutions", + "fines_government_administrative_entities", + "fireplace_fireplace_screens_and_accessories_stores", + "floor_covering_stores", + "florists", + "florists_supplies_nursery_stock_and_flowers", + "freezer_and_locker_meat_provisioners", + "fuel_dealers_non_automotive", + "funeral_services_crematories", + "furniture_home_furnishings_and_equipment_stores_except_appliances", + "furniture_repair_refinishing", + "furriers_and_fur_shops", + "general_services", + "gift_card_novelty_and_souvenir_shops", + "glass_paint_and_wallpaper_stores", + "glassware_crystal_stores", + "golf_courses_public", + "government_licensed_horse_dog_racing_us_region_only", + "government_licensed_online_casions_online_gambling_us_region_only", + "government_owned_lotteries_non_us_region", + "government_owned_lotteries_us_region_only", + "government_services", + "grocery_stores_supermarkets", + "hardware_equipment_and_supplies", + "hardware_stores", + "health_and_beauty_spas", + "hearing_aids_sales_and_supplies", + "heating_plumbing_a_c", + "hobby_toy_and_game_shops", + "home_supply_warehouse_stores", + "hospitals", + "hotels_motels_and_resorts", + "household_appliance_stores", + "industrial_supplies", + "information_retrieval_services", + "insurance_default", + "insurance_underwriting_premiums", + "intra_company_purchases", + "jewelry_stores_watches_clocks_and_silverware_stores", + "landscaping_services", + "laundries", + "laundry_cleaning_services", + "legal_services_attorneys", + "luggage_and_leather_goods_stores", + "lumber_building_materials_stores", + "manual_cash_disburse", + "marinas_service_and_supplies", + "marketplaces", + "masonry_stonework_and_plaster", + "massage_parlors", + "medical_and_dental_labs", + "medical_dental_ophthalmic_and_hospital_equipment_and_supplies", + "medical_services", + "membership_organizations", + "mens_and_boys_clothing_and_accessories_stores", + "mens_womens_clothing_stores", + "metal_service_centers", + "miscellaneous", + "miscellaneous_apparel_and_accessory_shops", + "miscellaneous_auto_dealers", + "miscellaneous_business_services", + "miscellaneous_food_stores", + "miscellaneous_general_merchandise", + "miscellaneous_general_services", + "miscellaneous_home_furnishing_specialty_stores", + "miscellaneous_publishing_and_printing", + "miscellaneous_recreation_services", + "miscellaneous_repair_shops", + "miscellaneous_specialty_retail", + "mobile_home_dealers", + "motion_picture_theaters", + "motor_freight_carriers_and_trucking", + "motor_homes_dealers", + "motor_vehicle_supplies_and_new_parts", + "motorcycle_shops_and_dealers", + "motorcycle_shops_dealers", + "music_stores_musical_instruments_pianos_and_sheet_music", + "news_dealers_and_newsstands", + "non_fi_money_orders", + "non_fi_stored_value_card_purchase_load", + "nondurable_goods", + "nurseries_lawn_and_garden_supply_stores", + "nursing_personal_care", + "office_and_commercial_furniture", + "opticians_eyeglasses", + "optometrists_ophthalmologist", + "orthopedic_goods_prosthetic_devices", + "osteopaths", + "package_stores_beer_wine_and_liquor", + "paints_varnishes_and_supplies", + "parking_lots_garages", + "passenger_railways", + "pawn_shops", + "pet_shops_pet_food_and_supplies", + "petroleum_and_petroleum_products", + "photo_developing", + "photographic_photocopy_microfilm_equipment_and_supplies", + "photographic_studios", + "picture_video_production", + "piece_goods_notions_and_other_dry_goods", + "plumbing_heating_equipment_and_supplies", + "political_organizations", + "postal_services_government_only", + "precious_stones_and_metals_watches_and_jewelry", + "professional_services", + "public_warehousing_and_storage", + "quick_copy_repro_and_blueprint", + "railroads", + "real_estate_agents_and_managers_rentals", + "record_stores", + "recreational_vehicle_rentals", + "religious_goods_stores", + "religious_organizations", + "roofing_siding_sheet_metal", + "secretarial_support_services", + "security_brokers_dealers", + "service_stations", + "sewing_needlework_fabric_and_piece_goods_stores", + "shoe_repair_hat_cleaning", + "shoe_stores", + "small_appliance_repair", + "snowmobile_dealers", + "special_trade_services", + "specialty_cleaning", + "sporting_goods_stores", + "sporting_recreation_camps", + "sports_and_riding_apparel_stores", + "sports_clubs_fields", + "stamp_and_coin_stores", + "stationary_office_supplies_printing_and_writing_paper", + "stationery_stores_office_and_school_supply_stores", + "swimming_pools_sales", + "t_ui_travel_germany", + "tailors_alterations", + "tax_payments_government_agencies", + "tax_preparation_services", + "taxicabs_limousines", + "telecommunication_equipment_and_telephone_sales", + "telecommunication_services", + "telegraph_services", + "tent_and_awning_shops", + "testing_laboratories", + "theatrical_ticket_agencies", + "timeshares", + "tire_retreading_and_repair", + "tolls_bridge_fees", + "tourist_attractions_and_exhibits", + "towing_services", + "trailer_parks_campgrounds", + "transportation_services", + "travel_agencies_tour_operators", + "truck_stop_iteration", + "truck_utility_trailer_rentals", + "typesetting_plate_making_and_related_services", + "typewriter_stores", + "u_s_federal_government_agencies_or_departments", + "uniforms_commercial_clothing", + "used_merchandise_and_secondhand_stores", + "utilities", + "variety_stores", + "veterinary_services", + "video_amusement_game_supplies", + "video_game_arcades", + "video_tape_rental_stores", + "vocational_trade_schools", + "watch_jewelry_repair", + "welding_repair", + "wholesale_clubs", + "wig_and_toupee_stores", + "wires_money_orders", + "womens_accessory_and_specialty_shops", + "womens_ready_to_wear_stores", + "wrecking_and_salvage_yards", + ]), + ) + .nullable() + .optional(), + blocked_merchant_countries: z + .array(z.string().max(5000)) + .nullable() + .optional(), + spending_limits: z + .array(s_issuing_cardholder_spending_limit) + .nullable() + .optional(), + spending_limits_currency: z.string().nullable().optional(), +}) + +export const s_issuing_cardholder_card_issuing = z.object({ + user_terms_acceptance: s_issuing_cardholder_user_terms_acceptance + .nullable() + .optional(), +}) + +export const s_issuing_network_token_wallet_provider = z.object({ + account_id: z.string().max(5000).optional(), + account_trust_score: z.coerce.number().optional(), + card_number_source: z.enum(["app", "manual", "on_file", "other"]).optional(), + cardholder_address: s_issuing_network_token_address.optional(), + cardholder_name: z.string().max(5000).optional(), + device_trust_score: z.coerce.number().optional(), + hashed_account_email_address: z.string().max(5000).optional(), + reason_codes: z + .array( + z.enum([ + "account_card_too_new", + "account_recently_changed", + "account_too_new", + "account_too_new_since_launch", + "additional_device", + "data_expired", + "defer_id_v_decision", + "device_recently_lost", + "good_activity_history", + "has_suspended_tokens", + "high_risk", + "inactive_account", + "long_account_tenure", + "low_account_score", + "low_device_score", + "low_phone_number_score", + "network_service_error", + "outside_home_territory", + "provisioning_cardholder_mismatch", + "provisioning_device_and_cardholder_mismatch", + "provisioning_device_mismatch", + "same_device_no_prior_authentication", + "same_device_successful_prior_authentication", + "software_update", + "suspicious_activity", + "too_many_different_cardholders", + "too_many_recent_attempts", + "too_many_recent_tokens", + ]), + ) + .optional(), + suggested_decision: z.enum(["approve", "decline", "require_auth"]).optional(), + suggested_decision_version: z.string().max(5000).optional(), +}) + +export const s_issuing_physical_bundle = z.object({ + features: s_issuing_physical_bundle_features, + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000), + object: z.enum(["issuing.physical_bundle"]), + status: z.enum(["active", "inactive", "review"]), + type: z.enum(["custom", "standard"]), +}) + +export const s_issuing_transaction_fleet_reported_breakdown = z.object({ + fuel: s_issuing_transaction_fleet_fuel_price_data.nullable().optional(), + non_fuel: s_issuing_transaction_fleet_non_fuel_price_data + .nullable() + .optional(), + tax: s_issuing_transaction_fleet_tax_data.nullable().optional(), +}) + +export const s_issuing_transaction_flight_data = z.object({ + departure_at: z.coerce.number().nullable().optional(), + passenger_name: z.string().max(5000).nullable().optional(), + refundable: PermissiveBoolean.nullable().optional(), + segments: z + .array(s_issuing_transaction_flight_data_leg) + .nullable() + .optional(), + travel_agency: z.string().max(5000).nullable().optional(), +}) + +export const s_klarna_payer_details = z.object({ + address: s_klarna_address.nullable().optional(), +}) + +export const s_linked_account_options_us_bank_account = z.object({ + filters: + s_payment_flows_private_payment_methods_us_bank_account_linked_account_options_filters.optional(), + permissions: z + .array(z.enum(["balances", "ownership", "payment_method", "transactions"])) + .optional(), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .nullable() + .optional(), + return_url: z.string().max(5000).optional(), +}) + +export const s_mandate_payment_method_details = z.object({ + acss_debit: s_mandate_acss_debit.optional(), + amazon_pay: s_mandate_amazon_pay.optional(), + au_becs_debit: s_mandate_au_becs_debit.optional(), + bacs_debit: s_mandate_bacs_debit.optional(), + card: s_card_mandate_payment_method_details.optional(), + cashapp: s_mandate_cashapp.optional(), + kakao_pay: s_mandate_kakao_pay.optional(), + kr_card: s_mandate_kr_card.optional(), + link: s_mandate_link.optional(), + naver_pay: s_mandate_naver_pay.optional(), + nz_bank_account: s_mandate_nz_bank_account.optional(), + paypal: s_mandate_paypal.optional(), + revolut_pay: s_mandate_revolut_pay.optional(), + sepa_debit: s_mandate_sepa_debit.optional(), + type: z.string().max(5000), + us_bank_account: s_mandate_us_bank_account.optional(), +}) + +export const s_payment_flows_amount_details = z.object({ + tip: s_payment_flows_amount_details_client_resource_tip.optional(), +}) + +export const s_payment_flows_amount_details_client = z.object({ + tip: s_payment_flows_amount_details_client_resource_tip.optional(), +}) + +export const s_payment_flows_installment_options = z.object({ + enabled: PermissiveBoolean, + plan: s_payment_method_details_card_installments_plan.optional(), +}) + +export const s_payment_intent_card_processing = z.object({ + customer_notification: + s_payment_intent_processing_customer_notification.optional(), +}) + +export const s_payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code = + z.object({ + hosted_instructions_url: z.string().max(5000), + mobile_auth_url: z.string().max(5000), + qr_code: s_payment_intent_next_action_cashapp_qr_code, + }) + +export const s_payment_intent_next_action_konbini_stores = z.object({ + familymart: s_payment_intent_next_action_konbini_familymart + .nullable() + .optional(), + lawson: s_payment_intent_next_action_konbini_lawson.nullable().optional(), + ministop: s_payment_intent_next_action_konbini_ministop.nullable().optional(), + seicomart: s_payment_intent_next_action_konbini_seicomart + .nullable() + .optional(), +}) + +export const s_payment_intent_next_action_swish_handle_redirect_or_display_qr_code = + z.object({ + hosted_instructions_url: z.string().max(5000), + qr_code: s_payment_intent_next_action_swish_qr_code, + }) + +export const s_payment_intent_payment_method_options_acss_debit = z.object({ + mandate_options: + s_payment_intent_payment_method_options_mandate_options_acss_debit.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), +}) + +export const s_payment_intent_payment_method_options_bacs_debit = z.object({ + mandate_options: + s_payment_intent_payment_method_options_mandate_options_bacs_debit.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + target_date: z.string().max(5000).optional(), +}) + +export const s_payment_intent_payment_method_options_sepa_debit = z.object({ + mandate_options: + s_payment_intent_payment_method_options_mandate_options_sepa_debit.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + target_date: z.string().max(5000).optional(), +}) + +export const s_payment_links_resource_after_completion = z.object({ + hosted_confirmation: + s_payment_links_resource_completion_behavior_confirmation_page.optional(), + redirect: s_payment_links_resource_completion_behavior_redirect.optional(), + type: z.enum(["hosted_confirmation", "redirect"]), +}) + +export const s_payment_links_resource_consent_collection = z.object({ + payment_method_reuse_agreement: + s_payment_links_resource_payment_method_reuse_agreement + .nullable() + .optional(), + promotions: z.enum(["auto", "none"]).nullable().optional(), + terms_of_service: z.enum(["none", "required"]).nullable().optional(), +}) + +export const s_payment_links_resource_custom_fields_dropdown = z.object({ + default_value: z.string().max(5000).nullable().optional(), + options: z.array(s_payment_links_resource_custom_fields_dropdown_option), +}) + +export const s_payment_links_resource_custom_text = z.object({ + after_submit: s_payment_links_resource_custom_text_position + .nullable() + .optional(), + shipping_address: s_payment_links_resource_custom_text_position + .nullable() + .optional(), + submit: s_payment_links_resource_custom_text_position.nullable().optional(), + terms_of_service_acceptance: s_payment_links_resource_custom_text_position + .nullable() + .optional(), +}) + +export const s_payment_links_resource_optional_item = z.object({ + adjustable_quantity: + s_payment_links_resource_optional_item_adjustable_quantity + .nullable() + .optional(), + price: z.string().max(5000), + quantity: z.coerce.number(), +}) + +export const s_payment_links_resource_restrictions = z.object({ + completed_sessions: s_payment_links_resource_completed_sessions, +}) + +export const s_payment_method_card_present = z.object({ + brand: z.string().max(5000).nullable().optional(), + brand_product: z.string().max(5000).nullable().optional(), + cardholder_name: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + fingerprint: z.string().max(5000).nullable().optional(), + funding: z.string().max(5000).nullable().optional(), + issuer: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + networks: s_payment_method_card_present_networks.nullable().optional(), + offline: s_payment_method_details_card_present_offline.nullable().optional(), + preferred_locales: z.array(z.string().max(5000)).nullable().optional(), + read_method: z + .enum([ + "contact_emv", + "contactless_emv", + "contactless_magstripe_mode", + "magnetic_stripe_fallback", + "magnetic_stripe_track2", + ]) + .nullable() + .optional(), + wallet: + s_payment_flows_private_payment_methods_card_present_common_wallet.optional(), +}) + +export const s_payment_method_card_wallet_masterpass = z.object({ + billing_address: s_address.nullable().optional(), + email: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + shipping_address: s_address.nullable().optional(), +}) + +export const s_payment_method_card_wallet_visa_checkout = z.object({ + billing_address: s_address.nullable().optional(), + email: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + shipping_address: s_address.nullable().optional(), +}) + +export const s_payment_method_config_resource_payment_method_properties = + z.object({ + available: PermissiveBoolean, + display_preference: s_payment_method_config_resource_display_preference, + }) + +export const s_payment_method_details_card_installments = z.object({ + plan: s_payment_method_details_card_installments_plan.nullable().optional(), +}) + +export const s_payment_method_details_card_present = z.object({ + amount_authorized: z.coerce.number().nullable().optional(), + brand: z.string().max(5000).nullable().optional(), + brand_product: z.string().max(5000).nullable().optional(), + capture_before: z.coerce.number().optional(), + cardholder_name: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + emv_auth_data: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + fingerprint: z.string().max(5000).nullable().optional(), + funding: z.string().max(5000).nullable().optional(), + generated_card: z.string().max(5000).nullable().optional(), + incremental_authorization_supported: PermissiveBoolean, + issuer: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + network: z.string().max(5000).nullable().optional(), + network_transaction_id: z.string().max(5000).nullable().optional(), + offline: s_payment_method_details_card_present_offline.nullable().optional(), + overcapture_supported: PermissiveBoolean, + preferred_locales: z.array(z.string().max(5000)).nullable().optional(), + read_method: z + .enum([ + "contact_emv", + "contactless_emv", + "contactless_magstripe_mode", + "magnetic_stripe_fallback", + "magnetic_stripe_track2", + ]) + .nullable() + .optional(), + receipt: s_payment_method_details_card_present_receipt.nullable().optional(), + wallet: + s_payment_flows_private_payment_methods_card_present_common_wallet.optional(), +}) + +export const s_payment_method_details_card_wallet_masterpass = z.object({ + billing_address: s_address.nullable().optional(), + email: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + shipping_address: s_address.nullable().optional(), +}) + +export const s_payment_method_details_card_wallet_visa_checkout = z.object({ + billing_address: s_address.nullable().optional(), + email: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + shipping_address: s_address.nullable().optional(), +}) + +export const s_payment_method_details_interac_present = z.object({ + brand: z.string().max(5000).nullable().optional(), + cardholder_name: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + emv_auth_data: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + fingerprint: z.string().max(5000).nullable().optional(), + funding: z.string().max(5000).nullable().optional(), + generated_card: z.string().max(5000).nullable().optional(), + issuer: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + network: z.string().max(5000).nullable().optional(), + network_transaction_id: z.string().max(5000).nullable().optional(), + preferred_locales: z.array(z.string().max(5000)).nullable().optional(), + read_method: z + .enum([ + "contact_emv", + "contactless_emv", + "contactless_magstripe_mode", + "magnetic_stripe_fallback", + "magnetic_stripe_track2", + ]) + .nullable() + .optional(), + receipt: s_payment_method_details_interac_present_receipt + .nullable() + .optional(), +}) + +export const s_payment_method_details_konbini = z.object({ + store: s_payment_method_details_konbini_store.nullable().optional(), +}) + +export const s_payment_method_details_mobilepay = z.object({ + card: s_internal_card.nullable().optional(), +}) + +export const s_payment_method_details_paypal = z.object({ + country: z.string().max(5000).nullable().optional(), + payer_email: z.string().max(5000).nullable().optional(), + payer_id: z.string().max(5000).nullable().optional(), + payer_name: z.string().max(5000).nullable().optional(), + seller_protection: s_paypal_seller_protection.nullable().optional(), + transaction_id: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_domain_resource_payment_method_status = z.object({ + status: z.enum(["active", "inactive"]), + status_details: + s_payment_method_domain_resource_payment_method_status_details.optional(), +}) + +export const s_payment_method_interac_present = z.object({ + brand: z.string().max(5000).nullable().optional(), + cardholder_name: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + fingerprint: z.string().max(5000).nullable().optional(), + funding: z.string().max(5000).nullable().optional(), + issuer: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + networks: s_payment_method_card_present_networks.nullable().optional(), + preferred_locales: z.array(z.string().max(5000)).nullable().optional(), + read_method: z + .enum([ + "contact_emv", + "contactless_emv", + "contactless_magstripe_mode", + "magnetic_stripe_fallback", + "magnetic_stripe_track2", + ]) + .nullable() + .optional(), +}) + +export const s_payment_method_klarna = z.object({ + dob: s_payment_flows_private_payment_methods_klarna_dob.nullable().optional(), +}) + +export const s_payment_method_options_card_installments = z.object({ + available_plans: z + .array(s_payment_method_details_card_installments_plan) + .nullable() + .optional(), + enabled: PermissiveBoolean, + plan: s_payment_method_details_card_installments_plan.nullable().optional(), +}) + +export const s_payment_method_options_card_present = z.object({ + request_extended_authorization: PermissiveBoolean.nullable().optional(), + request_incremental_authorization_support: + PermissiveBoolean.nullable().optional(), + routing: s_payment_method_options_card_present_routing.optional(), +}) + +export const s_payment_method_options_customer_balance_bank_transfer = z.object( + { + eu_bank_transfer: + s_payment_method_options_customer_balance_eu_bank_account.optional(), + requested_address_types: z + .array( + z.enum(["aba", "iban", "sepa", "sort_code", "spei", "swift", "zengin"]), + ) + .optional(), + type: z + .enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]) + .nullable() + .optional(), + }, +) + +export const s_payment_method_us_bank_account_status_details = z.object({ + blocked: s_payment_method_us_bank_account_blocked.optional(), +}) + +export const s_payment_pages_checkout_session_after_expiration = z.object({ + recovery: s_payment_pages_checkout_session_after_expiration_recovery + .nullable() + .optional(), +}) + +export const s_payment_pages_checkout_session_checkout_address_details = + z.object({ address: s_address, name: z.string().max(5000) }) + +export const s_payment_pages_checkout_session_consent_collection = z.object({ + payment_method_reuse_agreement: + s_payment_pages_checkout_session_payment_method_reuse_agreement + .nullable() + .optional(), + promotions: z.enum(["auto", "none"]).nullable().optional(), + terms_of_service: z.enum(["none", "required"]).nullable().optional(), +}) + +export const s_payment_pages_checkout_session_custom_fields_dropdown = z.object( + { + default_value: z.string().max(5000).nullable().optional(), + options: z.array(s_payment_pages_checkout_session_custom_fields_option), + value: z.string().max(5000).nullable().optional(), + }, +) + +export const s_payment_pages_checkout_session_custom_text = z.object({ + after_submit: s_payment_pages_checkout_session_custom_text_position + .nullable() + .optional(), + shipping_address: s_payment_pages_checkout_session_custom_text_position + .nullable() + .optional(), + submit: s_payment_pages_checkout_session_custom_text_position + .nullable() + .optional(), + terms_of_service_acceptance: + s_payment_pages_checkout_session_custom_text_position.nullable().optional(), +}) + +export const s_payment_pages_checkout_session_customer_details = z.object({ + address: s_address.nullable().optional(), + email: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + phone: z.string().max(5000).nullable().optional(), + tax_exempt: z.enum(["exempt", "none", "reverse"]).nullable().optional(), + tax_ids: z + .array(s_payment_pages_checkout_session_tax_id) + .nullable() + .optional(), +}) + +export const s_payment_pages_checkout_session_optional_item = z.object({ + adjustable_quantity: + s_payment_pages_checkout_session_optional_item_adjustable_quantity + .nullable() + .optional(), + price: z.string().max(5000), + quantity: z.coerce.number(), +}) + +export const s_person_additional_tos_acceptances = z.object({ + account: s_person_additional_tos_acceptance.nullable().optional(), +}) + +export const s_person_future_requirements = z.object({ + alternatives: z + .array(s_account_requirements_alternative) + .nullable() + .optional(), + currently_due: z.array(z.string().max(5000)), + errors: z.array(s_account_requirements_error), + eventually_due: z.array(z.string().max(5000)), + past_due: z.array(z.string().max(5000)), + pending_verification: z.array(z.string().max(5000)), +}) + +export const s_person_requirements = z.object({ + alternatives: z + .array(s_account_requirements_alternative) + .nullable() + .optional(), + currently_due: z.array(z.string().max(5000)), + errors: z.array(s_account_requirements_error), + eventually_due: z.array(z.string().max(5000)), + past_due: z.array(z.string().max(5000)), + pending_verification: z.array(z.string().max(5000)), +}) + +export const s_portal_flows_flow_after_completion = z.object({ + hosted_confirmation: s_portal_flows_after_completion_hosted_confirmation + .nullable() + .optional(), + redirect: s_portal_flows_after_completion_redirect.nullable().optional(), + type: z.enum(["hosted_confirmation", "portal_homepage", "redirect"]), +}) + +export const s_portal_flows_flow_subscription_update_confirm = z.object({ + discounts: z + .array(s_portal_flows_subscription_update_confirm_discount) + .nullable() + .optional(), + items: z.array(s_portal_flows_subscription_update_confirm_item), + subscription: z.string().max(5000), +}) + +export const s_portal_flows_retention = z.object({ + coupon_offer: s_portal_flows_coupon_offer.nullable().optional(), + type: z.enum(["coupon_offer"]), +}) + +export const s_portal_resource_schedule_update_at_period_end = z.object({ + conditions: z.array( + s_portal_resource_schedule_update_at_period_end_condition, + ), +}) + +export const s_portal_subscription_cancel = z.object({ + cancellation_reason: s_portal_subscription_cancellation_reason, + enabled: PermissiveBoolean, + mode: z.enum(["at_period_end", "immediately"]), + proration_behavior: z.enum(["always_invoice", "create_prorations", "none"]), +}) + +export const s_product_feature = z.object({ + entitlement_feature: s_entitlements_feature, + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["product_feature"]), +}) + +export const s_promotion_codes_resource_restrictions = z.object({ + currency_options: z.record(s_promotion_code_currency_option).optional(), + first_time_transaction: PermissiveBoolean, + minimum_amount: z.coerce.number().nullable().optional(), + minimum_amount_currency: z.string().max(5000).nullable().optional(), +}) + +export const s_radar_value_list = z.object({ + alias: z.string().max(5000), + created: z.coerce.number(), + created_by: z.string().max(5000), + id: z.string().max(5000), + item_type: z.enum([ + "card_bin", + "card_fingerprint", + "case_sensitive_string", + "country", + "customer_id", + "email", + "ip_address", + "sepa_debit_fingerprint", + "string", + "us_bank_account_fingerprint", + ]), + list_items: z.object({ + data: z.array(s_radar_value_list_item), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + name: z.string().max(5000), + object: z.enum(["radar.value_list"]), +}) + +export const s_refund_destination_details = z.object({ + affirm: s_destination_details_unimplemented.optional(), + afterpay_clearpay: s_destination_details_unimplemented.optional(), + alipay: s_destination_details_unimplemented.optional(), + alma: s_destination_details_unimplemented.optional(), + amazon_pay: s_destination_details_unimplemented.optional(), + au_bank_transfer: s_destination_details_unimplemented.optional(), + blik: s_refund_destination_details_blik.optional(), + br_bank_transfer: s_refund_destination_details_br_bank_transfer.optional(), + card: s_refund_destination_details_card.optional(), + cashapp: s_destination_details_unimplemented.optional(), + customer_cash_balance: s_destination_details_unimplemented.optional(), + eps: s_destination_details_unimplemented.optional(), + eu_bank_transfer: s_refund_destination_details_eu_bank_transfer.optional(), + gb_bank_transfer: s_refund_destination_details_gb_bank_transfer.optional(), + giropay: s_destination_details_unimplemented.optional(), + grabpay: s_destination_details_unimplemented.optional(), + jp_bank_transfer: s_refund_destination_details_jp_bank_transfer.optional(), + klarna: s_destination_details_unimplemented.optional(), + multibanco: s_refund_destination_details_multibanco.optional(), + mx_bank_transfer: s_refund_destination_details_mx_bank_transfer.optional(), + nz_bank_transfer: s_destination_details_unimplemented.optional(), + p24: s_refund_destination_details_p24.optional(), + paynow: s_destination_details_unimplemented.optional(), + paypal: s_destination_details_unimplemented.optional(), + pix: s_destination_details_unimplemented.optional(), + revolut: s_destination_details_unimplemented.optional(), + sofort: s_destination_details_unimplemented.optional(), + swish: s_refund_destination_details_swish.optional(), + th_bank_transfer: s_refund_destination_details_th_bank_transfer.optional(), + type: z.string().max(5000), + us_bank_transfer: s_refund_destination_details_us_bank_transfer.optional(), + wechat_pay: s_destination_details_unimplemented.optional(), + zip: s_destination_details_unimplemented.optional(), +}) + +export const s_refund_next_action_display_details = z.object({ + email_sent: s_email_sent, + expires_at: z.coerce.number(), +}) + +export const s_revolut_pay_underlying_payment_method_funding_details = z.object( + { + card: s_payment_method_details_passthrough_card.optional(), + type: z.enum(["card"]).nullable().optional(), + }, +) + +export const s_setup_attempt_payment_method_details_card_wallet = z.object({ + apple_pay: s_payment_method_details_card_wallet_apple_pay.optional(), + google_pay: s_payment_method_details_card_wallet_google_pay.optional(), + type: z.enum(["apple_pay", "google_pay", "link"]), +}) + +export const s_setup_intent_payment_method_options_acss_debit = z.object({ + currency: z.enum(["cad", "usd"]).nullable().optional(), + mandate_options: + s_setup_intent_payment_method_options_mandate_options_acss_debit.optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), +}) + +export const s_setup_intent_payment_method_options_bacs_debit = z.object({ + mandate_options: + s_setup_intent_payment_method_options_mandate_options_bacs_debit.optional(), +}) + +export const s_setup_intent_payment_method_options_card = z.object({ + mandate_options: s_setup_intent_payment_method_options_card_mandate_options + .nullable() + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .nullable() + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .nullable() + .optional(), +}) + +export const s_setup_intent_payment_method_options_sepa_debit = z.object({ + mandate_options: + s_setup_intent_payment_method_options_mandate_options_sepa_debit.optional(), +}) + +export const s_shipping = z.object({ + address: s_address.optional(), + carrier: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).optional(), + phone: z.string().max(5000).nullable().optional(), + tracking_number: z.string().max(5000).nullable().optional(), +}) + +export const s_shipping_rate_delivery_estimate = z.object({ + maximum: s_shipping_rate_delivery_estimate_bound.nullable().optional(), + minimum: s_shipping_rate_delivery_estimate_bound.nullable().optional(), +}) + +export const s_shipping_rate_fixed_amount = z.object({ + amount: z.coerce.number(), + currency: z.string(), + currency_options: z.record(s_shipping_rate_currency_option).optional(), +}) + +export const s_source_owner = z.object({ + address: s_address.nullable().optional(), + email: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + phone: z.string().max(5000).nullable().optional(), + verified_address: s_address.nullable().optional(), + verified_email: z.string().max(5000).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), + verified_phone: z.string().max(5000).nullable().optional(), +}) + +export const s_source_transaction = z.object({ + ach_credit_transfer: s_source_transaction_ach_credit_transfer_data.optional(), + amount: z.coerce.number(), + chf_credit_transfer: s_source_transaction_chf_credit_transfer_data.optional(), + created: z.coerce.number(), + currency: z.string(), + gbp_credit_transfer: s_source_transaction_gbp_credit_transfer_data.optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["source_transaction"]), + paper_check: s_source_transaction_paper_check_data.optional(), + sepa_credit_transfer: + s_source_transaction_sepa_credit_transfer_data.optional(), + source: z.string().max(5000), + status: z.string().max(5000), + type: z.enum([ + "ach_credit_transfer", + "ach_debit", + "alipay", + "bancontact", + "card", + "card_present", + "eps", + "giropay", + "ideal", + "klarna", + "multibanco", + "p24", + "sepa_debit", + "sofort", + "three_d_secure", + "wechat", + ]), +}) + +export const s_subscription_payment_method_options_card = z.object({ + mandate_options: s_invoice_mandate_options_card.optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .nullable() + .optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .nullable() + .optional(), +}) + +export const s_subscriptions_trials_resource_trial_settings = z.object({ + end_behavior: s_subscriptions_trials_resource_end_behavior, +}) + +export const s_tax_product_registrations_resource_country_options_canada = + z.object({ + province_standard: + s_tax_product_registrations_resource_country_options_ca_province_standard.optional(), + type: z.enum(["province_standard", "simplified", "standard"]), + }) + +export const s_tax_product_registrations_resource_country_options_europe = + z.object({ + standard: + s_tax_product_registrations_resource_country_options_eu_standard.optional(), + type: z.enum(["ioss", "oss_non_union", "oss_union", "standard"]), + }) + +export const s_tax_product_registrations_resource_country_options_us_state_sales_tax = + z.object({ + elections: z + .array( + s_tax_product_registrations_resource_country_options_us_state_sales_tax_election, + ) + .optional(), + }) + +export const s_tax_product_resource_customer_details = z.object({ + address: s_tax_product_resource_postal_address.nullable().optional(), + address_source: z.enum(["billing", "shipping"]).nullable().optional(), + ip_address: z.string().max(5000).nullable().optional(), + tax_ids: z.array(s_tax_product_resource_customer_details_resource_tax_id), + taxability_override: z.enum(["customer_exempt", "none", "reverse_charge"]), +}) + +export const s_tax_product_resource_line_item_tax_breakdown = z.object({ + amount: z.coerce.number(), + jurisdiction: s_tax_product_resource_jurisdiction, + sourcing: z.enum(["destination", "origin"]), + tax_rate_details: s_tax_product_resource_line_item_tax_rate_details + .nullable() + .optional(), + taxability_reason: z.enum([ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ]), + taxable_amount: z.coerce.number(), +}) + +export const s_tax_product_resource_ship_from_details = z.object({ + address: s_tax_product_resource_postal_address, +}) + +export const s_tax_product_resource_tax_rate_details = z.object({ + country: z.string().max(5000).nullable().optional(), + flat_amount: s_tax_rate_flat_amount.nullable().optional(), + percentage_decimal: z.string().max(5000), + rate_type: z.enum(["flat_amount", "percentage"]).nullable().optional(), + state: z.string().max(5000).nullable().optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "retail_delivery_fee", + "rst", + "sales_tax", + "service_tax", + "vat", + ]) + .nullable() + .optional(), +}) + +export const s_tax_product_resource_tax_settings_head_office = z.object({ + address: s_address, +}) + +export const s_tax_product_resource_tax_settings_status_details = z.object({ + active: + s_tax_product_resource_tax_settings_status_details_resource_active.optional(), + pending: + s_tax_product_resource_tax_settings_status_details_resource_pending.optional(), +}) + +export const s_tax_rate = z.object({ + active: PermissiveBoolean, + country: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + description: z.string().max(5000).nullable().optional(), + display_name: z.string().max(5000), + effective_percentage: z.coerce.number().nullable().optional(), + flat_amount: s_tax_rate_flat_amount.nullable().optional(), + id: z.string().max(5000), + inclusive: PermissiveBoolean, + jurisdiction: z.string().max(5000).nullable().optional(), + jurisdiction_level: z + .enum(["city", "country", "county", "district", "multiple", "state"]) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["tax_rate"]), + percentage: z.coerce.number(), + rate_type: z.enum(["flat_amount", "percentage"]).nullable().optional(), + state: z.string().max(5000).nullable().optional(), + tax_type: z + .enum([ + "amusement_tax", + "communications_tax", + "gst", + "hst", + "igst", + "jct", + "lease_tax", + "pst", + "qst", + "retail_delivery_fee", + "rst", + "sales_tax", + "service_tax", + "vat", + ]) + .nullable() + .optional(), +}) + +export const s_tax_transaction_line_item = z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["tax.transaction_line_item"]), + product: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number(), + reference: z.string().max(5000), + reversal: s_tax_product_resource_tax_transaction_line_item_resource_reversal + .nullable() + .optional(), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_code: z.string().max(5000), + type: z.enum(["reversal", "transaction"]), +}) + +export const s_terminal_configuration_configuration_resource_tipping = z.object( + { + aud: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + cad: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + chf: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + czk: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + dkk: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + eur: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + gbp: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + hkd: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + jpy: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + myr: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + nok: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + nzd: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + pln: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + sek: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + sgd: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + usd: s_terminal_configuration_configuration_resource_currency_specific_config.optional(), + }, +) + +export const s_terminal_configuration_configuration_resource_wifi_config = + z.object({ + enterprise_eap_peap: + s_terminal_configuration_configuration_resource_enterprise_peap_wifi.optional(), + enterprise_eap_tls: + s_terminal_configuration_configuration_resource_enterprise_tls_wifi.optional(), + personal_psk: + s_terminal_configuration_configuration_resource_personal_psk_wifi.optional(), + type: z.enum(["enterprise_eap_peap", "enterprise_eap_tls", "personal_psk"]), + }) + +export const s_terminal_location = z.object({ + address: s_address, + configuration_overrides: z.string().max(5000).optional(), + display_name: z.string().max(5000), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["terminal.location"]), +}) + +export const s_terminal_reader_reader_resource_cart = z.object({ + currency: z.string(), + line_items: z.array(s_terminal_reader_reader_resource_line_item), + tax: z.coerce.number().nullable().optional(), + total: z.coerce.number(), +}) + +export const s_terminal_reader_reader_resource_process_config = z.object({ + enable_customer_cancellation: PermissiveBoolean.optional(), + skip_tipping: PermissiveBoolean.optional(), + tipping: s_terminal_reader_reader_resource_tipping_config.optional(), +}) + +export const s_treasury_financial_accounts_resource_aba_toggle_settings = + z.object({ + requested: PermissiveBoolean, + status: z.enum(["active", "pending", "restricted"]), + status_details: z.array( + s_treasury_financial_accounts_resource_toggles_setting_status_details, + ), + }) + +export const s_treasury_financial_accounts_resource_financial_address = + z.object({ + aba: s_treasury_financial_accounts_resource_aba_record.optional(), + supported_networks: z.array(z.enum(["ach", "us_domestic_wire"])).optional(), + type: z.enum(["aba"]), + }) + +export const s_treasury_financial_accounts_resource_inbound_ach_toggle_settings = + z.object({ + requested: PermissiveBoolean, + status: z.enum(["active", "pending", "restricted"]), + status_details: z.array( + s_treasury_financial_accounts_resource_toggles_setting_status_details, + ), + }) + +export const s_treasury_financial_accounts_resource_outbound_ach_toggle_settings = + z.object({ + requested: PermissiveBoolean, + status: z.enum(["active", "pending", "restricted"]), + status_details: z.array( + s_treasury_financial_accounts_resource_toggles_setting_status_details, + ), + }) + +export const s_treasury_financial_accounts_resource_status_details = z.object({ + closed: s_treasury_financial_accounts_resource_closed_status_details + .nullable() + .optional(), +}) + +export const s_treasury_financial_accounts_resource_toggle_settings = z.object({ + requested: PermissiveBoolean, + status: z.enum(["active", "pending", "restricted"]), + status_details: z.array( + s_treasury_financial_accounts_resource_toggles_setting_status_details, + ), +}) + +export const s_treasury_outbound_payments_resource_outbound_payment_resource_tracking_details = + z.object({ + ach: s_treasury_outbound_payments_resource_ach_tracking_details.optional(), + type: z.enum(["ach", "us_domestic_wire"]), + us_domestic_wire: + s_treasury_outbound_payments_resource_us_domestic_wire_tracking_details.optional(), + }) + +export const s_treasury_outbound_transfers_resource_outbound_transfer_resource_tracking_details = + z.object({ + ach: s_treasury_outbound_transfers_resource_ach_tracking_details.optional(), + type: z.enum(["ach", "us_domestic_wire"]), + us_domestic_wire: + s_treasury_outbound_transfers_resource_us_domestic_wire_tracking_details.optional(), + }) + +export const s_treasury_shared_resource_billing_details = z.object({ + address: s_address, + email: z.string().max(5000).nullable().optional(), + name: z.string().max(5000).nullable().optional(), +}) + +export const s_balance_amount_net = z.object({ + amount: z.coerce.number(), + currency: z.string(), + net_available: z.array(s_balance_net_available).optional(), + source_types: s_balance_amount_by_source_type.optional(), +}) + +export const s_balance_detail = z.object({ + available: z.array(s_balance_amount), +}) + +export const s_billing_bill_resource_invoicing_lines_parents_invoice_line_item_invoice_item_parent = + z.object({ + invoice_item: z.string().max(5000), + proration: PermissiveBoolean, + proration_details: + s_billing_bill_resource_invoicing_lines_common_proration_details + .nullable() + .optional(), + subscription: z.string().max(5000).nullable().optional(), + }) + +export const s_billing_bill_resource_invoicing_lines_parents_invoice_line_item_subscription_item_parent = + z.object({ + invoice_item: z.string().max(5000).nullable().optional(), + proration: PermissiveBoolean, + proration_details: + s_billing_bill_resource_invoicing_lines_common_proration_details + .nullable() + .optional(), + subscription: z.string().max(5000), + subscription_item: z.string().max(5000), + }) + +export const s_billing_credit_grants_resource_applicability_config = z.object({ + scope: s_billing_credit_grants_resource_scope, +}) + +export const s_card_generated_from_payment_method_details = z.object({ + card_present: s_payment_method_details_card_present.optional(), + type: z.string().max(5000), +}) + +export const s_checkout_customer_balance_payment_method_options = z.object({ + bank_transfer: + s_checkout_customer_balance_bank_transfer_payment_method_options.optional(), + funding_type: z.enum(["bank_transfer"]).nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_checkout_us_bank_account_payment_method_options = z.object({ + financial_connections: s_linked_account_options_us_bank_account.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + target_date: z.string().max(5000).optional(), + verification_method: z.enum(["automatic", "instant"]).optional(), +}) + +export const s_climate_product = z.object({ + created: z.coerce.number(), + current_prices_per_metric_ton: z.record(s_climate_removals_products_price), + delivery_year: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metric_tons_available: z.string(), + name: z.string().max(5000), + object: z.enum(["climate.product"]), + suppliers: z.array(s_climate_supplier), +}) + +export const s_climate_removals_order_deliveries = z.object({ + delivered_at: z.coerce.number(), + location: s_climate_removals_location.nullable().optional(), + metric_tons: z.string().max(5000), + registry_url: z.string().max(5000).nullable().optional(), + supplier: s_climate_supplier, +}) + +export const s_confirmation_tokens_resource_mandate_data = z.object({ + customer_acceptance: + s_confirmation_tokens_resource_mandate_data_resource_customer_acceptance, +}) + +export const s_connect_embedded_account_session_create_components = z.object({ + account_management: s_connect_embedded_account_config_claim, + account_onboarding: s_connect_embedded_account_config_claim, + balances: s_connect_embedded_payouts_config, + documents: s_connect_embedded_base_config_claim, + financial_account: s_connect_embedded_financial_account_config_claim, + financial_account_transactions: + s_connect_embedded_financial_account_transactions_config_claim, + issuing_card: s_connect_embedded_issuing_card_config_claim, + issuing_cards_list: s_connect_embedded_issuing_cards_list_config_claim, + notification_banner: s_connect_embedded_account_config_claim, + payment_details: s_connect_embedded_payments_config_claim, + payments: s_connect_embedded_payments_config_claim, + payouts: s_connect_embedded_payouts_config, + payouts_list: s_connect_embedded_base_config_claim, + tax_registrations: s_connect_embedded_base_config_claim, + tax_settings: s_connect_embedded_base_config_claim, +}) + +export const s_country_spec = z.object({ + default_currency: z.string().max(5000), + id: z.string().max(5000), + object: z.enum(["country_spec"]), + supported_bank_account_currencies: z.record(z.array(z.string().max(5000))), + supported_payment_currencies: z.array(z.string().max(5000)), + supported_payment_methods: z.array(z.string().max(5000)), + supported_transfer_countries: z.array(z.string().max(5000)), + verification_fields: s_country_spec_verification_fields, +}) + +export const s_credit_balance = z.object({ + available_balance: s_billing_credit_grants_resource_amount, + ledger_balance: s_billing_credit_grants_resource_amount, +}) + +export const s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction = + z.object({ + bank_transfer: + s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction_resource_bank_transfer, + }) + +export const s_customer_session_resource_components = z.object({ + buy_button: s_customer_session_resource_components_resource_buy_button, + payment_element: + s_customer_session_resource_components_resource_payment_element, + pricing_table: s_customer_session_resource_components_resource_pricing_table, +}) + +export const s_dispute_enhanced_evidence_visa_compelling_evidence3 = z.object({ + disputed_transaction: s_dispute_visa_compelling_evidence3_disputed_transaction + .nullable() + .optional(), + prior_undisputed_transactions: z.array( + s_dispute_visa_compelling_evidence3_prior_undisputed_transaction, + ), +}) + +export const s_dispute_evidence_details = z.object({ + due_by: z.coerce.number().nullable().optional(), + enhanced_eligibility: s_dispute_enhanced_eligibility, + has_evidence: PermissiveBoolean, + past_due: PermissiveBoolean, + submission_count: z.coerce.number(), +}) + +export const s_forwarding_request = z.object({ + created: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["forwarding.request"]), + payment_method: z.string().max(5000), + replacements: z.array( + z.enum([ + "card_cvc", + "card_expiry", + "card_number", + "cardholder_name", + "request_signature", + ]), + ), + request_context: s_forwarded_request_context.nullable().optional(), + request_details: s_forwarded_request_details.nullable().optional(), + response_details: s_forwarded_response_details.nullable().optional(), + url: z.string().max(5000).nullable().optional(), +}) + +export const s_funding_instructions_bank_transfer_financial_address = z.object({ + aba: s_funding_instructions_bank_transfer_aba_record.optional(), + iban: s_funding_instructions_bank_transfer_iban_record.optional(), + sort_code: s_funding_instructions_bank_transfer_sort_code_record.optional(), + spei: s_funding_instructions_bank_transfer_spei_record.optional(), + supported_networks: z + .array( + z.enum([ + "ach", + "bacs", + "domestic_wire_us", + "fps", + "sepa", + "spei", + "swift", + "zengin", + ]), + ) + .optional(), + swift: s_funding_instructions_bank_transfer_swift_record.optional(), + type: z.enum(["aba", "iban", "sort_code", "spei", "swift", "zengin"]), + zengin: s_funding_instructions_bank_transfer_zengin_record.optional(), +}) + +export const s_identity_verification_report = z.object({ + client_reference_id: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + document: s_gelato_document_report.optional(), + email: s_gelato_email_report.optional(), + id: z.string().max(5000), + id_number: s_gelato_id_number_report.optional(), + livemode: PermissiveBoolean, + object: z.enum(["identity.verification_report"]), + options: s_gelato_verification_report_options.optional(), + phone: s_gelato_phone_report.optional(), + selfie: s_gelato_selfie_report.optional(), + type: z.enum(["document", "id_number", "verification_flow"]), + verification_flow: z.string().max(5000).optional(), + verification_session: z.string().max(5000).nullable().optional(), +}) + +export const s_invoice_payment_method_options_customer_balance = z.object({ + bank_transfer: + s_invoice_payment_method_options_customer_balance_bank_transfer.optional(), + funding_type: z.enum(["bank_transfer"]).nullable().optional(), +}) + +export const s_invoice_payment_method_options_us_bank_account = z.object({ + financial_connections: + s_invoice_payment_method_options_us_bank_account_linked_account_options.optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), +}) + +export const s_issuing_authorization_fleet_data = z.object({ + cardholder_prompt_data: s_issuing_authorization_fleet_cardholder_prompt_data + .nullable() + .optional(), + purchase_type: z + .enum(["fuel_and_non_fuel_purchase", "fuel_purchase", "non_fuel_purchase"]) + .nullable() + .optional(), + reported_breakdown: s_issuing_authorization_fleet_reported_breakdown + .nullable() + .optional(), + service_type: z + .enum(["full_service", "non_fuel_transaction", "self_service"]) + .nullable() + .optional(), +}) + +export const s_issuing_card_shipping = z.object({ + address: s_address, + address_validation: s_issuing_card_shipping_address_validation + .nullable() + .optional(), + carrier: z.enum(["dhl", "fedex", "royal_mail", "usps"]).nullable().optional(), + customs: s_issuing_card_shipping_customs.nullable().optional(), + eta: z.coerce.number().nullable().optional(), + name: z.string().max(5000), + phone_number: z.string().max(5000).nullable().optional(), + require_signature: PermissiveBoolean.nullable().optional(), + service: z.enum(["express", "priority", "standard"]), + status: z + .enum([ + "canceled", + "delivered", + "failure", + "pending", + "returned", + "shipped", + "submitted", + ]) + .nullable() + .optional(), + tracking_number: z.string().max(5000).nullable().optional(), + tracking_url: z.string().max(5000).nullable().optional(), + type: z.enum(["bulk", "individual"]), +}) + +export const s_issuing_network_token_network_data = z.object({ + device: s_issuing_network_token_device.optional(), + mastercard: s_issuing_network_token_mastercard.optional(), + type: z.enum(["mastercard", "visa"]), + visa: s_issuing_network_token_visa.optional(), + wallet_provider: s_issuing_network_token_wallet_provider.optional(), +}) + +export const s_issuing_transaction_fleet_data = z.object({ + cardholder_prompt_data: s_issuing_transaction_fleet_cardholder_prompt_data + .nullable() + .optional(), + purchase_type: z.string().max(5000).nullable().optional(), + reported_breakdown: s_issuing_transaction_fleet_reported_breakdown + .nullable() + .optional(), + service_type: z.string().max(5000).nullable().optional(), +}) + +export const s_line_items_tax_amount = z.object({ + amount: z.coerce.number(), + rate: s_tax_rate, + taxability_reason: z + .enum([ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ]) + .nullable() + .optional(), + taxable_amount: z.coerce.number().nullable().optional(), +}) + +export const s_payment_intent_next_action_konbini = z.object({ + expires_at: z.coerce.number(), + hosted_voucher_url: z.string().max(5000).nullable().optional(), + stores: s_payment_intent_next_action_konbini_stores, +}) + +export const s_payment_intent_payment_method_options_card = z.object({ + capture_method: z.enum(["manual"]).optional(), + installments: s_payment_method_options_card_installments + .nullable() + .optional(), + mandate_options: s_payment_method_options_card_mandate_options + .nullable() + .optional(), + network: z + .enum([ + "amex", + "cartes_bancaires", + "diners", + "discover", + "eftpos_au", + "girocard", + "interac", + "jcb", + "link", + "mastercard", + "unionpay", + "unknown", + "visa", + ]) + .nullable() + .optional(), + request_extended_authorization: z.enum(["if_available", "never"]).optional(), + request_incremental_authorization: z + .enum(["if_available", "never"]) + .optional(), + request_multicapture: z.enum(["if_available", "never"]).optional(), + request_overcapture: z.enum(["if_available", "never"]).optional(), + request_three_d_secure: z + .enum(["any", "automatic", "challenge"]) + .nullable() + .optional(), + require_cvc_recollection: PermissiveBoolean.optional(), + setup_future_usage: z.enum(["none", "off_session", "on_session"]).optional(), + statement_descriptor_suffix_kana: z.string().max(5000).optional(), + statement_descriptor_suffix_kanji: z.string().max(5000).optional(), +}) + +export const s_payment_intent_payment_method_options_us_bank_account = z.object( + { + financial_connections: s_linked_account_options_us_bank_account.optional(), + mandate_options: + s_payment_method_options_us_bank_account_mandate_options.optional(), + preferred_settlement_speed: z.enum(["fastest", "standard"]).optional(), + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + target_date: z.string().max(5000).optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }, +) + +export const s_payment_intent_processing = z.object({ + card: s_payment_intent_card_processing.optional(), + type: z.enum(["card"]), +}) + +export const s_payment_intent_type_specific_payment_method_options_client = + z.object({ + capture_method: z.enum(["manual", "manual_preferred"]).optional(), + installments: s_payment_flows_installment_options.optional(), + request_incremental_authorization_support: PermissiveBoolean.optional(), + require_cvc_recollection: PermissiveBoolean.optional(), + routing: s_payment_method_options_card_present_routing.optional(), + setup_future_usage: z + .enum(["none", "off_session", "on_session"]) + .optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), + }) + +export const s_payment_links_resource_custom_fields = z.object({ + dropdown: s_payment_links_resource_custom_fields_dropdown.optional(), + key: z.string().max(5000), + label: s_payment_links_resource_custom_fields_label, + numeric: s_payment_links_resource_custom_fields_numeric.optional(), + optional: PermissiveBoolean, + text: s_payment_links_resource_custom_fields_text.optional(), + type: z.enum(["dropdown", "numeric", "text"]), +}) + +export const s_payment_method_card_wallet = z.object({ + amex_express_checkout: + s_payment_method_card_wallet_amex_express_checkout.optional(), + apple_pay: s_payment_method_card_wallet_apple_pay.optional(), + dynamic_last4: z.string().max(5000).nullable().optional(), + google_pay: s_payment_method_card_wallet_google_pay.optional(), + link: s_payment_method_card_wallet_link.optional(), + masterpass: s_payment_method_card_wallet_masterpass.optional(), + samsung_pay: s_payment_method_card_wallet_samsung_pay.optional(), + type: z.enum([ + "amex_express_checkout", + "apple_pay", + "google_pay", + "link", + "masterpass", + "samsung_pay", + "visa_checkout", + ]), + visa_checkout: s_payment_method_card_wallet_visa_checkout.optional(), +}) + +export const s_payment_method_configuration = z.object({ + acss_debit: + s_payment_method_config_resource_payment_method_properties.optional(), + active: PermissiveBoolean, + affirm: s_payment_method_config_resource_payment_method_properties.optional(), + afterpay_clearpay: + s_payment_method_config_resource_payment_method_properties.optional(), + alipay: s_payment_method_config_resource_payment_method_properties.optional(), + alma: s_payment_method_config_resource_payment_method_properties.optional(), + amazon_pay: + s_payment_method_config_resource_payment_method_properties.optional(), + apple_pay: + s_payment_method_config_resource_payment_method_properties.optional(), + application: z.string().max(5000).nullable().optional(), + au_becs_debit: + s_payment_method_config_resource_payment_method_properties.optional(), + bacs_debit: + s_payment_method_config_resource_payment_method_properties.optional(), + bancontact: + s_payment_method_config_resource_payment_method_properties.optional(), + billie: s_payment_method_config_resource_payment_method_properties.optional(), + blik: s_payment_method_config_resource_payment_method_properties.optional(), + boleto: s_payment_method_config_resource_payment_method_properties.optional(), + card: s_payment_method_config_resource_payment_method_properties.optional(), + cartes_bancaires: + s_payment_method_config_resource_payment_method_properties.optional(), + cashapp: + s_payment_method_config_resource_payment_method_properties.optional(), + customer_balance: + s_payment_method_config_resource_payment_method_properties.optional(), + eps: s_payment_method_config_resource_payment_method_properties.optional(), + fpx: s_payment_method_config_resource_payment_method_properties.optional(), + giropay: + s_payment_method_config_resource_payment_method_properties.optional(), + google_pay: + s_payment_method_config_resource_payment_method_properties.optional(), + grabpay: + s_payment_method_config_resource_payment_method_properties.optional(), + id: z.string().max(5000), + ideal: s_payment_method_config_resource_payment_method_properties.optional(), + is_default: PermissiveBoolean, + jcb: s_payment_method_config_resource_payment_method_properties.optional(), + klarna: s_payment_method_config_resource_payment_method_properties.optional(), + konbini: + s_payment_method_config_resource_payment_method_properties.optional(), + link: s_payment_method_config_resource_payment_method_properties.optional(), + livemode: PermissiveBoolean, + mobilepay: + s_payment_method_config_resource_payment_method_properties.optional(), + multibanco: + s_payment_method_config_resource_payment_method_properties.optional(), + name: z.string().max(5000), + nz_bank_account: + s_payment_method_config_resource_payment_method_properties.optional(), + object: z.enum(["payment_method_configuration"]), + oxxo: s_payment_method_config_resource_payment_method_properties.optional(), + p24: s_payment_method_config_resource_payment_method_properties.optional(), + parent: z.string().max(5000).nullable().optional(), + pay_by_bank: + s_payment_method_config_resource_payment_method_properties.optional(), + paynow: s_payment_method_config_resource_payment_method_properties.optional(), + paypal: s_payment_method_config_resource_payment_method_properties.optional(), + promptpay: + s_payment_method_config_resource_payment_method_properties.optional(), + revolut_pay: + s_payment_method_config_resource_payment_method_properties.optional(), + satispay: + s_payment_method_config_resource_payment_method_properties.optional(), + sepa_debit: + s_payment_method_config_resource_payment_method_properties.optional(), + sofort: s_payment_method_config_resource_payment_method_properties.optional(), + swish: s_payment_method_config_resource_payment_method_properties.optional(), + twint: s_payment_method_config_resource_payment_method_properties.optional(), + us_bank_account: + s_payment_method_config_resource_payment_method_properties.optional(), + wechat_pay: + s_payment_method_config_resource_payment_method_properties.optional(), + zip: s_payment_method_config_resource_payment_method_properties.optional(), +}) + +export const s_payment_method_details_amazon_pay = z.object({ + funding: s_amazon_pay_underlying_payment_method_funding_details.optional(), +}) + +export const s_payment_method_details_card_wallet = z.object({ + amex_express_checkout: + s_payment_method_details_card_wallet_amex_express_checkout.optional(), + apple_pay: s_payment_method_details_card_wallet_apple_pay.optional(), + dynamic_last4: z.string().max(5000).nullable().optional(), + google_pay: s_payment_method_details_card_wallet_google_pay.optional(), + link: s_payment_method_details_card_wallet_link.optional(), + masterpass: s_payment_method_details_card_wallet_masterpass.optional(), + samsung_pay: s_payment_method_details_card_wallet_samsung_pay.optional(), + type: z.enum([ + "amex_express_checkout", + "apple_pay", + "google_pay", + "link", + "masterpass", + "samsung_pay", + "visa_checkout", + ]), + visa_checkout: s_payment_method_details_card_wallet_visa_checkout.optional(), +}) + +export const s_payment_method_details_klarna = z.object({ + payer_details: s_klarna_payer_details.nullable().optional(), + payment_method_category: z.string().max(5000).nullable().optional(), + preferred_locale: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_revolut_pay = z.object({ + funding: s_revolut_pay_underlying_payment_method_funding_details.optional(), +}) + +export const s_payment_method_domain = z.object({ + amazon_pay: s_payment_method_domain_resource_payment_method_status, + apple_pay: s_payment_method_domain_resource_payment_method_status, + created: z.coerce.number(), + domain_name: z.string().max(5000), + enabled: PermissiveBoolean, + google_pay: s_payment_method_domain_resource_payment_method_status, + id: z.string().max(5000), + link: s_payment_method_domain_resource_payment_method_status, + livemode: PermissiveBoolean, + object: z.enum(["payment_method_domain"]), + paypal: s_payment_method_domain_resource_payment_method_status, +}) + +export const s_payment_method_options_customer_balance = z.object({ + bank_transfer: + s_payment_method_options_customer_balance_bank_transfer.optional(), + funding_type: z.enum(["bank_transfer"]).nullable().optional(), + setup_future_usage: z.enum(["none"]).optional(), +}) + +export const s_payment_method_us_bank_account = z.object({ + account_holder_type: z.enum(["company", "individual"]).nullable().optional(), + account_type: z.enum(["checking", "savings"]).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + financial_connections_account: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + networks: s_us_bank_account_networks.nullable().optional(), + routing_number: z.string().max(5000).nullable().optional(), + status_details: s_payment_method_us_bank_account_status_details + .nullable() + .optional(), +}) + +export const s_payment_pages_checkout_session_collected_information = z.object({ + shipping_details: s_payment_pages_checkout_session_checkout_address_details + .nullable() + .optional(), +}) + +export const s_payment_pages_checkout_session_custom_fields = z.object({ + dropdown: s_payment_pages_checkout_session_custom_fields_dropdown.optional(), + key: z.string().max(5000), + label: s_payment_pages_checkout_session_custom_fields_label, + numeric: s_payment_pages_checkout_session_custom_fields_numeric.optional(), + optional: PermissiveBoolean, + text: s_payment_pages_checkout_session_custom_fields_text.optional(), + type: z.enum(["dropdown", "numeric", "text"]), +}) + +export const s_portal_flows_flow_subscription_cancel = z.object({ + retention: s_portal_flows_retention.nullable().optional(), + subscription: z.string().max(5000), +}) + +export const s_portal_subscription_update = z.object({ + default_allowed_updates: z.array( + z.enum(["price", "promotion_code", "quantity"]), + ), + enabled: PermissiveBoolean, + products: z.array(s_portal_subscription_update_product).nullable().optional(), + proration_behavior: z.enum(["always_invoice", "create_prorations", "none"]), + schedule_at_period_end: s_portal_resource_schedule_update_at_period_end, +}) + +export const s_refund_next_action = z.object({ + display_details: s_refund_next_action_display_details.optional(), + type: z.string().max(5000), +}) + +export const s_setup_attempt_payment_method_details_card = z.object({ + brand: z.string().max(5000).nullable().optional(), + checks: s_setup_attempt_payment_method_details_card_checks + .nullable() + .optional(), + country: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number().nullable().optional(), + exp_year: z.coerce.number().nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + funding: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + network: z.string().max(5000).nullable().optional(), + three_d_secure: s_three_d_secure_details.nullable().optional(), + wallet: s_setup_attempt_payment_method_details_card_wallet + .nullable() + .optional(), +}) + +export const s_setup_intent_next_action = z.object({ + cashapp_handle_redirect_or_display_qr_code: + s_payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code.optional(), + redirect_to_url: s_setup_intent_next_action_redirect_to_url.optional(), + type: z.string().max(5000), + use_stripe_sdk: z.object({}).optional(), + verify_with_microdeposits: + s_setup_intent_next_action_verify_with_microdeposits.optional(), +}) + +export const s_setup_intent_payment_method_options_us_bank_account = z.object({ + financial_connections: s_linked_account_options_us_bank_account.optional(), + mandate_options: + s_payment_method_options_us_bank_account_mandate_options.optional(), + verification_method: z + .enum(["automatic", "instant", "microdeposits"]) + .optional(), +}) + +export const s_shipping_rate = z.object({ + active: PermissiveBoolean, + created: z.coerce.number(), + delivery_estimate: s_shipping_rate_delivery_estimate.nullable().optional(), + display_name: z.string().max(5000).nullable().optional(), + fixed_amount: s_shipping_rate_fixed_amount.optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["shipping_rate"]), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .nullable() + .optional(), + tax_code: z + .union([z.string().max(5000), s_tax_code]) + .nullable() + .optional(), + type: z.enum(["fixed_amount"]), +}) + +export const s_source_order = z.object({ + amount: z.coerce.number(), + currency: z.string(), + email: z.string().max(5000).optional(), + items: z.array(s_source_order_item).nullable().optional(), + shipping: s_shipping.optional(), +}) + +export const s_tax_calculation_line_item = z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["tax.calculation_line_item"]), + product: z.string().max(5000).nullable().optional(), + quantity: z.coerce.number(), + reference: z.string().max(5000).nullable().optional(), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_breakdown: z + .array(s_tax_product_resource_line_item_tax_breakdown) + .nullable() + .optional(), + tax_code: z.string().max(5000), +}) + +export const s_tax_product_registrations_resource_country_options_united_states = + z.object({ + local_amusement_tax: + s_tax_product_registrations_resource_country_options_us_local_amusement_tax.optional(), + local_lease_tax: + s_tax_product_registrations_resource_country_options_us_local_lease_tax.optional(), + state: z.string().max(5000), + state_sales_tax: + s_tax_product_registrations_resource_country_options_us_state_sales_tax.optional(), + type: z.enum([ + "local_amusement_tax", + "local_lease_tax", + "state_communications_tax", + "state_retail_delivery_fee", + "state_sales_tax", + ]), + }) + +export const s_tax_product_resource_tax_breakdown = z.object({ + amount: z.coerce.number(), + inclusive: PermissiveBoolean, + tax_rate_details: s_tax_product_resource_tax_rate_details, + taxability_reason: z.enum([ + "customer_exempt", + "not_collecting", + "not_subject_to_tax", + "not_supported", + "portion_product_exempt", + "portion_reduced_rated", + "portion_standard_rated", + "product_exempt", + "product_exempt_holiday", + "proportionally_rated", + "reduced_rated", + "reverse_charge", + "standard_rated", + "taxable_basis_reduced", + "zero_rated", + ]), + taxable_amount: z.coerce.number(), +}) + +export const s_tax_product_resource_tax_calculation_shipping_cost = z.object({ + amount: z.coerce.number(), + amount_tax: z.coerce.number(), + shipping_rate: z.string().max(5000).optional(), + tax_behavior: z.enum(["exclusive", "inclusive"]), + tax_breakdown: z + .array(s_tax_product_resource_line_item_tax_breakdown) + .optional(), + tax_code: z.string().max(5000), +}) + +export const s_tax_settings = z.object({ + defaults: s_tax_product_resource_tax_settings_defaults, + head_office: s_tax_product_resource_tax_settings_head_office + .nullable() + .optional(), + livemode: PermissiveBoolean, + object: z.enum(["tax.settings"]), + status: z.enum(["active", "pending"]), + status_details: s_tax_product_resource_tax_settings_status_details, +}) + +export const s_tax_transaction = z.object({ + created: z.coerce.number(), + currency: z.string().max(5000), + customer: z.string().max(5000).nullable().optional(), + customer_details: s_tax_product_resource_customer_details, + id: z.string().max(5000), + line_items: z + .object({ + data: z.array(s_tax_transaction_line_item), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/tax/transactions/[^/]+/line_items")), + }) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["tax.transaction"]), + posted_at: z.coerce.number(), + reference: z.string().max(5000), + reversal: s_tax_product_resource_tax_transaction_resource_reversal + .nullable() + .optional(), + ship_from_details: s_tax_product_resource_ship_from_details + .nullable() + .optional(), + shipping_cost: s_tax_product_resource_tax_transaction_shipping_cost + .nullable() + .optional(), + tax_date: z.coerce.number(), + type: z.enum(["reversal", "transaction"]), +}) + +export const s_terminal_reader_reader_resource_set_reader_display_action = + z.object({ + cart: s_terminal_reader_reader_resource_cart.nullable().optional(), + type: z.enum(["cart"]), + }) + +export const s_test_helpers_test_clock = z.object({ + created: z.coerce.number(), + deletes_after: z.coerce.number(), + frozen_time: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + name: z.string().max(5000).nullable().optional(), + object: z.enum(["test_helpers.test_clock"]), + status: z.enum(["advancing", "internal_failure", "ready"]), + status_details: s_billing_clocks_resource_status_details_status_details, +}) + +export const s_treasury_financial_accounts_resource_financial_addresses_features = + z.object({ + aba: s_treasury_financial_accounts_resource_aba_toggle_settings.optional(), + }) + +export const s_treasury_financial_accounts_resource_inbound_transfers = + z.object({ + ach: s_treasury_financial_accounts_resource_inbound_ach_toggle_settings.optional(), + }) + +export const s_treasury_financial_accounts_resource_outbound_payments = + z.object({ + ach: s_treasury_financial_accounts_resource_outbound_ach_toggle_settings.optional(), + us_domestic_wire: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + }) + +export const s_treasury_financial_accounts_resource_outbound_transfers = + z.object({ + ach: s_treasury_financial_accounts_resource_outbound_ach_toggle_settings.optional(), + us_domestic_wire: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + }) + +export const s_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details = + z.object({ + balance: z.enum(["payments"]).optional(), + billing_details: s_treasury_shared_resource_billing_details, + financial_account: + s_received_payment_method_details_financial_account.optional(), + issuing_card: z.string().max(5000).optional(), + type: z.enum([ + "balance", + "financial_account", + "issuing_card", + "stripe", + "us_bank_account", + ]), + us_bank_account: + s_treasury_shared_resource_initiating_payment_method_details_us_bank_account.optional(), + }) + +export const s_account_session = z.object({ + account: z.string().max(5000), + client_secret: z.string().max(5000), + components: s_connect_embedded_account_session_create_components, + expires_at: z.coerce.number(), + livemode: PermissiveBoolean, + object: z.enum(["account_session"]), +}) + +export const s_balance = z.object({ + available: z.array(s_balance_amount), + connect_reserved: z.array(s_balance_amount).optional(), + instant_available: z.array(s_balance_amount_net).optional(), + issuing: s_balance_detail.optional(), + livemode: PermissiveBoolean, + object: z.enum(["balance"]), + pending: z.array(s_balance_amount), +}) + +export const s_billing_bill_resource_invoicing_lines_parents_invoice_line_item_parent = + z.object({ + invoice_item_details: + s_billing_bill_resource_invoicing_lines_parents_invoice_line_item_invoice_item_parent + .nullable() + .optional(), + subscription_item_details: + s_billing_bill_resource_invoicing_lines_parents_invoice_line_item_subscription_item_parent + .nullable() + .optional(), + type: z.enum(["invoice_item_details", "subscription_item_details"]), + }) + +export const s_checkout_session_payment_method_options = z.object({ + acss_debit: s_checkout_acss_debit_payment_method_options.optional(), + affirm: s_checkout_affirm_payment_method_options.optional(), + afterpay_clearpay: + s_checkout_afterpay_clearpay_payment_method_options.optional(), + alipay: s_checkout_alipay_payment_method_options.optional(), + amazon_pay: s_checkout_amazon_pay_payment_method_options.optional(), + au_becs_debit: s_checkout_au_becs_debit_payment_method_options.optional(), + bacs_debit: s_checkout_bacs_debit_payment_method_options.optional(), + bancontact: s_checkout_bancontact_payment_method_options.optional(), + boleto: s_checkout_boleto_payment_method_options.optional(), + card: s_checkout_card_payment_method_options.optional(), + cashapp: s_checkout_cashapp_payment_method_options.optional(), + customer_balance: + s_checkout_customer_balance_payment_method_options.optional(), + eps: s_checkout_eps_payment_method_options.optional(), + fpx: s_checkout_fpx_payment_method_options.optional(), + giropay: s_checkout_giropay_payment_method_options.optional(), + grabpay: s_checkout_grab_pay_payment_method_options.optional(), + ideal: s_checkout_ideal_payment_method_options.optional(), + kakao_pay: s_checkout_kakao_pay_payment_method_options.optional(), + klarna: s_checkout_klarna_payment_method_options.optional(), + konbini: s_checkout_konbini_payment_method_options.optional(), + kr_card: s_checkout_kr_card_payment_method_options.optional(), + link: s_checkout_link_payment_method_options.optional(), + mobilepay: s_checkout_mobilepay_payment_method_options.optional(), + multibanco: s_checkout_multibanco_payment_method_options.optional(), + naver_pay: s_checkout_naver_pay_payment_method_options.optional(), + oxxo: s_checkout_oxxo_payment_method_options.optional(), + p24: s_checkout_p24_payment_method_options.optional(), + payco: s_checkout_payco_payment_method_options.optional(), + paynow: s_checkout_paynow_payment_method_options.optional(), + paypal: s_checkout_paypal_payment_method_options.optional(), + pix: s_checkout_pix_payment_method_options.optional(), + revolut_pay: s_checkout_revolut_pay_payment_method_options.optional(), + samsung_pay: s_checkout_samsung_pay_payment_method_options.optional(), + sepa_debit: s_checkout_sepa_debit_payment_method_options.optional(), + sofort: s_checkout_sofort_payment_method_options.optional(), + swish: s_checkout_swish_payment_method_options.optional(), + us_bank_account: s_checkout_us_bank_account_payment_method_options.optional(), +}) + +export const s_climate_order = z.object({ + amount_fees: z.coerce.number(), + amount_subtotal: z.coerce.number(), + amount_total: z.coerce.number(), + beneficiary: s_climate_removals_beneficiary.optional(), + canceled_at: z.coerce.number().nullable().optional(), + cancellation_reason: z + .enum(["expired", "product_unavailable", "requested"]) + .nullable() + .optional(), + certificate: z.string().max(5000).nullable().optional(), + confirmed_at: z.coerce.number().nullable().optional(), + created: z.coerce.number(), + currency: z.string().max(5000), + delayed_at: z.coerce.number().nullable().optional(), + delivered_at: z.coerce.number().nullable().optional(), + delivery_details: z.array(s_climate_removals_order_deliveries), + expected_delivery_year: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + metric_tons: z.string(), + object: z.enum(["climate.order"]), + product: z.union([z.string().max(5000), s_climate_product]), + product_substituted_at: z.coerce.number().nullable().optional(), + status: z.enum([ + "awaiting_funds", + "canceled", + "confirmed", + "delivered", + "open", + ]), +}) + +export const s_dispute_enhanced_evidence = z.object({ + visa_compelling_evidence_3: + s_dispute_enhanced_evidence_visa_compelling_evidence3.optional(), + visa_compliance: s_dispute_enhanced_evidence_visa_compliance.optional(), +}) + +export const s_funding_instructions_bank_transfer = z.object({ + country: z.string().max(5000), + financial_addresses: z.array( + s_funding_instructions_bank_transfer_financial_address, + ), + type: z.enum(["eu_bank_transfer", "jp_bank_transfer"]), +}) + +export const s_identity_verification_session = z.object({ + client_reference_id: z.string().max(5000).nullable().optional(), + client_secret: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + id: z.string().max(5000), + last_error: s_gelato_session_last_error.nullable().optional(), + last_verification_report: z + .union([z.string().max(5000), s_identity_verification_report]) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["identity.verification_session"]), + options: s_gelato_verification_session_options.nullable().optional(), + provided_details: s_gelato_provided_details.nullable().optional(), + redaction: s_verification_session_redaction.nullable().optional(), + related_customer: z.string().max(5000).nullable().optional(), + status: z.enum(["canceled", "processing", "requires_input", "verified"]), + type: z.enum(["document", "id_number", "verification_flow"]), + url: z.string().max(5000).nullable().optional(), + verification_flow: z.string().max(5000).optional(), + verified_outputs: s_gelato_verified_outputs.nullable().optional(), +}) + +export const s_invoices_payment_method_options = z.object({ + acss_debit: s_invoice_payment_method_options_acss_debit.nullable().optional(), + bancontact: s_invoice_payment_method_options_bancontact.nullable().optional(), + card: s_invoice_payment_method_options_card.nullable().optional(), + customer_balance: s_invoice_payment_method_options_customer_balance + .nullable() + .optional(), + konbini: s_invoice_payment_method_options_konbini.nullable().optional(), + sepa_debit: s_invoice_payment_method_options_sepa_debit.nullable().optional(), + us_bank_account: s_invoice_payment_method_options_us_bank_account + .nullable() + .optional(), +}) + +export const s_invoices_resource_shipping_cost = z.object({ + amount_subtotal: z.coerce.number(), + amount_tax: z.coerce.number(), + amount_total: z.coerce.number(), + shipping_rate: z + .union([z.string().max(5000), s_shipping_rate]) + .nullable() + .optional(), + taxes: z.array(s_line_items_tax_amount).optional(), +}) + +export const s_issuing_transaction_purchase_details = z.object({ + fleet: s_issuing_transaction_fleet_data.nullable().optional(), + flight: s_issuing_transaction_flight_data.nullable().optional(), + fuel: s_issuing_transaction_fuel_data.nullable().optional(), + lodging: s_issuing_transaction_lodging_data.nullable().optional(), + receipt: z.array(s_issuing_transaction_receipt_data).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_intent_next_action_display_bank_transfer_instructions = + z.object({ + amount_remaining: z.coerce.number().nullable().optional(), + currency: z.string().nullable().optional(), + financial_addresses: z + .array(s_funding_instructions_bank_transfer_financial_address) + .optional(), + hosted_instructions_url: z.string().max(5000).nullable().optional(), + reference: z.string().max(5000).nullable().optional(), + type: z.enum([ + "eu_bank_transfer", + "gb_bank_transfer", + "jp_bank_transfer", + "mx_bank_transfer", + "us_bank_transfer", + ]), + }) + +export const s_payment_intent_payment_method_options = z.object({ + acss_debit: z + .union([ + s_payment_intent_payment_method_options_acss_debit, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + affirm: z + .union([ + s_payment_method_options_affirm, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + afterpay_clearpay: z + .union([ + s_payment_method_options_afterpay_clearpay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + alipay: z + .union([ + s_payment_method_options_alipay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + alma: z + .union([ + s_payment_method_options_alma, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + amazon_pay: z + .union([ + s_payment_method_options_amazon_pay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + au_becs_debit: z + .union([ + s_payment_intent_payment_method_options_au_becs_debit, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + bacs_debit: z + .union([ + s_payment_intent_payment_method_options_bacs_debit, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + bancontact: z + .union([ + s_payment_method_options_bancontact, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + blik: z + .union([ + s_payment_intent_payment_method_options_blik, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + boleto: z + .union([ + s_payment_method_options_boleto, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + card: z + .union([ + s_payment_intent_payment_method_options_card, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + card_present: z + .union([ + s_payment_method_options_card_present, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + cashapp: z + .union([ + s_payment_method_options_cashapp, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + customer_balance: z + .union([ + s_payment_method_options_customer_balance, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + eps: z + .union([ + s_payment_intent_payment_method_options_eps, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + fpx: z + .union([ + s_payment_method_options_fpx, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + giropay: z + .union([ + s_payment_method_options_giropay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + grabpay: z + .union([ + s_payment_method_options_grabpay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + ideal: z + .union([ + s_payment_method_options_ideal, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + interac_present: z + .union([ + s_payment_method_options_interac_present, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + kakao_pay: z + .union([ + s_payment_flows_private_payment_methods_kakao_pay_payment_method_options, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + klarna: z + .union([ + s_payment_method_options_klarna, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + konbini: z + .union([ + s_payment_method_options_konbini, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + kr_card: z + .union([ + s_payment_method_options_kr_card, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + link: z + .union([ + s_payment_intent_payment_method_options_link, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + mobilepay: z + .union([ + s_payment_intent_payment_method_options_mobilepay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + multibanco: z + .union([ + s_payment_method_options_multibanco, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + naver_pay: z + .union([ + s_payment_flows_private_payment_methods_naver_pay_payment_method_options, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + nz_bank_account: z + .union([ + s_payment_intent_payment_method_options_nz_bank_account, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + oxxo: z + .union([ + s_payment_method_options_oxxo, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + p24: z + .union([ + s_payment_method_options_p24, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + pay_by_bank: z + .union([ + s_payment_method_options_pay_by_bank, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + payco: z + .union([ + s_payment_flows_private_payment_methods_payco_payment_method_options, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + paynow: z + .union([ + s_payment_method_options_paynow, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + paypal: z + .union([ + s_payment_method_options_paypal, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + pix: z + .union([ + s_payment_method_options_pix, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + promptpay: z + .union([ + s_payment_method_options_promptpay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + revolut_pay: z + .union([ + s_payment_method_options_revolut_pay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + samsung_pay: z + .union([ + s_payment_flows_private_payment_methods_samsung_pay_payment_method_options, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + sepa_debit: z + .union([ + s_payment_intent_payment_method_options_sepa_debit, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + sofort: z + .union([ + s_payment_method_options_sofort, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + swish: z + .union([ + s_payment_intent_payment_method_options_swish, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + twint: z + .union([ + s_payment_method_options_twint, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + us_bank_account: z + .union([ + s_payment_intent_payment_method_options_us_bank_account, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + wechat_pay: z + .union([ + s_payment_method_options_wechat_pay, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), + zip: z + .union([ + s_payment_method_options_zip, + s_payment_intent_type_specific_payment_method_options_client, + ]) + .optional(), +}) + +export const s_payment_links_resource_shipping_option = z.object({ + shipping_amount: z.coerce.number(), + shipping_rate: z.union([z.string().max(5000), s_shipping_rate]), +}) + +export const s_payment_method_details_card = z.object({ + amount_authorized: z.coerce.number().nullable().optional(), + authorization_code: z.string().max(5000).nullable().optional(), + brand: z.string().max(5000).nullable().optional(), + capture_before: z.coerce.number().optional(), + checks: s_payment_method_details_card_checks.nullable().optional(), + country: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + extended_authorization: + s_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_extended_authorization_extended_authorization.optional(), + fingerprint: z.string().max(5000).nullable().optional(), + funding: z.string().max(5000).nullable().optional(), + incremental_authorization: + s_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_incremental_authorization_incremental_authorization.optional(), + installments: s_payment_method_details_card_installments + .nullable() + .optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.string().max(5000).nullable().optional(), + multicapture: + s_payment_flows_private_payment_methods_card_details_api_resource_multicapture.optional(), + network: z.string().max(5000).nullable().optional(), + network_token: s_payment_method_details_card_network_token + .nullable() + .optional(), + network_transaction_id: z.string().max(5000).nullable().optional(), + overcapture: + s_payment_flows_private_payment_methods_card_details_api_resource_enterprise_features_overcapture_overcapture.optional(), + regulated_status: z.enum(["regulated", "unregulated"]).nullable().optional(), + three_d_secure: s_three_d_secure_details_charge.nullable().optional(), + wallet: s_payment_method_details_card_wallet.nullable().optional(), +}) + +export const s_payment_pages_checkout_session_shipping_cost = z.object({ + amount_subtotal: z.coerce.number(), + amount_tax: z.coerce.number(), + amount_total: z.coerce.number(), + shipping_rate: z + .union([z.string().max(5000), s_shipping_rate]) + .nullable() + .optional(), + taxes: z.array(s_line_items_tax_amount).optional(), +}) + +export const s_payment_pages_checkout_session_shipping_option = z.object({ + shipping_amount: z.coerce.number(), + shipping_rate: z.union([z.string().max(5000), s_shipping_rate]), +}) + +export const s_portal_features = z.object({ + customer_update: s_portal_customer_update, + invoice_history: s_portal_invoice_list, + payment_method_update: s_portal_payment_method_update, + subscription_cancel: s_portal_subscription_cancel, + subscription_update: s_portal_subscription_update, +}) + +export const s_portal_flows_flow = z.object({ + after_completion: s_portal_flows_flow_after_completion, + subscription_cancel: s_portal_flows_flow_subscription_cancel + .nullable() + .optional(), + subscription_update: s_portal_flows_flow_subscription_update + .nullable() + .optional(), + subscription_update_confirm: s_portal_flows_flow_subscription_update_confirm + .nullable() + .optional(), + type: z.enum([ + "payment_method_update", + "subscription_cancel", + "subscription_update", + "subscription_update_confirm", + ]), +}) + +export const s_setup_intent_payment_method_options = z.object({ + acss_debit: z + .union([ + s_setup_intent_payment_method_options_acss_debit, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), + amazon_pay: z + .union([ + s_setup_intent_payment_method_options_amazon_pay, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), + bacs_debit: z + .union([ + s_setup_intent_payment_method_options_bacs_debit, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), + card: z + .union([ + s_setup_intent_payment_method_options_card, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), + card_present: z + .union([ + s_setup_intent_payment_method_options_card_present, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), + link: z + .union([ + s_setup_intent_payment_method_options_link, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), + paypal: z + .union([ + s_setup_intent_payment_method_options_paypal, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), + sepa_debit: z + .union([ + s_setup_intent_payment_method_options_sepa_debit, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), + us_bank_account: z + .union([ + s_setup_intent_payment_method_options_us_bank_account, + s_setup_intent_type_specific_payment_method_options_client, + ]) + .optional(), +}) + +export const s_source = z.object({ + ach_credit_transfer: s_source_type_ach_credit_transfer.optional(), + ach_debit: s_source_type_ach_debit.optional(), + acss_debit: s_source_type_acss_debit.optional(), + alipay: s_source_type_alipay.optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .nullable() + .optional(), + amount: z.coerce.number().nullable().optional(), + au_becs_debit: s_source_type_au_becs_debit.optional(), + bancontact: s_source_type_bancontact.optional(), + card: s_source_type_card.optional(), + card_present: s_source_type_card_present.optional(), + client_secret: z.string().max(5000), + code_verification: s_source_code_verification_flow.optional(), + created: z.coerce.number(), + currency: z.string().nullable().optional(), + customer: z.string().max(5000).optional(), + eps: s_source_type_eps.optional(), + flow: z.string().max(5000), + giropay: s_source_type_giropay.optional(), + id: z.string().max(5000), + ideal: s_source_type_ideal.optional(), + klarna: s_source_type_klarna.optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + multibanco: s_source_type_multibanco.optional(), + object: z.enum(["source"]), + owner: s_source_owner.nullable().optional(), + p24: s_source_type_p24.optional(), + receiver: s_source_receiver_flow.optional(), + redirect: s_source_redirect_flow.optional(), + sepa_debit: s_source_type_sepa_debit.optional(), + sofort: s_source_type_sofort.optional(), + source_order: s_source_order.optional(), + statement_descriptor: z.string().max(5000).nullable().optional(), + status: z.string().max(5000), + three_d_secure: s_source_type_three_d_secure.optional(), + type: z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "alipay", + "au_becs_debit", + "bancontact", + "card", + "card_present", + "eps", + "giropay", + "ideal", + "klarna", + "multibanco", + "p24", + "sepa_debit", + "sofort", + "three_d_secure", + "wechat", + ]), + usage: z.string().max(5000).nullable().optional(), + wechat: s_source_type_wechat.optional(), +}) + +export const s_subscriptions_resource_payment_method_options = z.object({ + acss_debit: s_invoice_payment_method_options_acss_debit.nullable().optional(), + bancontact: s_invoice_payment_method_options_bancontact.nullable().optional(), + card: s_subscription_payment_method_options_card.nullable().optional(), + customer_balance: s_invoice_payment_method_options_customer_balance + .nullable() + .optional(), + konbini: s_invoice_payment_method_options_konbini.nullable().optional(), + sepa_debit: s_invoice_payment_method_options_sepa_debit.nullable().optional(), + us_bank_account: s_invoice_payment_method_options_us_bank_account + .nullable() + .optional(), +}) + +export const s_tax_calculation = z.object({ + amount_total: z.coerce.number(), + currency: z.string().max(5000), + customer: z.string().max(5000).nullable().optional(), + customer_details: s_tax_product_resource_customer_details, + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000).nullable().optional(), + line_items: z + .object({ + data: z.array(s_tax_calculation_line_item), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/tax/calculations/[^/]+/line_items")), + }) + .nullable() + .optional(), + livemode: PermissiveBoolean, + object: z.enum(["tax.calculation"]), + ship_from_details: s_tax_product_resource_ship_from_details + .nullable() + .optional(), + shipping_cost: s_tax_product_resource_tax_calculation_shipping_cost + .nullable() + .optional(), + tax_amount_exclusive: z.coerce.number(), + tax_amount_inclusive: z.coerce.number(), + tax_breakdown: z.array(s_tax_product_resource_tax_breakdown), + tax_date: z.coerce.number(), +}) + +export const s_tax_product_registrations_resource_country_options = z.object({ + ae: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), + al: s_tax_product_registrations_resource_country_options_default.optional(), + am: s_tax_product_registrations_resource_country_options_simplified.optional(), + ao: s_tax_product_registrations_resource_country_options_default.optional(), + at: s_tax_product_registrations_resource_country_options_europe.optional(), + au: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), + ba: s_tax_product_registrations_resource_country_options_default.optional(), + bb: s_tax_product_registrations_resource_country_options_default.optional(), + be: s_tax_product_registrations_resource_country_options_europe.optional(), + bg: s_tax_product_registrations_resource_country_options_europe.optional(), + bh: s_tax_product_registrations_resource_country_options_default.optional(), + bs: s_tax_product_registrations_resource_country_options_default.optional(), + by: s_tax_product_registrations_resource_country_options_simplified.optional(), + ca: s_tax_product_registrations_resource_country_options_canada.optional(), + cd: s_tax_product_registrations_resource_country_options_default.optional(), + ch: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), + cl: s_tax_product_registrations_resource_country_options_simplified.optional(), + co: s_tax_product_registrations_resource_country_options_simplified.optional(), + cr: s_tax_product_registrations_resource_country_options_simplified.optional(), + cy: s_tax_product_registrations_resource_country_options_europe.optional(), + cz: s_tax_product_registrations_resource_country_options_europe.optional(), + de: s_tax_product_registrations_resource_country_options_europe.optional(), + dk: s_tax_product_registrations_resource_country_options_europe.optional(), + ec: s_tax_product_registrations_resource_country_options_simplified.optional(), + ee: s_tax_product_registrations_resource_country_options_europe.optional(), + eg: s_tax_product_registrations_resource_country_options_simplified.optional(), + es: s_tax_product_registrations_resource_country_options_europe.optional(), + fi: s_tax_product_registrations_resource_country_options_europe.optional(), + fr: s_tax_product_registrations_resource_country_options_europe.optional(), + gb: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), + ge: s_tax_product_registrations_resource_country_options_simplified.optional(), + gn: s_tax_product_registrations_resource_country_options_default.optional(), + gr: s_tax_product_registrations_resource_country_options_europe.optional(), + hr: s_tax_product_registrations_resource_country_options_europe.optional(), + hu: s_tax_product_registrations_resource_country_options_europe.optional(), + id: s_tax_product_registrations_resource_country_options_simplified.optional(), + ie: s_tax_product_registrations_resource_country_options_europe.optional(), + is: s_tax_product_registrations_resource_country_options_default.optional(), + it: s_tax_product_registrations_resource_country_options_europe.optional(), + jp: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), + ke: s_tax_product_registrations_resource_country_options_simplified.optional(), + kh: s_tax_product_registrations_resource_country_options_simplified.optional(), + kr: s_tax_product_registrations_resource_country_options_simplified.optional(), + kz: s_tax_product_registrations_resource_country_options_simplified.optional(), + lt: s_tax_product_registrations_resource_country_options_europe.optional(), + lu: s_tax_product_registrations_resource_country_options_europe.optional(), + lv: s_tax_product_registrations_resource_country_options_europe.optional(), + ma: s_tax_product_registrations_resource_country_options_simplified.optional(), + md: s_tax_product_registrations_resource_country_options_simplified.optional(), + me: s_tax_product_registrations_resource_country_options_default.optional(), + mk: s_tax_product_registrations_resource_country_options_default.optional(), + mr: s_tax_product_registrations_resource_country_options_default.optional(), + mt: s_tax_product_registrations_resource_country_options_europe.optional(), + mx: s_tax_product_registrations_resource_country_options_simplified.optional(), + my: s_tax_product_registrations_resource_country_options_simplified.optional(), + ng: s_tax_product_registrations_resource_country_options_simplified.optional(), + nl: s_tax_product_registrations_resource_country_options_europe.optional(), + no: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), + np: s_tax_product_registrations_resource_country_options_simplified.optional(), + nz: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), + om: s_tax_product_registrations_resource_country_options_default.optional(), + pe: s_tax_product_registrations_resource_country_options_simplified.optional(), + pl: s_tax_product_registrations_resource_country_options_europe.optional(), + pt: s_tax_product_registrations_resource_country_options_europe.optional(), + ro: s_tax_product_registrations_resource_country_options_europe.optional(), + rs: s_tax_product_registrations_resource_country_options_default.optional(), + ru: s_tax_product_registrations_resource_country_options_simplified.optional(), + sa: s_tax_product_registrations_resource_country_options_simplified.optional(), + se: s_tax_product_registrations_resource_country_options_europe.optional(), + sg: s_tax_product_registrations_resource_country_options_default_inbound_goods.optional(), + si: s_tax_product_registrations_resource_country_options_europe.optional(), + sk: s_tax_product_registrations_resource_country_options_europe.optional(), + sn: s_tax_product_registrations_resource_country_options_simplified.optional(), + sr: s_tax_product_registrations_resource_country_options_default.optional(), + th: s_tax_product_registrations_resource_country_options_simplified.optional(), + tj: s_tax_product_registrations_resource_country_options_simplified.optional(), + tr: s_tax_product_registrations_resource_country_options_simplified.optional(), + tz: s_tax_product_registrations_resource_country_options_simplified.optional(), + ug: s_tax_product_registrations_resource_country_options_simplified.optional(), + us: s_tax_product_registrations_resource_country_options_united_states.optional(), + uy: s_tax_product_registrations_resource_country_options_default.optional(), + uz: s_tax_product_registrations_resource_country_options_simplified.optional(), + vn: s_tax_product_registrations_resource_country_options_simplified.optional(), + za: s_tax_product_registrations_resource_country_options_default.optional(), + zm: s_tax_product_registrations_resource_country_options_simplified.optional(), + zw: s_tax_product_registrations_resource_country_options_default.optional(), +}) + +export const s_treasury_financial_account_features = z.object({ + card_issuing: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + deposit_insurance: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + financial_addresses: + s_treasury_financial_accounts_resource_financial_addresses_features.optional(), + inbound_transfers: + s_treasury_financial_accounts_resource_inbound_transfers.optional(), + intra_stripe_flows: + s_treasury_financial_accounts_resource_toggle_settings.optional(), + object: z.enum(["treasury.financial_account_features"]), + outbound_payments: + s_treasury_financial_accounts_resource_outbound_payments.optional(), + outbound_transfers: + s_treasury_financial_accounts_resource_outbound_transfers.optional(), +}) + +export const s_billing_portal_configuration = z.object({ + active: PermissiveBoolean, + application: z + .union([z.string().max(5000), s_application, s_deleted_application]) + .nullable() + .optional(), + business_profile: s_portal_business_profile, + created: z.coerce.number(), + default_return_url: z.string().max(5000).nullable().optional(), + features: s_portal_features, + id: z.string().max(5000), + is_default: PermissiveBoolean, + livemode: PermissiveBoolean, + login_page: s_portal_login_page, + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["billing_portal.configuration"]), + updated: z.coerce.number(), +}) + +export const s_funding_instructions = z.object({ + bank_transfer: s_funding_instructions_bank_transfer, + currency: z.string().max(5000), + funding_type: z.enum(["bank_transfer"]), + livemode: PermissiveBoolean, + object: z.enum(["funding_instructions"]), +}) + +export const s_invoices_payment_settings = z.object({ + default_mandate: z.string().max(5000).nullable().optional(), + payment_method_options: s_invoices_payment_method_options + .nullable() + .optional(), + payment_method_types: z + .array( + z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "jp_credit_transfer", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "multibanco", + "naver_pay", + "nz_bank_account", + "p24", + "payco", + "paynow", + "paypal", + "promptpay", + "revolut_pay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "swish", + "us_bank_account", + "wechat_pay", + ]), + ) + .nullable() + .optional(), +}) + +export const s_payment_intent_next_action = z.object({ + alipay_handle_redirect: + s_payment_intent_next_action_alipay_handle_redirect.optional(), + boleto_display_details: s_payment_intent_next_action_boleto.optional(), + card_await_notification: + s_payment_intent_next_action_card_await_notification.optional(), + cashapp_handle_redirect_or_display_qr_code: + s_payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code.optional(), + display_bank_transfer_instructions: + s_payment_intent_next_action_display_bank_transfer_instructions.optional(), + konbini_display_details: s_payment_intent_next_action_konbini.optional(), + multibanco_display_details: + s_payment_intent_next_action_display_multibanco_details.optional(), + oxxo_display_details: + s_payment_intent_next_action_display_oxxo_details.optional(), + paynow_display_qr_code: + s_payment_intent_next_action_paynow_display_qr_code.optional(), + pix_display_qr_code: + s_payment_intent_next_action_pix_display_qr_code.optional(), + promptpay_display_qr_code: + s_payment_intent_next_action_promptpay_display_qr_code.optional(), + redirect_to_url: s_payment_intent_next_action_redirect_to_url.optional(), + swish_handle_redirect_or_display_qr_code: + s_payment_intent_next_action_swish_handle_redirect_or_display_qr_code.optional(), + type: z.string().max(5000), + use_stripe_sdk: z.object({}).optional(), + verify_with_microdeposits: + s_payment_intent_next_action_verify_with_microdeposits.optional(), + wechat_pay_display_qr_code: + s_payment_intent_next_action_wechat_pay_display_qr_code.optional(), + wechat_pay_redirect_to_android_app: + s_payment_intent_next_action_wechat_pay_redirect_to_android_app.optional(), + wechat_pay_redirect_to_ios_app: + s_payment_intent_next_action_wechat_pay_redirect_to_ios_app.optional(), +}) + +export const s_source_mandate_notification = z.object({ + acss_debit: s_source_mandate_notification_acss_debit_data.optional(), + amount: z.coerce.number().nullable().optional(), + bacs_debit: s_source_mandate_notification_bacs_debit_data.optional(), + created: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["source_mandate_notification"]), + reason: z.string().max(5000), + sepa_debit: s_source_mandate_notification_sepa_debit_data.optional(), + source: s_source, + status: z.string().max(5000), + type: z.string().max(5000), +}) + +export const s_subscriptions_resource_payment_settings = z.object({ + payment_method_options: s_subscriptions_resource_payment_method_options + .nullable() + .optional(), + payment_method_types: z + .array( + z.enum([ + "ach_credit_transfer", + "ach_debit", + "acss_debit", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "boleto", + "card", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "jp_credit_transfer", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "multibanco", + "naver_pay", + "nz_bank_account", + "p24", + "payco", + "paynow", + "paypal", + "promptpay", + "revolut_pay", + "sepa_credit_transfer", + "sepa_debit", + "sofort", + "swish", + "us_bank_account", + "wechat_pay", + ]), + ) + .nullable() + .optional(), + save_default_payment_method: z + .enum(["off", "on_subscription"]) + .nullable() + .optional(), +}) + +export const s_tax_registration = z.object({ + active_from: z.coerce.number(), + country: z.string().max(5000), + country_options: s_tax_product_registrations_resource_country_options, + created: z.coerce.number(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["tax.registration"]), + status: z.enum(["active", "expired", "scheduled"]), +}) + +export const s_treasury_financial_account = z.object({ + active_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + balance: s_treasury_financial_accounts_resource_balance, + country: z.string().max(5000), + created: z.coerce.number(), + features: s_treasury_financial_account_features.optional(), + financial_addresses: z.array( + s_treasury_financial_accounts_resource_financial_address, + ), + id: z.string().max(5000), + is_default: PermissiveBoolean.optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + nickname: z.string().max(5000).nullable().optional(), + object: z.enum(["treasury.financial_account"]), + pending_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + platform_restrictions: + s_treasury_financial_accounts_resource_platform_restrictions + .nullable() + .optional(), + restricted_features: z + .array( + z.enum([ + "card_issuing", + "deposit_insurance", + "financial_addresses.aba", + "financial_addresses.aba.forwarding", + "inbound_transfers.ach", + "intra_stripe_flows", + "outbound_payments.ach", + "outbound_payments.us_domestic_wire", + "outbound_transfers.ach", + "outbound_transfers.us_domestic_wire", + "remote_deposit_capture", + ]), + ) + .optional(), + status: z.enum(["closed", "open"]), + status_details: s_treasury_financial_accounts_resource_status_details, + supported_currencies: z.array(z.string()), +}) + +export const s_billing_portal_session = z.object({ + configuration: z.union([ + z.string().max(5000), + s_billing_portal_configuration, + ]), + created: z.coerce.number(), + customer: z.string().max(5000), + flow: s_portal_flows_flow.nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + locale: z + .enum([ + "auto", + "bg", + "cs", + "da", + "de", + "el", + "en", + "en-AU", + "en-CA", + "en-GB", + "en-IE", + "en-IN", + "en-NZ", + "en-SG", + "es", + "es-419", + "et", + "fi", + "fil", + "fr", + "fr-CA", + "hr", + "hu", + "id", + "it", + "ja", + "ko", + "lt", + "lv", + "ms", + "mt", + "nb", + "nl", + "pl", + "pt", + "pt-BR", + "ro", + "ru", + "sk", + "sl", + "sv", + "th", + "tr", + "vi", + "zh", + "zh-HK", + "zh-TW", + ]) + .nullable() + .optional(), + object: z.enum(["billing_portal.session"]), + on_behalf_of: z.string().max(5000).nullable().optional(), + return_url: z.string().max(5000).nullable().optional(), + url: z.string().max(5000), +}) + +export const s_account: z.ZodType = z.object({ + business_profile: s_account_business_profile.nullable().optional(), + business_type: z + .enum(["company", "government_entity", "individual", "non_profit"]) + .nullable() + .optional(), + capabilities: s_account_capabilities.optional(), + charges_enabled: PermissiveBoolean.optional(), + company: z.lazy(() => s_legal_entity_company.optional()), + controller: s_account_unification_account_controller.optional(), + country: z.string().max(5000).optional(), + created: z.coerce.number().optional(), + default_currency: z.string().max(5000).optional(), + details_submitted: PermissiveBoolean.optional(), + email: z.string().max(5000).nullable().optional(), + external_accounts: z + .object({ + data: z.array( + z.union([z.lazy(() => s_bank_account), z.lazy(() => s_card)]), + ), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + future_requirements: s_account_future_requirements.optional(), + groups: s_account_group_membership.nullable().optional(), + id: z.string().max(5000), + individual: z.lazy(() => s_person.optional()), + metadata: z.record(z.string().max(500)).optional(), + object: z.enum(["account"]), + payouts_enabled: PermissiveBoolean.optional(), + requirements: s_account_requirements.optional(), + settings: z.lazy(() => s_account_settings.nullable().optional()), + tos_acceptance: s_account_tos_acceptance.optional(), + type: z.enum(["custom", "express", "none", "standard"]).optional(), +}) + +export const s_error: z.ZodType = z.object({ + error: z.lazy(() => s_api_errors), +}) + +export const s_external_account: z.ZodType< + t_external_account, + z.ZodTypeDef, + unknown +> = z.union([z.lazy(() => s_bank_account), z.lazy(() => s_card)]) + +export const s_capability: z.ZodType = + z.object({ + account: z.union([z.string().max(5000), z.lazy(() => s_account)]), + future_requirements: s_account_capability_future_requirements.optional(), + id: z.string().max(5000), + object: z.enum(["capability"]), + requested: PermissiveBoolean, + requested_at: z.coerce.number().nullable().optional(), + requirements: s_account_capability_requirements.optional(), + status: z.enum([ + "active", + "disabled", + "inactive", + "pending", + "unrequested", + ]), + }) + +export const s_bank_account: z.ZodType = + z.object({ + account: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + account_holder_name: z.string().max(5000).nullable().optional(), + account_holder_type: z.string().max(5000).nullable().optional(), + account_type: z.string().max(5000).nullable().optional(), + available_payout_methods: z + .array(z.enum(["instant", "standard"])) + .nullable() + .optional(), + bank_name: z.string().max(5000).nullable().optional(), + country: z.string().max(5000), + currency: z.string(), + customer: z + .union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]) + .nullable() + .optional(), + default_for_currency: PermissiveBoolean.nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + future_requirements: s_external_account_requirements.nullable().optional(), + id: z.string().max(5000), + last4: z.string().max(5000), + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["bank_account"]), + requirements: s_external_account_requirements.nullable().optional(), + routing_number: z.string().max(5000).nullable().optional(), + status: z.string().max(5000), + }) + +export const s_card: z.ZodType = z.object({ + account: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + address_city: z.string().max(5000).nullable().optional(), + address_country: z.string().max(5000).nullable().optional(), + address_line1: z.string().max(5000).nullable().optional(), + address_line1_check: z.string().max(5000).nullable().optional(), + address_line2: z.string().max(5000).nullable().optional(), + address_state: z.string().max(5000).nullable().optional(), + address_zip: z.string().max(5000).nullable().optional(), + address_zip_check: z.string().max(5000).nullable().optional(), + allow_redisplay: z + .enum(["always", "limited", "unspecified"]) + .nullable() + .optional(), + available_payout_methods: z + .array(z.enum(["instant", "standard"])) + .nullable() + .optional(), + brand: z.string().max(5000), + country: z.string().max(5000).nullable().optional(), + currency: z.string().nullable().optional(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer), s_deleted_customer]) + .nullable() + .optional(), + cvc_check: z.string().max(5000).nullable().optional(), + default_for_currency: PermissiveBoolean.nullable().optional(), + dynamic_last4: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + fingerprint: z.string().max(5000).nullable().optional(), + funding: z.string().max(5000), + id: z.string().max(5000), + iin: z.string().max(5000).optional(), + last4: z.string().max(5000), + metadata: z.record(z.string().max(500)).nullable().optional(), + name: z.string().max(5000).nullable().optional(), + networks: s_token_card_networks.optional(), + object: z.enum(["card"]), + regulated_status: z.enum(["regulated", "unregulated"]).nullable().optional(), + status: z.string().max(5000).nullable().optional(), + tokenization_method: z.string().max(5000).nullable().optional(), +}) + +export const s_person: z.ZodType = z.object({ + account: z.string().max(5000), + additional_tos_acceptances: s_person_additional_tos_acceptances.optional(), + address: s_address.optional(), + address_kana: s_legal_entity_japan_address.nullable().optional(), + address_kanji: s_legal_entity_japan_address.nullable().optional(), + created: z.coerce.number(), + dob: s_legal_entity_dob.optional(), + email: z.string().max(5000).nullable().optional(), + first_name: z.string().max(5000).nullable().optional(), + first_name_kana: z.string().max(5000).nullable().optional(), + first_name_kanji: z.string().max(5000).nullable().optional(), + full_name_aliases: z.array(z.string().max(5000)).optional(), + future_requirements: s_person_future_requirements.nullable().optional(), + gender: z.string().nullable().optional(), + id: z.string().max(5000), + id_number_provided: PermissiveBoolean.optional(), + id_number_secondary_provided: PermissiveBoolean.optional(), + last_name: z.string().max(5000).nullable().optional(), + last_name_kana: z.string().max(5000).nullable().optional(), + last_name_kanji: z.string().max(5000).nullable().optional(), + maiden_name: z.string().max(5000).nullable().optional(), + metadata: z.record(z.string().max(500)).optional(), + nationality: z.string().max(5000).nullable().optional(), + object: z.enum(["person"]), + phone: z.string().max(5000).nullable().optional(), + political_exposure: z.enum(["existing", "none"]).optional(), + registered_address: s_address.optional(), + relationship: s_person_relationship.optional(), + requirements: s_person_requirements.nullable().optional(), + ssn_last_4_provided: PermissiveBoolean.optional(), + verification: z.lazy(() => s_legal_entity_person_verification.optional()), +}) + +export const s_application_fee: z.ZodType< + t_application_fee, + z.ZodTypeDef, + unknown +> = z.object({ + account: z.union([z.string().max(5000), z.lazy(() => s_account)]), + amount: z.coerce.number(), + amount_refunded: z.coerce.number(), + application: z.union([z.string().max(5000), s_application]), + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + charge: z.union([z.string().max(5000), z.lazy(() => s_charge)]), + created: z.coerce.number(), + currency: z.string(), + fee_source: s_platform_earning_fee_source.nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["application_fee"]), + originating_transaction: z + .union([z.string().max(5000), z.lazy(() => s_charge)]) + .nullable() + .optional(), + refunded: PermissiveBoolean, + refunds: z.object({ + data: z.array(z.lazy(() => s_fee_refund)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), +}) + +export const s_fee_refund: z.ZodType = + z.object({ + amount: z.coerce.number(), + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + fee: z.union([z.string().max(5000), z.lazy(() => s_application_fee)]), + id: z.string().max(5000), + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["fee_refund"]), + }) + +export const s_balance_transaction: z.ZodType< + t_balance_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + available_on: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + exchange_rate: z.coerce.number().nullable().optional(), + fee: z.coerce.number(), + fee_details: z.array(s_fee), + id: z.string().max(5000), + net: z.coerce.number(), + object: z.enum(["balance_transaction"]), + reporting_category: z.string().max(5000), + source: z + .union([ + z.string().max(5000), + z.lazy(() => s_application_fee), + z.lazy(() => s_charge), + z.lazy(() => s_connect_collection_transfer), + z.lazy(() => s_customer_cash_balance_transaction), + z.lazy(() => s_dispute), + z.lazy(() => s_fee_refund), + z.lazy(() => s_issuing_authorization), + z.lazy(() => s_issuing_dispute), + z.lazy(() => s_issuing_transaction), + z.lazy(() => s_payout), + z.lazy(() => s_refund), + s_reserve_transaction, + s_tax_deducted_at_source, + z.lazy(() => s_topup), + z.lazy(() => s_transfer), + z.lazy(() => s_transfer_reversal), + ]) + .nullable() + .optional(), + status: z.string().max(5000), + type: z.enum([ + "adjustment", + "advance", + "advance_funding", + "anticipation_repayment", + "application_fee", + "application_fee_refund", + "charge", + "climate_order_purchase", + "climate_order_refund", + "connect_collection_transfer", + "contribution", + "issuing_authorization_hold", + "issuing_authorization_release", + "issuing_dispute", + "issuing_transaction", + "obligation_outbound", + "obligation_reversal_inbound", + "payment", + "payment_failure_refund", + "payment_network_reserve_hold", + "payment_network_reserve_release", + "payment_refund", + "payment_reversal", + "payment_unreconciled", + "payout", + "payout_cancel", + "payout_failure", + "payout_minimum_balance_hold", + "payout_minimum_balance_release", + "refund", + "refund_failure", + "reserve_transaction", + "reserved_funds", + "stripe_balance_payment_debit", + "stripe_balance_payment_debit_reversal", + "stripe_fee", + "stripe_fx_fee", + "tax_fee", + "topup", + "topup_reversal", + "transfer", + "transfer_cancel", + "transfer_failure", + "transfer_refund", + ]), +}) + +export const s_billing_alert: z.ZodType< + t_billing_alert, + z.ZodTypeDef, + unknown +> = z.object({ + alert_type: z.enum(["usage_threshold"]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["billing.alert"]), + status: z.enum(["active", "archived", "inactive"]).nullable().optional(), + title: z.string().max(5000), + usage_threshold: z.lazy(() => + s_thresholds_resource_usage_threshold_config.nullable().optional(), + ), +}) + +export const s_billing_credit_balance_summary: z.ZodType< + t_billing_credit_balance_summary, + z.ZodTypeDef, + unknown +> = z.object({ + balances: z.array(s_credit_balance), + customer: z.union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]), + livemode: PermissiveBoolean, + object: z.enum(["billing.credit_balance_summary"]), +}) + +export const s_billing_credit_balance_transaction: z.ZodType< + t_billing_credit_balance_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + created: z.coerce.number(), + credit: z.lazy(() => + s_billing_credit_grants_resource_balance_credit.nullable().optional(), + ), + credit_grant: z.union([ + z.string().max(5000), + z.lazy(() => s_billing_credit_grant), + ]), + debit: z.lazy(() => + s_billing_credit_grants_resource_balance_debit.nullable().optional(), + ), + effective_at: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["billing.credit_balance_transaction"]), + test_clock: z + .union([z.string().max(5000), s_test_helpers_test_clock]) + .nullable() + .optional(), + type: z.enum(["credit", "debit"]).nullable().optional(), +}) + +export const s_billing_credit_grant: z.ZodType< + t_billing_credit_grant, + z.ZodTypeDef, + unknown +> = z.object({ + amount: s_billing_credit_grants_resource_amount, + applicability_config: s_billing_credit_grants_resource_applicability_config, + category: z.enum(["paid", "promotional"]), + created: z.coerce.number(), + customer: z.union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]), + effective_at: z.coerce.number().nullable().optional(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + name: z.string().max(5000).nullable().optional(), + object: z.enum(["billing.credit_grant"]), + priority: z.coerce.number().nullable().optional(), + test_clock: z + .union([z.string().max(5000), s_test_helpers_test_clock]) + .nullable() + .optional(), + updated: z.coerce.number(), + voided_at: z.coerce.number().nullable().optional(), +}) + +export const s_charge: z.ZodType = z.object({ + amount: z.coerce.number(), + amount_captured: z.coerce.number(), + amount_refunded: z.coerce.number(), + application: z + .union([z.string().max(5000), s_application]) + .nullable() + .optional(), + application_fee: z + .union([z.string().max(5000), z.lazy(() => s_application_fee)]) + .nullable() + .optional(), + application_fee_amount: z.coerce.number().nullable().optional(), + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + billing_details: s_billing_details, + calculated_statement_descriptor: z.string().max(5000).nullable().optional(), + captured: PermissiveBoolean, + created: z.coerce.number(), + currency: z.string(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer), s_deleted_customer]) + .nullable() + .optional(), + description: z.string().max(40000).nullable().optional(), + disputed: PermissiveBoolean, + failure_balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + failure_code: z.string().max(5000).nullable().optional(), + failure_message: z.string().max(5000).nullable().optional(), + fraud_details: s_charge_fraud_details.nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["charge"]), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + outcome: s_charge_outcome.nullable().optional(), + paid: PermissiveBoolean, + payment_intent: z + .union([z.string().max(5000), z.lazy(() => s_payment_intent)]) + .nullable() + .optional(), + payment_method: z.string().max(5000).nullable().optional(), + payment_method_details: z.lazy(() => + s_payment_method_details.nullable().optional(), + ), + presentment_details: + s_payment_flows_payment_intent_presentment_details.optional(), + radar_options: s_radar_radar_options.optional(), + receipt_email: z.string().max(5000).nullable().optional(), + receipt_number: z.string().max(5000).nullable().optional(), + receipt_url: z.string().max(5000).nullable().optional(), + refunded: PermissiveBoolean, + refunds: z + .object({ + data: z.array(z.lazy(() => s_refund)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .nullable() + .optional(), + review: z + .union([z.string().max(5000), z.lazy(() => s_review)]) + .nullable() + .optional(), + shipping: s_shipping.nullable().optional(), + source_transfer: z + .union([z.string().max(5000), z.lazy(() => s_transfer)]) + .nullable() + .optional(), + statement_descriptor: z.string().max(5000).nullable().optional(), + statement_descriptor_suffix: z.string().max(5000).nullable().optional(), + status: z.enum(["failed", "pending", "succeeded"]), + transfer: z + .union([z.string().max(5000), z.lazy(() => s_transfer)]) + .optional(), + transfer_data: z.lazy(() => s_charge_transfer_data.nullable().optional()), + transfer_group: z.string().max(5000).nullable().optional(), +}) + +export const s_dispute: z.ZodType = z.object({ + amount: z.coerce.number(), + balance_transactions: z.array(z.lazy(() => s_balance_transaction)), + charge: z.union([z.string().max(5000), z.lazy(() => s_charge)]), + created: z.coerce.number(), + currency: z.string(), + enhanced_eligibility_types: z.array(z.enum(["visa_compelling_evidence_3"])), + evidence: z.lazy(() => s_dispute_evidence), + evidence_details: s_dispute_evidence_details, + id: z.string().max(5000), + is_charge_refundable: PermissiveBoolean, + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["dispute"]), + payment_intent: z + .union([z.string().max(5000), z.lazy(() => s_payment_intent)]) + .nullable() + .optional(), + payment_method_details: s_dispute_payment_method_details.optional(), + reason: z.string().max(5000), + status: z.enum([ + "lost", + "needs_response", + "under_review", + "warning_closed", + "warning_needs_response", + "warning_under_review", + "won", + ]), +}) + +export const s_refund: z.ZodType = z.object({ + amount: z.coerce.number(), + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + charge: z + .union([z.string().max(5000), z.lazy(() => s_charge)]) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).optional(), + destination_details: s_refund_destination_details.optional(), + failure_balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .optional(), + failure_reason: z.string().max(5000).optional(), + id: z.string().max(5000), + instructions_email: z.string().max(5000).optional(), + metadata: z.record(z.string().max(500)).nullable().optional(), + next_action: s_refund_next_action.optional(), + object: z.enum(["refund"]), + payment_intent: z + .union([z.string().max(5000), z.lazy(() => s_payment_intent)]) + .nullable() + .optional(), + presentment_details: + s_payment_flows_payment_intent_presentment_details.optional(), + reason: z + .enum([ + "duplicate", + "expired_uncaptured_charge", + "fraudulent", + "requested_by_customer", + ]) + .nullable() + .optional(), + receipt_number: z.string().max(5000).nullable().optional(), + source_transfer_reversal: z + .union([z.string().max(5000), z.lazy(() => s_transfer_reversal)]) + .nullable() + .optional(), + status: z.string().max(5000).nullable().optional(), + transfer_reversal: z + .union([z.string().max(5000), z.lazy(() => s_transfer_reversal)]) + .nullable() + .optional(), +}) + +export const s_checkout_session: z.ZodType< + t_checkout_session, + z.ZodTypeDef, + unknown +> = z.object({ + adaptive_pricing: s_payment_pages_checkout_session_adaptive_pricing + .nullable() + .optional(), + after_expiration: s_payment_pages_checkout_session_after_expiration + .nullable() + .optional(), + allow_promotion_codes: PermissiveBoolean.nullable().optional(), + amount_subtotal: z.coerce.number().nullable().optional(), + amount_total: z.coerce.number().nullable().optional(), + automatic_tax: z.lazy(() => s_payment_pages_checkout_session_automatic_tax), + billing_address_collection: z + .enum(["auto", "required"]) + .nullable() + .optional(), + cancel_url: z.string().max(5000).nullable().optional(), + client_reference_id: z.string().max(5000).nullable().optional(), + client_secret: z.string().max(5000).nullable().optional(), + collected_information: s_payment_pages_checkout_session_collected_information + .nullable() + .optional(), + consent: s_payment_pages_checkout_session_consent.nullable().optional(), + consent_collection: s_payment_pages_checkout_session_consent_collection + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string().nullable().optional(), + currency_conversion: s_payment_pages_checkout_session_currency_conversion + .nullable() + .optional(), + custom_fields: z.array(s_payment_pages_checkout_session_custom_fields), + custom_text: s_payment_pages_checkout_session_custom_text, + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer), s_deleted_customer]) + .nullable() + .optional(), + customer_creation: z.enum(["always", "if_required"]).nullable().optional(), + customer_details: s_payment_pages_checkout_session_customer_details + .nullable() + .optional(), + customer_email: z.string().max(5000).nullable().optional(), + discounts: z + .array(z.lazy(() => s_payment_pages_checkout_session_discount)) + .nullable() + .optional(), + expires_at: z.coerce.number(), + id: z.string().max(5000), + invoice: z + .union([z.string().max(5000), z.lazy(() => s_invoice)]) + .nullable() + .optional(), + invoice_creation: z.lazy(() => + s_payment_pages_checkout_session_invoice_creation.nullable().optional(), + ), + line_items: z + .object({ + data: z.array(z.lazy(() => s_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + livemode: PermissiveBoolean, + locale: z + .enum([ + "auto", + "bg", + "cs", + "da", + "de", + "el", + "en", + "en-GB", + "es", + "es-419", + "et", + "fi", + "fil", + "fr", + "fr-CA", + "hr", + "hu", + "id", + "it", + "ja", + "ko", + "lt", + "lv", + "ms", + "mt", + "nb", + "nl", + "pl", + "pt", + "pt-BR", + "ro", + "ru", + "sk", + "sl", + "sv", + "th", + "tr", + "vi", + "zh", + "zh-HK", + "zh-TW", + ]) + .nullable() + .optional(), + metadata: z.record(z.string().max(500)).nullable().optional(), + mode: z.enum(["payment", "setup", "subscription"]), + object: z.enum(["checkout.session"]), + optional_items: z + .array(s_payment_pages_checkout_session_optional_item) + .nullable() + .optional(), + payment_intent: z + .union([z.string().max(5000), z.lazy(() => s_payment_intent)]) + .nullable() + .optional(), + payment_link: z + .union([z.string().max(5000), z.lazy(() => s_payment_link)]) + .nullable() + .optional(), + payment_method_collection: z + .enum(["always", "if_required"]) + .nullable() + .optional(), + payment_method_configuration_details: + s_payment_method_config_biz_payment_method_configuration_details + .nullable() + .optional(), + payment_method_options: s_checkout_session_payment_method_options + .nullable() + .optional(), + payment_method_types: z.array(z.string().max(5000)), + payment_status: z.enum(["no_payment_required", "paid", "unpaid"]), + permissions: s_payment_pages_checkout_session_permissions + .nullable() + .optional(), + phone_number_collection: + s_payment_pages_checkout_session_phone_number_collection.optional(), + presentment_details: + s_payment_flows_payment_intent_presentment_details.optional(), + recovered_from: z.string().max(5000).nullable().optional(), + redirect_on_completion: z.enum(["always", "if_required", "never"]).optional(), + return_url: z.string().max(5000).optional(), + saved_payment_method_options: + s_payment_pages_checkout_session_saved_payment_method_options + .nullable() + .optional(), + setup_intent: z + .union([z.string().max(5000), z.lazy(() => s_setup_intent)]) + .nullable() + .optional(), + shipping_address_collection: + s_payment_pages_checkout_session_shipping_address_collection + .nullable() + .optional(), + shipping_cost: s_payment_pages_checkout_session_shipping_cost + .nullable() + .optional(), + shipping_options: z.array(s_payment_pages_checkout_session_shipping_option), + status: z.enum(["complete", "expired", "open"]).nullable().optional(), + submit_type: z + .enum(["auto", "book", "donate", "pay", "subscribe"]) + .nullable() + .optional(), + subscription: z + .union([z.string().max(5000), z.lazy(() => s_subscription)]) + .nullable() + .optional(), + success_url: z.string().max(5000).nullable().optional(), + tax_id_collection: + s_payment_pages_checkout_session_tax_id_collection.optional(), + total_details: z.lazy(() => + s_payment_pages_checkout_session_total_details.nullable().optional(), + ), + ui_mode: z.enum(["custom", "embedded", "hosted"]).nullable().optional(), + url: z.string().max(5000).nullable().optional(), +}) + +export const s_item: z.ZodType = z.object({ + amount_discount: z.coerce.number(), + amount_subtotal: z.coerce.number(), + amount_tax: z.coerce.number(), + amount_total: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + discounts: z.array(z.lazy(() => s_line_items_discount_amount)).optional(), + id: z.string().max(5000), + object: z.enum(["item"]), + price: z.lazy(() => s_price.nullable().optional()), + quantity: z.coerce.number().nullable().optional(), + taxes: z.array(s_line_items_tax_amount).optional(), +}) + +export const s_confirmation_token: z.ZodType< + t_confirmation_token, + z.ZodTypeDef, + unknown +> = z.object({ + created: z.coerce.number(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + mandate_data: s_confirmation_tokens_resource_mandate_data + .nullable() + .optional(), + object: z.enum(["confirmation_token"]), + payment_intent: z.string().max(5000).nullable().optional(), + payment_method_options: s_confirmation_tokens_resource_payment_method_options + .nullable() + .optional(), + payment_method_preview: z.lazy(() => + s_confirmation_tokens_resource_payment_method_preview.nullable().optional(), + ), + return_url: z.string().max(5000).nullable().optional(), + setup_future_usage: z + .enum(["off_session", "on_session"]) + .nullable() + .optional(), + setup_intent: z.string().max(5000).nullable().optional(), + shipping: s_confirmation_tokens_resource_shipping.nullable().optional(), + use_stripe_sdk: PermissiveBoolean, +}) + +export const s_credit_note: z.ZodType = + z.object({ + amount: z.coerce.number(), + amount_shipping: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + customer: z.union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]), + customer_balance_transaction: z + .union([ + z.string().max(5000), + z.lazy(() => s_customer_balance_transaction), + ]) + .nullable() + .optional(), + discount_amount: z.coerce.number(), + discount_amounts: z.array( + z.lazy(() => s_discounts_resource_discount_amount), + ), + effective_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + invoice: z.union([z.string().max(5000), z.lazy(() => s_invoice)]), + lines: z.object({ + data: z.array(z.lazy(() => s_credit_note_line_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + livemode: PermissiveBoolean, + memo: z.string().max(5000).nullable().optional(), + metadata: z.record(z.string().max(500)).nullable().optional(), + number: z.string().max(5000), + object: z.enum(["credit_note"]), + out_of_band_amount: z.coerce.number().nullable().optional(), + pdf: z.string().max(5000), + pretax_credit_amounts: z.array( + z.lazy(() => s_credit_notes_pretax_credit_amount), + ), + reason: z + .enum([ + "duplicate", + "fraudulent", + "order_change", + "product_unsatisfactory", + ]) + .nullable() + .optional(), + refunds: z.array(z.lazy(() => s_credit_note_refund)), + shipping_cost: s_invoices_resource_shipping_cost.nullable().optional(), + status: z.enum(["issued", "void"]), + subtotal: z.coerce.number(), + subtotal_excluding_tax: z.coerce.number().nullable().optional(), + total: z.coerce.number(), + total_excluding_tax: z.coerce.number().nullable().optional(), + total_taxes: z + .array(s_billing_bill_resource_invoicing_taxes_tax) + .nullable() + .optional(), + type: z.enum(["post_payment", "pre_payment"]), + voided_at: z.coerce.number().nullable().optional(), + }) + +export const s_credit_note_line_item: z.ZodType< + t_credit_note_line_item, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + description: z.string().max(5000).nullable().optional(), + discount_amount: z.coerce.number(), + discount_amounts: z.array(z.lazy(() => s_discounts_resource_discount_amount)), + id: z.string().max(5000), + invoice_line_item: z.string().max(5000).optional(), + livemode: PermissiveBoolean, + object: z.enum(["credit_note_line_item"]), + pretax_credit_amounts: z.array( + z.lazy(() => s_credit_notes_pretax_credit_amount), + ), + quantity: z.coerce.number().nullable().optional(), + tax_rates: z.array(s_tax_rate), + taxes: z + .array(s_billing_bill_resource_invoicing_taxes_tax) + .nullable() + .optional(), + type: z.enum(["custom_line_item", "invoice_line_item"]), + unit_amount: z.coerce.number().nullable().optional(), + unit_amount_decimal: z.string().nullable().optional(), +}) + +export const s_customer_session: z.ZodType< + t_customer_session, + z.ZodTypeDef, + unknown +> = z.object({ + client_secret: z.string().max(5000), + components: s_customer_session_resource_components.optional(), + created: z.coerce.number(), + customer: z.union([z.string().max(5000), z.lazy(() => s_customer)]), + expires_at: z.coerce.number(), + livemode: PermissiveBoolean, + object: z.enum(["customer_session"]), +}) + +export const s_customer: z.ZodType = + z.object({ + address: s_address.nullable().optional(), + balance: z.coerce.number().optional(), + cash_balance: s_cash_balance.nullable().optional(), + created: z.coerce.number(), + currency: z.string().max(5000).nullable().optional(), + default_source: z + .union([ + z.string().max(5000), + z.lazy(() => s_bank_account), + z.lazy(() => s_card), + s_source, + ]) + .nullable() + .optional(), + delinquent: PermissiveBoolean.nullable().optional(), + description: z.string().max(5000).nullable().optional(), + discount: z.lazy(() => s_discount.nullable().optional()), + email: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + invoice_credit_balance: z.record(z.coerce.number()).optional(), + invoice_prefix: z.string().max(5000).nullable().optional(), + invoice_settings: z.lazy(() => + s_invoice_setting_customer_setting.optional(), + ), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).optional(), + name: z.string().max(5000).nullable().optional(), + next_invoice_sequence: z.coerce.number().optional(), + object: z.enum(["customer"]), + phone: z.string().max(5000).nullable().optional(), + preferred_locales: z.array(z.string().max(5000)).nullable().optional(), + shipping: s_shipping.nullable().optional(), + sources: z + .object({ + data: z.array( + z.union([ + z.lazy(() => s_bank_account), + z.lazy(() => s_card), + s_source, + ]), + ), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + subscriptions: z + .object({ + data: z.array(z.lazy(() => s_subscription)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + tax: s_customer_tax.optional(), + tax_exempt: z.enum(["exempt", "none", "reverse"]).nullable().optional(), + tax_ids: z + .object({ + data: z.array(z.lazy(() => s_tax_id)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + test_clock: z + .union([z.string().max(5000), s_test_helpers_test_clock]) + .nullable() + .optional(), + }) + +export const s_customer_balance_transaction: z.ZodType< + t_customer_balance_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + checkout_session: z + .union([z.string().max(5000), z.lazy(() => s_checkout_session)]) + .nullable() + .optional(), + created: z.coerce.number(), + credit_note: z + .union([z.string().max(5000), z.lazy(() => s_credit_note)]) + .nullable() + .optional(), + currency: z.string(), + customer: z.union([z.string().max(5000), z.lazy(() => s_customer)]), + description: z.string().max(5000).nullable().optional(), + ending_balance: z.coerce.number(), + id: z.string().max(5000), + invoice: z + .union([z.string().max(5000), z.lazy(() => s_invoice)]) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["customer_balance_transaction"]), + type: z.enum([ + "adjustment", + "applied_to_invoice", + "checkout_session_subscription_payment", + "checkout_session_subscription_payment_canceled", + "credit_note", + "initial", + "invoice_overpaid", + "invoice_too_large", + "invoice_too_small", + "migration", + "unapplied_from_invoice", + "unspent_receiver_credit", + ]), +}) + +export const s_payment_source: z.ZodType< + t_payment_source, + z.ZodTypeDef, + unknown +> = z.union([ + z.lazy(() => s_account), + z.lazy(() => s_bank_account), + z.lazy(() => s_card), + s_source, +]) + +export const s_customer_cash_balance_transaction: z.ZodType< + t_customer_cash_balance_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + adjusted_for_overdraft: z.lazy(() => + s_customer_balance_resource_cash_balance_transaction_resource_adjusted_for_overdraft.optional(), + ), + applied_to_payment: z.lazy(() => + s_customer_balance_resource_cash_balance_transaction_resource_applied_to_payment_transaction.optional(), + ), + created: z.coerce.number(), + currency: z.string().max(5000), + customer: z.union([z.string().max(5000), z.lazy(() => s_customer)]), + ending_balance: z.coerce.number(), + funded: + s_customer_balance_resource_cash_balance_transaction_resource_funded_transaction.optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + net_amount: z.coerce.number(), + object: z.enum(["customer_cash_balance_transaction"]), + refunded_from_payment: z.lazy(() => + s_customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction.optional(), + ), + transferred_to_balance: z.lazy(() => + s_customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance.optional(), + ), + type: z.enum([ + "adjusted_for_overdraft", + "applied_to_payment", + "funded", + "funding_reversed", + "refunded_from_payment", + "return_canceled", + "return_initiated", + "transferred_to_balance", + "unapplied_from_payment", + ]), + unapplied_from_payment: z.lazy(() => + s_customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction.optional(), + ), +}) + +export const s_deleted_discount: z.ZodType< + t_deleted_discount, + z.ZodTypeDef, + unknown +> = z.object({ + checkout_session: z.string().max(5000).nullable().optional(), + coupon: s_coupon, + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer), s_deleted_customer]) + .nullable() + .optional(), + deleted: PermissiveBoolean, + id: z.string().max(5000), + invoice: z.string().max(5000).nullable().optional(), + invoice_item: z.string().max(5000).nullable().optional(), + object: z.enum(["discount"]), + promotion_code: z + .union([z.string().max(5000), z.lazy(() => s_promotion_code)]) + .nullable() + .optional(), + start: z.coerce.number(), + subscription: z.string().max(5000).nullable().optional(), + subscription_item: z.string().max(5000).nullable().optional(), +}) + +export const s_discount: z.ZodType = + z.object({ + checkout_session: z.string().max(5000).nullable().optional(), + coupon: s_coupon, + customer: z + .union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]) + .nullable() + .optional(), + end: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + invoice: z.string().max(5000).nullable().optional(), + invoice_item: z.string().max(5000).nullable().optional(), + object: z.enum(["discount"]), + promotion_code: z + .union([z.string().max(5000), z.lazy(() => s_promotion_code)]) + .nullable() + .optional(), + start: z.coerce.number(), + subscription: z.string().max(5000).nullable().optional(), + subscription_item: z.string().max(5000).nullable().optional(), + }) + +export const s_payment_method: z.ZodType< + t_payment_method, + z.ZodTypeDef, + unknown +> = z.object({ + acss_debit: s_payment_method_acss_debit.optional(), + affirm: s_payment_method_affirm.optional(), + afterpay_clearpay: s_payment_method_afterpay_clearpay.optional(), + alipay: s_payment_flows_private_payment_methods_alipay.optional(), + allow_redisplay: z.enum(["always", "limited", "unspecified"]).optional(), + alma: s_payment_method_alma.optional(), + amazon_pay: s_payment_method_amazon_pay.optional(), + au_becs_debit: s_payment_method_au_becs_debit.optional(), + bacs_debit: s_payment_method_bacs_debit.optional(), + bancontact: s_payment_method_bancontact.optional(), + billie: s_payment_method_billie.optional(), + billing_details: s_billing_details, + blik: s_payment_method_blik.optional(), + boleto: s_payment_method_boleto.optional(), + card: z.lazy(() => s_payment_method_card.optional()), + card_present: s_payment_method_card_present.optional(), + cashapp: s_payment_method_cashapp.optional(), + created: z.coerce.number(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer)]) + .nullable() + .optional(), + customer_balance: s_payment_method_customer_balance.optional(), + eps: s_payment_method_eps.optional(), + fpx: s_payment_method_fpx.optional(), + giropay: s_payment_method_giropay.optional(), + grabpay: s_payment_method_grabpay.optional(), + id: z.string().max(5000), + ideal: s_payment_method_ideal.optional(), + interac_present: s_payment_method_interac_present.optional(), + kakao_pay: s_payment_method_kakao_pay.optional(), + klarna: s_payment_method_klarna.optional(), + konbini: s_payment_method_konbini.optional(), + kr_card: s_payment_method_kr_card.optional(), + link: s_payment_method_link.optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + mobilepay: s_payment_method_mobilepay.optional(), + multibanco: s_payment_method_multibanco.optional(), + naver_pay: s_payment_method_naver_pay.optional(), + nz_bank_account: s_payment_method_nz_bank_account.optional(), + object: z.enum(["payment_method"]), + oxxo: s_payment_method_oxxo.optional(), + p24: s_payment_method_p24.optional(), + pay_by_bank: s_payment_method_pay_by_bank.optional(), + payco: s_payment_method_payco.optional(), + paynow: s_payment_method_paynow.optional(), + paypal: s_payment_method_paypal.optional(), + pix: s_payment_method_pix.optional(), + promptpay: s_payment_method_promptpay.optional(), + radar_options: s_radar_radar_options.optional(), + revolut_pay: s_payment_method_revolut_pay.optional(), + samsung_pay: s_payment_method_samsung_pay.optional(), + satispay: s_payment_method_satispay.optional(), + sepa_debit: z.lazy(() => s_payment_method_sepa_debit.optional()), + sofort: s_payment_method_sofort.optional(), + swish: s_payment_method_swish.optional(), + twint: s_payment_method_twint.optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "card_present", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "interac_present", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: s_payment_method_us_bank_account.optional(), + wechat_pay: s_payment_method_wechat_pay.optional(), + zip: s_payment_method_zip.optional(), +}) + +export const s_subscription: z.ZodType = + z.object({ + application: z + .union([z.string().max(5000), s_application, s_deleted_application]) + .nullable() + .optional(), + application_fee_percent: z.coerce.number().nullable().optional(), + automatic_tax: z.lazy(() => s_subscription_automatic_tax), + billing_cycle_anchor: z.coerce.number(), + billing_cycle_anchor_config: + s_subscriptions_resource_billing_cycle_anchor_config + .nullable() + .optional(), + cancel_at: z.coerce.number().nullable().optional(), + cancel_at_period_end: PermissiveBoolean.nullable().optional(), + canceled_at: z.coerce.number().nullable().optional(), + cancellation_details: s_cancellation_details.nullable().optional(), + collection_method: z.enum(["charge_automatically", "send_invoice"]), + created: z.coerce.number(), + currency: z.string(), + customer: z.union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]), + days_until_due: z.coerce.number().nullable().optional(), + default_payment_method: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + default_source: z + .union([ + z.string().max(5000), + z.lazy(() => s_bank_account), + z.lazy(() => s_card), + s_source, + ]) + .nullable() + .optional(), + default_tax_rates: z.array(s_tax_rate).nullable().optional(), + description: z.string().max(500).nullable().optional(), + discounts: z.array( + z.union([z.string().max(5000), z.lazy(() => s_discount)]), + ), + ended_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + invoice_settings: z.lazy( + () => s_subscriptions_resource_subscription_invoice_settings, + ), + items: z.object({ + data: z.array(z.lazy(() => s_subscription_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + latest_invoice: z + .union([z.string().max(5000), z.lazy(() => s_invoice)]) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + next_pending_invoice_item_invoice: z.coerce.number().nullable().optional(), + object: z.enum(["subscription"]), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + pause_collection: s_subscriptions_resource_pause_collection + .nullable() + .optional(), + payment_settings: s_subscriptions_resource_payment_settings + .nullable() + .optional(), + pending_invoice_item_interval: s_subscription_pending_invoice_item_interval + .nullable() + .optional(), + pending_setup_intent: z + .union([z.string().max(5000), z.lazy(() => s_setup_intent)]) + .nullable() + .optional(), + pending_update: z.lazy(() => + s_subscriptions_resource_pending_update.nullable().optional(), + ), + schedule: z + .union([z.string().max(5000), z.lazy(() => s_subscription_schedule)]) + .nullable() + .optional(), + start_date: z.coerce.number(), + status: z.enum([ + "active", + "canceled", + "incomplete", + "incomplete_expired", + "past_due", + "paused", + "trialing", + "unpaid", + ]), + test_clock: z + .union([z.string().max(5000), s_test_helpers_test_clock]) + .nullable() + .optional(), + transfer_data: z.lazy(() => + s_subscription_transfer_data.nullable().optional(), + ), + trial_end: z.coerce.number().nullable().optional(), + trial_settings: s_subscriptions_trials_resource_trial_settings + .nullable() + .optional(), + trial_start: z.coerce.number().nullable().optional(), + }) + +export const s_tax_id: z.ZodType = z.object({ + country: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer)]) + .nullable() + .optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["tax_id"]), + owner: z.lazy(() => s_tax_i_ds_owner.nullable().optional()), + type: z.enum([ + "ad_nrt", + "ae_trn", + "al_tin", + "am_tin", + "ao_tin", + "ar_cuit", + "au_abn", + "au_arn", + "ba_tin", + "bb_tin", + "bg_uic", + "bh_vat", + "bo_tin", + "br_cnpj", + "br_cpf", + "bs_tin", + "by_tin", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "cd_nif", + "ch_uid", + "ch_vat", + "cl_tin", + "cn_tin", + "co_nit", + "cr_tin", + "de_stn", + "do_rcn", + "ec_ruc", + "eg_tin", + "es_cif", + "eu_oss_vat", + "eu_vat", + "gb_vat", + "ge_vat", + "gn_nif", + "hk_br", + "hr_oib", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kh_tin", + "kr_brn", + "kz_bin", + "li_uid", + "li_vat", + "ma_vat", + "md_vat", + "me_pib", + "mk_vat", + "mr_nif", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "ng_tin", + "no_vat", + "no_voec", + "np_pan", + "nz_gst", + "om_vat", + "pe_ruc", + "ph_tin", + "ro_tin", + "rs_pib", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "sn_ninea", + "sr_fin", + "sv_nit", + "th_vat", + "tj_tin", + "tr_tin", + "tw_vat", + "tz_vat", + "ua_vat", + "ug_tin", + "unknown", + "us_ein", + "uy_ruc", + "uz_tin", + "uz_vat", + "ve_rif", + "vn_tin", + "za_vat", + "zm_tin", + "zw_tin", + ]), + value: z.string().max(5000), + verification: s_tax_id_verification.nullable().optional(), +}) + +export const s_file_link: z.ZodType = + z.object({ + created: z.coerce.number(), + expired: PermissiveBoolean, + expires_at: z.coerce.number().nullable().optional(), + file: z.union([z.string().max(5000), z.lazy(() => s_file)]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["file_link"]), + url: z.string().max(5000).nullable().optional(), + }) + +export const s_file: z.ZodType = z.object({ + created: z.coerce.number(), + expires_at: z.coerce.number().nullable().optional(), + filename: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + links: z + .object({ + data: z.array(z.lazy(() => s_file_link)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000).regex(new RegExp("^/v1/file_links")), + }) + .nullable() + .optional(), + object: z.enum(["file"]), + purpose: z.enum([ + "account_requirement", + "additional_verification", + "business_icon", + "business_logo", + "customer_signature", + "dispute_evidence", + "document_provider_identity_document", + "finance_report_run", + "financial_account_statement", + "identity_document", + "identity_document_downloadable", + "issuing_regulatory_reporting", + "pci_document", + "selfie", + "sigma_scheduled_query", + "tax_document_user_upload", + "terminal_reader_splashscreen", + ]), + size: z.coerce.number(), + title: z.string().max(5000).nullable().optional(), + type: z.string().max(5000).nullable().optional(), + url: z.string().max(5000).nullable().optional(), +}) + +export const s_financial_connections_account: z.ZodType< + t_financial_connections_account, + z.ZodTypeDef, + unknown +> = z.object({ + account_holder: z.lazy(() => + s_bank_connections_resource_accountholder.nullable().optional(), + ), + balance: s_bank_connections_resource_balance.nullable().optional(), + balance_refresh: s_bank_connections_resource_balance_refresh + .nullable() + .optional(), + category: z.enum(["cash", "credit", "investment", "other"]), + created: z.coerce.number(), + display_name: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + institution_name: z.string().max(5000), + last4: z.string().max(5000).nullable().optional(), + livemode: PermissiveBoolean, + object: z.enum(["financial_connections.account"]), + ownership: z + .union([z.string().max(5000), s_financial_connections_account_ownership]) + .nullable() + .optional(), + ownership_refresh: s_bank_connections_resource_ownership_refresh + .nullable() + .optional(), + permissions: z + .array(z.enum(["balances", "ownership", "payment_method", "transactions"])) + .nullable() + .optional(), + status: z.enum(["active", "disconnected", "inactive"]), + subcategory: z.enum([ + "checking", + "credit_card", + "line_of_credit", + "mortgage", + "other", + "savings", + ]), + subscriptions: z + .array(z.enum(["transactions"])) + .nullable() + .optional(), + supported_payment_method_types: z.array(z.enum(["link", "us_bank_account"])), + transaction_refresh: s_bank_connections_resource_transaction_refresh + .nullable() + .optional(), +}) + +export const s_financial_connections_session: z.ZodType< + t_financial_connections_session, + z.ZodTypeDef, + unknown +> = z.object({ + account_holder: z.lazy(() => + s_bank_connections_resource_accountholder.nullable().optional(), + ), + accounts: z.object({ + data: z.array(z.lazy(() => s_financial_connections_account)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/financial_connections/accounts")), + }), + client_secret: z.string().max(5000), + filters: s_bank_connections_resource_link_account_session_filters.optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["financial_connections.session"]), + permissions: z.array( + z.enum(["balances", "ownership", "payment_method", "transactions"]), + ), + prefetch: z + .array(z.enum(["balances", "ownership", "transactions"])) + .nullable() + .optional(), + return_url: z.string().max(5000).optional(), +}) + +export const s_invoice_payment: z.ZodType< + t_invoice_payment, + z.ZodTypeDef, + unknown +> = z.object({ + amount_paid: z.coerce.number().nullable().optional(), + amount_requested: z.coerce.number(), + created: z.coerce.number(), + currency: z.string().max(5000), + id: z.string().max(5000), + invoice: z.union([ + z.string().max(5000), + z.lazy(() => s_invoice), + s_deleted_invoice, + ]), + is_default: PermissiveBoolean, + livemode: PermissiveBoolean, + object: z.enum(["invoice_payment"]), + payment: z.lazy(() => s_invoices_payments_invoice_payment_associated_payment), + status: z.string().max(5000), + status_transitions: s_invoices_payments_invoice_payment_status_transitions, +}) + +export const s_invoiceitem: z.ZodType = + z.object({ + amount: z.coerce.number(), + currency: z.string(), + customer: z.union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]), + date: z.coerce.number(), + description: z.string().max(5000).nullable().optional(), + discountable: PermissiveBoolean, + discounts: z + .array(z.union([z.string().max(5000), z.lazy(() => s_discount)])) + .nullable() + .optional(), + id: z.string().max(5000), + invoice: z + .union([z.string().max(5000), z.lazy(() => s_invoice)]) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["invoiceitem"]), + parent: s_billing_bill_resource_invoice_item_parents_invoice_item_parent + .nullable() + .optional(), + period: s_invoice_line_item_period, + pricing: s_billing_bill_resource_invoicing_pricing_pricing + .nullable() + .optional(), + proration: PermissiveBoolean, + quantity: z.coerce.number(), + tax_rates: z.array(s_tax_rate).nullable().optional(), + test_clock: z + .union([z.string().max(5000), s_test_helpers_test_clock]) + .nullable() + .optional(), + }) + +export const s_invoice: z.ZodType = z.object({ + account_country: z.string().max(5000).nullable().optional(), + account_name: z.string().max(5000).nullable().optional(), + account_tax_ids: z + .array( + z.union([z.string().max(5000), z.lazy(() => s_tax_id), s_deleted_tax_id]), + ) + .nullable() + .optional(), + amount_due: z.coerce.number(), + amount_overpaid: z.coerce.number(), + amount_paid: z.coerce.number(), + amount_remaining: z.coerce.number(), + amount_shipping: z.coerce.number(), + application: z + .union([z.string().max(5000), s_application, s_deleted_application]) + .nullable() + .optional(), + attempt_count: z.coerce.number(), + attempted: PermissiveBoolean, + auto_advance: PermissiveBoolean, + automatic_tax: z.lazy(() => s_automatic_tax), + automatically_finalizes_at: z.coerce.number().nullable().optional(), + billing_reason: z + .enum([ + "automatic_pending_invoice_item_invoice", + "manual", + "quote_accept", + "subscription", + "subscription_create", + "subscription_cycle", + "subscription_threshold", + "subscription_update", + "upcoming", + ]) + .nullable() + .optional(), + collection_method: z.enum(["charge_automatically", "send_invoice"]), + confirmation_secret: s_invoices_resource_confirmation_secret + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + custom_fields: z.array(s_invoice_setting_custom_field).nullable().optional(), + customer: z.union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]), + customer_address: s_address.nullable().optional(), + customer_email: z.string().max(5000).nullable().optional(), + customer_name: z.string().max(5000).nullable().optional(), + customer_phone: z.string().max(5000).nullable().optional(), + customer_shipping: s_shipping.nullable().optional(), + customer_tax_exempt: z + .enum(["exempt", "none", "reverse"]) + .nullable() + .optional(), + customer_tax_ids: z + .array(s_invoices_resource_invoice_tax_id) + .nullable() + .optional(), + default_payment_method: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + default_source: z + .union([ + z.string().max(5000), + z.lazy(() => s_bank_account), + z.lazy(() => s_card), + s_source, + ]) + .nullable() + .optional(), + default_tax_rates: z.array(s_tax_rate), + description: z.string().max(5000).nullable().optional(), + discounts: z.array( + z.union([ + z.string().max(5000), + z.lazy(() => s_discount), + z.lazy(() => s_deleted_discount), + ]), + ), + due_date: z.coerce.number().nullable().optional(), + effective_at: z.coerce.number().nullable().optional(), + ending_balance: z.coerce.number().nullable().optional(), + footer: z.string().max(5000).nullable().optional(), + from_invoice: z.lazy(() => + s_invoices_resource_from_invoice.nullable().optional(), + ), + hosted_invoice_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + invoice_pdf: z.string().max(5000).nullable().optional(), + issuer: z.lazy(() => s_connect_account_reference), + last_finalization_error: z.lazy(() => s_api_errors.nullable().optional()), + latest_revision: z + .union([z.string().max(5000), z.lazy(() => s_invoice)]) + .nullable() + .optional(), + lines: z.object({ + data: z.array(z.lazy(() => s_line_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + next_payment_attempt: z.coerce.number().nullable().optional(), + number: z.string().max(5000).nullable().optional(), + object: z.enum(["invoice"]), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + parent: z.lazy(() => + s_billing_bill_resource_invoicing_parents_invoice_parent + .nullable() + .optional(), + ), + payment_settings: s_invoices_payment_settings, + payments: z + .object({ + data: z.array(z.lazy(() => s_invoice_payment)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + period_end: z.coerce.number(), + period_start: z.coerce.number(), + post_payment_credit_notes_amount: z.coerce.number(), + pre_payment_credit_notes_amount: z.coerce.number(), + receipt_number: z.string().max(5000).nullable().optional(), + rendering: s_invoices_resource_invoice_rendering.nullable().optional(), + shipping_cost: s_invoices_resource_shipping_cost.nullable().optional(), + shipping_details: s_shipping.nullable().optional(), + starting_balance: z.coerce.number(), + statement_descriptor: z.string().max(5000).nullable().optional(), + status: z + .enum(["draft", "open", "paid", "uncollectible", "void"]) + .nullable() + .optional(), + status_transitions: s_invoices_resource_status_transitions, + subtotal: z.coerce.number(), + subtotal_excluding_tax: z.coerce.number().nullable().optional(), + test_clock: z + .union([z.string().max(5000), s_test_helpers_test_clock]) + .nullable() + .optional(), + threshold_reason: s_invoice_threshold_reason.optional(), + total: z.coerce.number(), + total_discount_amounts: z + .array(z.lazy(() => s_discounts_resource_discount_amount)) + .nullable() + .optional(), + total_excluding_tax: z.coerce.number().nullable().optional(), + total_pretax_credit_amounts: z + .array(z.lazy(() => s_invoices_resource_pretax_credit_amount)) + .nullable() + .optional(), + total_taxes: z + .array(s_billing_bill_resource_invoicing_taxes_tax) + .nullable() + .optional(), + webhooks_delivered_at: z.coerce.number().nullable().optional(), +}) + +export const s_line_item: z.ZodType = + z.object({ + amount: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + discount_amounts: z + .array(z.lazy(() => s_discounts_resource_discount_amount)) + .nullable() + .optional(), + discountable: PermissiveBoolean, + discounts: z.array( + z.union([z.string().max(5000), z.lazy(() => s_discount)]), + ), + id: z.string().max(5000), + invoice: z.string().max(5000).nullable().optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["line_item"]), + parent: + s_billing_bill_resource_invoicing_lines_parents_invoice_line_item_parent + .nullable() + .optional(), + period: s_invoice_line_item_period, + pretax_credit_amounts: z + .array(z.lazy(() => s_invoices_resource_pretax_credit_amount)) + .nullable() + .optional(), + pricing: s_billing_bill_resource_invoicing_pricing_pricing + .nullable() + .optional(), + quantity: z.coerce.number().nullable().optional(), + subscription: z + .union([z.string().max(5000), z.lazy(() => s_subscription)]) + .nullable() + .optional(), + taxes: z + .array(s_billing_bill_resource_invoicing_taxes_tax) + .nullable() + .optional(), + }) + +export const s_issuing_authorization: z.ZodType< + t_issuing_authorization, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + amount_details: s_issuing_authorization_amount_details.nullable().optional(), + approved: PermissiveBoolean, + authorization_method: z.enum([ + "chip", + "contactless", + "keyed_in", + "online", + "swipe", + ]), + balance_transactions: z.array(z.lazy(() => s_balance_transaction)), + card: z.lazy(() => s_issuing_card), + cardholder: z + .union([z.string().max(5000), z.lazy(() => s_issuing_cardholder)]) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + fleet: s_issuing_authorization_fleet_data.nullable().optional(), + fraud_challenges: z + .array(s_issuing_authorization_fraud_challenge) + .nullable() + .optional(), + fuel: s_issuing_authorization_fuel_data.nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + merchant_amount: z.coerce.number(), + merchant_currency: z.string(), + merchant_data: s_issuing_authorization_merchant_data, + metadata: z.record(z.string().max(500)), + network_data: s_issuing_authorization_network_data.nullable().optional(), + object: z.enum(["issuing.authorization"]), + pending_request: s_issuing_authorization_pending_request + .nullable() + .optional(), + request_history: z.array(s_issuing_authorization_request), + status: z.enum(["closed", "expired", "pending", "reversed"]), + token: z + .union([z.string().max(5000), z.lazy(() => s_issuing_token)]) + .nullable() + .optional(), + transactions: z.array(z.lazy(() => s_issuing_transaction)), + treasury: s_issuing_authorization_treasury.nullable().optional(), + verification_data: s_issuing_authorization_verification_data, + verified_by_fraud_challenge: PermissiveBoolean.nullable().optional(), + wallet: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_cardholder: z.ZodType< + t_issuing_cardholder, + z.ZodTypeDef, + unknown +> = z.object({ + billing: s_issuing_cardholder_address, + company: s_issuing_cardholder_company.nullable().optional(), + created: z.coerce.number(), + email: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + individual: z.lazy(() => + s_issuing_cardholder_individual.nullable().optional(), + ), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + name: z.string().max(5000), + object: z.enum(["issuing.cardholder"]), + phone_number: z.string().max(5000).nullable().optional(), + preferred_locales: z + .array(z.enum(["de", "en", "es", "fr", "it"])) + .nullable() + .optional(), + requirements: s_issuing_cardholder_requirements, + spending_controls: s_issuing_cardholder_authorization_controls + .nullable() + .optional(), + status: z.enum(["active", "blocked", "inactive"]), + type: z.enum(["company", "individual"]), +}) + +export const s_issuing_card: z.ZodType = + z.object({ + brand: z.string().max(5000), + cancellation_reason: z + .enum(["design_rejected", "lost", "stolen"]) + .nullable() + .optional(), + cardholder: z.lazy(() => s_issuing_cardholder), + created: z.coerce.number(), + currency: z.string(), + cvc: z.string().max(5000).optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + financial_account: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + last4: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + number: z.string().max(5000).optional(), + object: z.enum(["issuing.card"]), + personalization_design: z + .union([ + z.string().max(5000), + z.lazy(() => s_issuing_personalization_design), + ]) + .nullable() + .optional(), + replaced_by: z + .union([z.string().max(5000), z.lazy(() => s_issuing_card)]) + .nullable() + .optional(), + replacement_for: z + .union([z.string().max(5000), z.lazy(() => s_issuing_card)]) + .nullable() + .optional(), + replacement_reason: z + .enum(["damaged", "expired", "lost", "stolen"]) + .nullable() + .optional(), + shipping: s_issuing_card_shipping.nullable().optional(), + spending_controls: s_issuing_card_authorization_controls, + status: z.enum(["active", "canceled", "inactive"]), + type: z.enum(["physical", "virtual"]), + wallets: s_issuing_card_wallets.nullable().optional(), + }) + +export const s_issuing_dispute: z.ZodType< + t_issuing_dispute, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + balance_transactions: z + .array(z.lazy(() => s_balance_transaction)) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + evidence: z.lazy(() => s_issuing_dispute_evidence), + id: z.string().max(5000), + livemode: PermissiveBoolean, + loss_reason: z + .enum([ + "cardholder_authentication_issuer_liability", + "eci5_token_transaction_with_tavv", + "excess_disputes_in_timeframe", + "has_not_met_the_minimum_dispute_amount_requirements", + "invalid_duplicate_dispute", + "invalid_incorrect_amount_dispute", + "invalid_no_authorization", + "invalid_use_of_disputes", + "merchandise_delivered_or_shipped", + "merchandise_or_service_as_described", + "not_cancelled", + "other", + "refund_issued", + "submitted_beyond_allowable_time_limit", + "transaction_3ds_required", + "transaction_approved_after_prior_fraud_dispute", + "transaction_authorized", + "transaction_electronically_read", + "transaction_qualifies_for_visa_easy_payment_service", + "transaction_unattended", + ]) + .optional(), + metadata: z.record(z.string().max(500)), + object: z.enum(["issuing.dispute"]), + status: z.enum(["expired", "lost", "submitted", "unsubmitted", "won"]), + transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_issuing_transaction), + ]), + treasury: s_issuing_dispute_treasury.nullable().optional(), +}) + +export const s_issuing_personalization_design: z.ZodType< + t_issuing_personalization_design, + z.ZodTypeDef, + unknown +> = z.object({ + card_logo: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + carrier_text: s_issuing_personalization_design_carrier_text + .nullable() + .optional(), + created: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + lookup_key: z.string().max(5000).nullable().optional(), + metadata: z.record(z.string().max(500)), + name: z.string().max(5000).nullable().optional(), + object: z.enum(["issuing.personalization_design"]), + physical_bundle: z.union([z.string().max(5000), s_issuing_physical_bundle]), + preferences: s_issuing_personalization_design_preferences, + rejection_reasons: s_issuing_personalization_design_rejection_reasons, + status: z.enum(["active", "inactive", "rejected", "review"]), +}) + +export const s_issuing_token: z.ZodType< + t_issuing_token, + z.ZodTypeDef, + unknown +> = z.object({ + card: z.union([z.string().max(5000), z.lazy(() => s_issuing_card)]), + created: z.coerce.number(), + device_fingerprint: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + last4: z.string().max(5000).optional(), + livemode: PermissiveBoolean, + network: z.enum(["mastercard", "visa"]), + network_data: s_issuing_network_token_network_data.optional(), + network_updated_at: z.coerce.number(), + object: z.enum(["issuing.token"]), + status: z.enum(["active", "deleted", "requested", "suspended"]), + wallet_provider: z + .enum(["apple_pay", "google_pay", "samsung_pay"]) + .optional(), +}) + +export const s_issuing_transaction: z.ZodType< + t_issuing_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + amount_details: s_issuing_transaction_amount_details.nullable().optional(), + authorization: z + .union([z.string().max(5000), z.lazy(() => s_issuing_authorization)]) + .nullable() + .optional(), + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + card: z.union([z.string().max(5000), z.lazy(() => s_issuing_card)]), + cardholder: z + .union([z.string().max(5000), z.lazy(() => s_issuing_cardholder)]) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + dispute: z + .union([z.string().max(5000), z.lazy(() => s_issuing_dispute)]) + .nullable() + .optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + merchant_amount: z.coerce.number(), + merchant_currency: z.string(), + merchant_data: s_issuing_authorization_merchant_data, + metadata: z.record(z.string().max(500)), + network_data: s_issuing_transaction_network_data.nullable().optional(), + object: z.enum(["issuing.transaction"]), + purchase_details: s_issuing_transaction_purchase_details + .nullable() + .optional(), + token: z + .union([z.string().max(5000), z.lazy(() => s_issuing_token)]) + .nullable() + .optional(), + treasury: s_issuing_transaction_treasury.nullable().optional(), + type: z.enum(["capture", "refund"]), + wallet: z + .enum(["apple_pay", "google_pay", "samsung_pay"]) + .nullable() + .optional(), +}) + +export const s_mandate: z.ZodType = z.object({ + customer_acceptance: s_customer_acceptance, + id: z.string().max(5000), + livemode: PermissiveBoolean, + multi_use: s_mandate_multi_use.optional(), + object: z.enum(["mandate"]), + on_behalf_of: z.string().max(5000).optional(), + payment_method: z.union([ + z.string().max(5000), + z.lazy(() => s_payment_method), + ]), + payment_method_details: s_mandate_payment_method_details, + single_use: s_mandate_single_use.optional(), + status: z.enum(["active", "inactive", "pending"]), + type: z.enum(["multi_use", "single_use"]), +}) + +export const s_payment_intent: z.ZodType< + t_payment_intent, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + amount_capturable: z.coerce.number().optional(), + amount_details: z + .union([ + s_payment_flows_amount_details, + s_payment_flows_amount_details_client, + ]) + .optional(), + amount_received: z.coerce.number().optional(), + application: z + .union([z.string().max(5000), s_application]) + .nullable() + .optional(), + application_fee_amount: z.coerce.number().nullable().optional(), + automatic_payment_methods: + s_payment_flows_automatic_payment_methods_payment_intent + .nullable() + .optional(), + canceled_at: z.coerce.number().nullable().optional(), + cancellation_reason: z + .enum([ + "abandoned", + "automatic", + "duplicate", + "expired", + "failed_invoice", + "fraudulent", + "requested_by_customer", + "void_invoice", + ]) + .nullable() + .optional(), + capture_method: z.enum(["automatic", "automatic_async", "manual"]), + client_secret: z.string().max(5000).nullable().optional(), + confirmation_method: z.enum(["automatic", "manual"]), + created: z.coerce.number(), + currency: z.string(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer), s_deleted_customer]) + .nullable() + .optional(), + description: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + last_payment_error: z.lazy(() => s_api_errors.nullable().optional()), + latest_charge: z + .union([z.string().max(5000), z.lazy(() => s_charge)]) + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).optional(), + next_action: s_payment_intent_next_action.nullable().optional(), + object: z.enum(["payment_intent"]), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + payment_method: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + payment_method_configuration_details: + s_payment_method_config_biz_payment_method_configuration_details + .nullable() + .optional(), + payment_method_options: s_payment_intent_payment_method_options + .nullable() + .optional(), + payment_method_types: z.array(z.string().max(5000)), + presentment_details: + s_payment_flows_payment_intent_presentment_details.optional(), + processing: s_payment_intent_processing.nullable().optional(), + receipt_email: z.string().max(5000).nullable().optional(), + review: z + .union([z.string().max(5000), z.lazy(() => s_review)]) + .nullable() + .optional(), + setup_future_usage: z + .enum(["off_session", "on_session"]) + .nullable() + .optional(), + shipping: s_shipping.nullable().optional(), + statement_descriptor: z.string().max(5000).nullable().optional(), + statement_descriptor_suffix: z.string().max(5000).nullable().optional(), + status: z.enum([ + "canceled", + "processing", + "requires_action", + "requires_capture", + "requires_confirmation", + "requires_payment_method", + "succeeded", + ]), + transfer_data: z.lazy(() => s_transfer_data.nullable().optional()), + transfer_group: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_link: z.ZodType = + z.object({ + active: PermissiveBoolean, + after_completion: s_payment_links_resource_after_completion, + allow_promotion_codes: PermissiveBoolean, + application: z + .union([z.string().max(5000), s_application, s_deleted_application]) + .nullable() + .optional(), + application_fee_amount: z.coerce.number().nullable().optional(), + application_fee_percent: z.coerce.number().nullable().optional(), + automatic_tax: z.lazy(() => s_payment_links_resource_automatic_tax), + billing_address_collection: z.enum(["auto", "required"]), + consent_collection: s_payment_links_resource_consent_collection + .nullable() + .optional(), + currency: z.string(), + custom_fields: z.array(s_payment_links_resource_custom_fields), + custom_text: s_payment_links_resource_custom_text, + customer_creation: z.enum(["always", "if_required"]), + id: z.string().max(5000), + inactive_message: z.string().max(5000).nullable().optional(), + invoice_creation: z.lazy(() => + s_payment_links_resource_invoice_creation.nullable().optional(), + ), + line_items: z + .object({ + data: z.array(z.lazy(() => s_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["payment_link"]), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + optional_items: z + .array(s_payment_links_resource_optional_item) + .nullable() + .optional(), + payment_intent_data: s_payment_links_resource_payment_intent_data + .nullable() + .optional(), + payment_method_collection: z.enum(["always", "if_required"]), + payment_method_types: z + .array( + z.enum([ + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "klarna", + "konbini", + "link", + "mobilepay", + "multibanco", + "oxxo", + "p24", + "pay_by_bank", + "paynow", + "paypal", + "pix", + "promptpay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + ) + .nullable() + .optional(), + phone_number_collection: s_payment_links_resource_phone_number_collection, + restrictions: s_payment_links_resource_restrictions.nullable().optional(), + shipping_address_collection: + s_payment_links_resource_shipping_address_collection + .nullable() + .optional(), + shipping_options: z.array(s_payment_links_resource_shipping_option), + submit_type: z.enum(["auto", "book", "donate", "pay", "subscribe"]), + subscription_data: z.lazy(() => + s_payment_links_resource_subscription_data.nullable().optional(), + ), + tax_id_collection: s_payment_links_resource_tax_id_collection, + transfer_data: z.lazy(() => + s_payment_links_resource_transfer_data.nullable().optional(), + ), + url: z.string().max(5000), + }) + +export const s_payout: z.ZodType = z.object({ + amount: z.coerce.number(), + application_fee: z + .union([z.string().max(5000), z.lazy(() => s_application_fee)]) + .nullable() + .optional(), + application_fee_amount: z.coerce.number().nullable().optional(), + arrival_date: z.coerce.number(), + automatic: PermissiveBoolean, + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + destination: z + .union([ + z.string().max(5000), + z.lazy(() => s_bank_account), + z.lazy(() => s_card), + s_deleted_bank_account, + s_deleted_card, + ]) + .nullable() + .optional(), + failure_balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + failure_code: z.string().max(5000).nullable().optional(), + failure_message: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + method: z.string().max(5000), + object: z.enum(["payout"]), + original_payout: z + .union([z.string().max(5000), z.lazy(() => s_payout)]) + .nullable() + .optional(), + reconciliation_status: z.enum(["completed", "in_progress", "not_applicable"]), + reversed_by: z + .union([z.string().max(5000), z.lazy(() => s_payout)]) + .nullable() + .optional(), + source_type: z.string().max(5000), + statement_descriptor: z.string().max(5000).nullable().optional(), + status: z.string().max(5000), + trace_id: s_payouts_trace_id.nullable().optional(), + type: z.enum(["bank_account", "card"]), +}) + +export const s_plan: z.ZodType = z.object({ + active: PermissiveBoolean, + amount: z.coerce.number().nullable().optional(), + amount_decimal: z.string().nullable().optional(), + billing_scheme: z.enum(["per_unit", "tiered"]), + created: z.coerce.number(), + currency: z.string(), + id: z.string().max(5000), + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + meter: z.string().max(5000).nullable().optional(), + nickname: z.string().max(5000).nullable().optional(), + object: z.enum(["plan"]), + product: z + .union([z.string().max(5000), z.lazy(() => s_product), s_deleted_product]) + .nullable() + .optional(), + tiers: z.array(s_plan_tier).optional(), + tiers_mode: z.enum(["graduated", "volume"]).nullable().optional(), + transform_usage: s_transform_usage.nullable().optional(), + trial_period_days: z.coerce.number().nullable().optional(), + usage_type: z.enum(["licensed", "metered"]), +}) + +export const s_price: z.ZodType = z.object({ + active: PermissiveBoolean, + billing_scheme: z.enum(["per_unit", "tiered"]), + created: z.coerce.number(), + currency: z.string(), + currency_options: z.record(s_currency_option).optional(), + custom_unit_amount: s_custom_unit_amount.nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + lookup_key: z.string().max(5000).nullable().optional(), + metadata: z.record(z.string().max(500)), + nickname: z.string().max(5000).nullable().optional(), + object: z.enum(["price"]), + product: z.union([ + z.string().max(5000), + z.lazy(() => s_product), + s_deleted_product, + ]), + recurring: s_recurring.nullable().optional(), + tax_behavior: z + .enum(["exclusive", "inclusive", "unspecified"]) + .nullable() + .optional(), + tiers: z.array(s_price_tier).optional(), + tiers_mode: z.enum(["graduated", "volume"]).nullable().optional(), + transform_quantity: s_transform_quantity.nullable().optional(), + type: z.enum(["one_time", "recurring"]), + unit_amount: z.coerce.number().nullable().optional(), + unit_amount_decimal: z.string().nullable().optional(), +}) + +export const s_product: z.ZodType = z.object({ + active: PermissiveBoolean, + created: z.coerce.number(), + default_price: z + .union([z.string().max(5000), z.lazy(() => s_price)]) + .nullable() + .optional(), + description: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + images: z.array(z.string().max(5000)), + livemode: PermissiveBoolean, + marketing_features: z.array(s_product_marketing_feature), + metadata: z.record(z.string().max(500)), + name: z.string().max(5000), + object: z.enum(["product"]), + package_dimensions: s_package_dimensions.nullable().optional(), + shippable: PermissiveBoolean.nullable().optional(), + statement_descriptor: z.string().max(5000).nullable().optional(), + tax_code: z + .union([z.string().max(5000), s_tax_code]) + .nullable() + .optional(), + unit_label: z.string().max(5000).nullable().optional(), + updated: z.coerce.number(), + url: z.string().max(2048).nullable().optional(), +}) + +export const s_promotion_code: z.ZodType< + t_promotion_code, + z.ZodTypeDef, + unknown +> = z.object({ + active: PermissiveBoolean, + code: z.string().max(5000), + coupon: s_coupon, + created: z.coerce.number(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer), s_deleted_customer]) + .nullable() + .optional(), + expires_at: z.coerce.number().nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + max_redemptions: z.coerce.number().nullable().optional(), + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["promotion_code"]), + restrictions: s_promotion_codes_resource_restrictions, + times_redeemed: z.coerce.number(), +}) + +export const s_quote: z.ZodType = z.object({ + amount_subtotal: z.coerce.number(), + amount_total: z.coerce.number(), + application: z + .union([z.string().max(5000), s_application, s_deleted_application]) + .nullable() + .optional(), + application_fee_amount: z.coerce.number().nullable().optional(), + application_fee_percent: z.coerce.number().nullable().optional(), + automatic_tax: z.lazy(() => s_quotes_resource_automatic_tax), + collection_method: z.enum(["charge_automatically", "send_invoice"]), + computed: z.lazy(() => s_quotes_resource_computed), + created: z.coerce.number(), + currency: z.string().max(5000).nullable().optional(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer), s_deleted_customer]) + .nullable() + .optional(), + default_tax_rates: z + .array(z.union([z.string().max(5000), s_tax_rate])) + .optional(), + description: z.string().max(5000).nullable().optional(), + discounts: z.array(z.union([z.string().max(5000), z.lazy(() => s_discount)])), + expires_at: z.coerce.number(), + footer: z.string().max(5000).nullable().optional(), + from_quote: z.lazy(() => s_quotes_resource_from_quote.nullable().optional()), + header: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + invoice: z + .union([z.string().max(5000), z.lazy(() => s_invoice), s_deleted_invoice]) + .nullable() + .optional(), + invoice_settings: z.lazy(() => s_invoice_setting_quote_setting), + line_items: z + .object({ + data: z.array(z.lazy(() => s_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + number: z.string().max(5000).nullable().optional(), + object: z.enum(["quote"]), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + status: z.enum(["accepted", "canceled", "draft", "open"]), + status_transitions: s_quotes_resource_status_transitions, + subscription: z + .union([z.string().max(5000), z.lazy(() => s_subscription)]) + .nullable() + .optional(), + subscription_data: s_quotes_resource_subscription_data_subscription_data, + subscription_schedule: z + .union([z.string().max(5000), z.lazy(() => s_subscription_schedule)]) + .nullable() + .optional(), + test_clock: z + .union([z.string().max(5000), s_test_helpers_test_clock]) + .nullable() + .optional(), + total_details: z.lazy(() => s_quotes_resource_total_details), + transfer_data: z.lazy(() => + s_quotes_resource_transfer_data.nullable().optional(), + ), +}) + +export const s_radar_early_fraud_warning: z.ZodType< + t_radar_early_fraud_warning, + z.ZodTypeDef, + unknown +> = z.object({ + actionable: PermissiveBoolean, + charge: z.union([z.string().max(5000), z.lazy(() => s_charge)]), + created: z.coerce.number(), + fraud_type: z.string().max(5000), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["radar.early_fraud_warning"]), + payment_intent: z + .union([z.string().max(5000), z.lazy(() => s_payment_intent)]) + .optional(), +}) + +export const s_reporting_report_run: z.ZodType< + t_reporting_report_run, + z.ZodTypeDef, + unknown +> = z.object({ + created: z.coerce.number(), + error: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["reporting.report_run"]), + parameters: s_financial_reporting_finance_report_run_run_parameters, + report_type: z.string().max(5000), + result: z.lazy(() => s_file.nullable().optional()), + status: z.string().max(5000), + succeeded_at: z.coerce.number().nullable().optional(), +}) + +export const s_review: z.ZodType = z.object({ + billing_zip: z.string().max(5000).nullable().optional(), + charge: z + .union([z.string().max(5000), z.lazy(() => s_charge)]) + .nullable() + .optional(), + closed_reason: z + .enum([ + "approved", + "canceled", + "disputed", + "redacted", + "refunded", + "refunded_as_fraud", + ]) + .nullable() + .optional(), + created: z.coerce.number(), + id: z.string().max(5000), + ip_address: z.string().max(5000).nullable().optional(), + ip_address_location: s_radar_review_resource_location.nullable().optional(), + livemode: PermissiveBoolean, + object: z.enum(["review"]), + open: PermissiveBoolean, + opened_reason: z.enum(["manual", "rule"]), + payment_intent: z + .union([z.string().max(5000), z.lazy(() => s_payment_intent)]) + .optional(), + reason: z.string().max(5000), + session: s_radar_review_resource_session.nullable().optional(), +}) + +export const s_setup_attempt: z.ZodType< + t_setup_attempt, + z.ZodTypeDef, + unknown +> = z.object({ + application: z + .union([z.string().max(5000), s_application]) + .nullable() + .optional(), + attach_to_self: PermissiveBoolean.optional(), + created: z.coerce.number(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer), s_deleted_customer]) + .nullable() + .optional(), + flow_directions: z + .array(z.enum(["inbound", "outbound"])) + .nullable() + .optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["setup_attempt"]), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + payment_method: z.union([ + z.string().max(5000), + z.lazy(() => s_payment_method), + ]), + payment_method_details: z.lazy(() => s_setup_attempt_payment_method_details), + setup_error: z.lazy(() => s_api_errors.nullable().optional()), + setup_intent: z.union([z.string().max(5000), z.lazy(() => s_setup_intent)]), + status: z.string().max(5000), + usage: z.string().max(5000), +}) + +export const s_setup_intent: z.ZodType = + z.object({ + application: z + .union([z.string().max(5000), s_application]) + .nullable() + .optional(), + attach_to_self: PermissiveBoolean.optional(), + automatic_payment_methods: + s_payment_flows_automatic_payment_methods_setup_intent + .nullable() + .optional(), + cancellation_reason: z + .enum(["abandoned", "duplicate", "requested_by_customer"]) + .nullable() + .optional(), + client_secret: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + customer: z + .union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]) + .nullable() + .optional(), + description: z.string().max(5000).nullable().optional(), + flow_directions: z + .array(z.enum(["inbound", "outbound"])) + .nullable() + .optional(), + id: z.string().max(5000), + last_setup_error: z.lazy(() => s_api_errors.nullable().optional()), + latest_attempt: z + .union([z.string().max(5000), z.lazy(() => s_setup_attempt)]) + .nullable() + .optional(), + livemode: PermissiveBoolean, + mandate: z + .union([z.string().max(5000), z.lazy(() => s_mandate)]) + .nullable() + .optional(), + metadata: z.record(z.string().max(500)).nullable().optional(), + next_action: s_setup_intent_next_action.nullable().optional(), + object: z.enum(["setup_intent"]), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + payment_method: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + payment_method_configuration_details: + s_payment_method_config_biz_payment_method_configuration_details + .nullable() + .optional(), + payment_method_options: s_setup_intent_payment_method_options + .nullable() + .optional(), + payment_method_types: z.array(z.string().max(5000)), + single_use_mandate: z + .union([z.string().max(5000), z.lazy(() => s_mandate)]) + .nullable() + .optional(), + status: z.enum([ + "canceled", + "processing", + "requires_action", + "requires_confirmation", + "requires_payment_method", + "succeeded", + ]), + usage: z.string().max(5000), + }) + +export const s_scheduled_query_run: z.ZodType< + t_scheduled_query_run, + z.ZodTypeDef, + unknown +> = z.object({ + created: z.coerce.number(), + data_load_time: z.coerce.number(), + error: s_sigma_scheduled_query_run_error.optional(), + file: z.lazy(() => s_file.nullable().optional()), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["scheduled_query_run"]), + result_available_until: z.coerce.number(), + sql: z.string().max(100000), + status: z.string().max(5000), + title: z.string().max(5000), +}) + +export const s_subscription_item: z.ZodType< + t_subscription_item, + z.ZodTypeDef, + unknown +> = z.object({ + created: z.coerce.number(), + current_period_end: z.coerce.number(), + current_period_start: z.coerce.number(), + discounts: z.array(z.union([z.string().max(5000), z.lazy(() => s_discount)])), + id: z.string().max(5000), + metadata: z.record(z.string().max(500)), + object: z.enum(["subscription_item"]), + price: z.lazy(() => s_price), + quantity: z.coerce.number().optional(), + subscription: z.string().max(5000), + tax_rates: z.array(s_tax_rate).nullable().optional(), +}) + +export const s_subscription_schedule: z.ZodType< + t_subscription_schedule, + z.ZodTypeDef, + unknown +> = z.object({ + application: z + .union([z.string().max(5000), s_application, s_deleted_application]) + .nullable() + .optional(), + canceled_at: z.coerce.number().nullable().optional(), + completed_at: z.coerce.number().nullable().optional(), + created: z.coerce.number(), + current_phase: s_subscription_schedule_current_phase.nullable().optional(), + customer: z.union([ + z.string().max(5000), + z.lazy(() => s_customer), + s_deleted_customer, + ]), + default_settings: z.lazy( + () => s_subscription_schedules_resource_default_settings, + ), + end_behavior: z.enum(["cancel", "none", "release", "renew"]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["subscription_schedule"]), + phases: z.array(z.lazy(() => s_subscription_schedule_phase_configuration)), + released_at: z.coerce.number().nullable().optional(), + released_subscription: z.string().max(5000).nullable().optional(), + status: z.enum([ + "active", + "canceled", + "completed", + "not_started", + "released", + ]), + subscription: z + .union([z.string().max(5000), z.lazy(() => s_subscription)]) + .nullable() + .optional(), + test_clock: z + .union([z.string().max(5000), s_test_helpers_test_clock]) + .nullable() + .optional(), +}) + +export const s_terminal_configuration: z.ZodType< + t_terminal_configuration, + z.ZodTypeDef, + unknown +> = z.object({ + bbpos_wisepos_e: z.lazy(() => + s_terminal_configuration_configuration_resource_device_type_specific_config.optional(), + ), + id: z.string().max(5000), + is_account_default: PermissiveBoolean.nullable().optional(), + livemode: PermissiveBoolean, + name: z.string().max(5000).nullable().optional(), + object: z.enum(["terminal.configuration"]), + offline: + s_terminal_configuration_configuration_resource_offline_config.optional(), + reboot_window: + s_terminal_configuration_configuration_resource_reboot_window.optional(), + stripe_s700: z.lazy(() => + s_terminal_configuration_configuration_resource_device_type_specific_config.optional(), + ), + tipping: s_terminal_configuration_configuration_resource_tipping.optional(), + verifone_p400: z.lazy(() => + s_terminal_configuration_configuration_resource_device_type_specific_config.optional(), + ), + wifi: s_terminal_configuration_configuration_resource_wifi_config.optional(), +}) + +export const s_terminal_reader: z.ZodType< + t_terminal_reader, + z.ZodTypeDef, + unknown +> = z.object({ + action: z.lazy(() => + s_terminal_reader_reader_resource_reader_action.nullable().optional(), + ), + device_sw_version: z.string().max(5000).nullable().optional(), + device_type: z.enum([ + "bbpos_chipper2x", + "bbpos_wisepad3", + "bbpos_wisepos_e", + "mobile_phone_reader", + "simulated_wisepos_e", + "stripe_m2", + "stripe_s700", + "verifone_P400", + ]), + id: z.string().max(5000), + ip_address: z.string().max(5000).nullable().optional(), + label: z.string().max(5000), + livemode: PermissiveBoolean, + location: z + .union([z.string().max(5000), s_terminal_location]) + .nullable() + .optional(), + metadata: z.record(z.string().max(500)), + object: z.enum(["terminal.reader"]), + serial_number: z.string().max(5000), + status: z.enum(["offline", "online"]).nullable().optional(), +}) + +export const s_treasury_inbound_transfer: z.ZodType< + t_treasury_inbound_transfer, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + cancelable: PermissiveBoolean, + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + failure_details: s_treasury_inbound_transfers_resource_failure_details + .nullable() + .optional(), + financial_account: z.string().max(5000), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + linked_flows: + s_treasury_inbound_transfers_resource_inbound_transfer_resource_linked_flows, + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["treasury.inbound_transfer"]), + origin_payment_method: z.string().max(5000).nullable().optional(), + origin_payment_method_details: z.lazy(() => + s_inbound_transfers.nullable().optional(), + ), + returned: PermissiveBoolean.nullable().optional(), + statement_descriptor: z.string().max(5000), + status: z.enum(["canceled", "failed", "processing", "succeeded"]), + status_transitions: + s_treasury_inbound_transfers_resource_inbound_transfer_resource_status_transitions, + transaction: z + .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .nullable() + .optional(), +}) + +export const s_treasury_outbound_payment: z.ZodType< + t_treasury_outbound_payment, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + cancelable: PermissiveBoolean, + created: z.coerce.number(), + currency: z.string(), + customer: z.string().max(5000).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + destination_payment_method: z.string().max(5000).nullable().optional(), + destination_payment_method_details: z.lazy(() => + s_outbound_payments_payment_method_details.nullable().optional(), + ), + end_user_details: + s_treasury_outbound_payments_resource_outbound_payment_resource_end_user_details + .nullable() + .optional(), + expected_arrival_date: z.coerce.number(), + financial_account: z.string().max(5000), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["treasury.outbound_payment"]), + returned_details: z.lazy(() => + s_treasury_outbound_payments_resource_returned_status.nullable().optional(), + ), + statement_descriptor: z.string().max(5000), + status: z.enum(["canceled", "failed", "posted", "processing", "returned"]), + status_transitions: + s_treasury_outbound_payments_resource_outbound_payment_resource_status_transitions, + tracking_details: + s_treasury_outbound_payments_resource_outbound_payment_resource_tracking_details + .nullable() + .optional(), + transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_treasury_transaction), + ]), +}) + +export const s_treasury_outbound_transfer: z.ZodType< + t_treasury_outbound_transfer, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + cancelable: PermissiveBoolean, + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + destination_payment_method: z.string().max(5000).nullable().optional(), + destination_payment_method_details: z.lazy( + () => s_outbound_transfers_payment_method_details, + ), + expected_arrival_date: z.coerce.number(), + financial_account: z.string().max(5000), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["treasury.outbound_transfer"]), + returned_details: z.lazy(() => + s_treasury_outbound_transfers_resource_returned_details + .nullable() + .optional(), + ), + statement_descriptor: z.string().max(5000), + status: z.enum(["canceled", "failed", "posted", "processing", "returned"]), + status_transitions: s_treasury_outbound_transfers_resource_status_transitions, + tracking_details: + s_treasury_outbound_transfers_resource_outbound_transfer_resource_tracking_details + .nullable() + .optional(), + transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_treasury_transaction), + ]), +}) + +export const s_treasury_received_credit: z.ZodType< + t_treasury_received_credit, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000), + failure_code: z + .enum([ + "account_closed", + "account_frozen", + "international_transaction", + "other", + ]) + .nullable() + .optional(), + financial_account: z.string().max(5000).nullable().optional(), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + initiating_payment_method_details: + s_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details, + linked_flows: z.lazy(() => s_treasury_received_credits_resource_linked_flows), + livemode: PermissiveBoolean, + network: z.enum(["ach", "card", "stripe", "us_domestic_wire"]), + object: z.enum(["treasury.received_credit"]), + reversal_details: s_treasury_received_credits_resource_reversal_details + .nullable() + .optional(), + status: z.enum(["failed", "succeeded"]), + transaction: z + .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .nullable() + .optional(), +}) + +export const s_treasury_received_debit: z.ZodType< + t_treasury_received_debit, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000), + failure_code: z + .enum([ + "account_closed", + "account_frozen", + "insufficient_funds", + "international_transaction", + "other", + ]) + .nullable() + .optional(), + financial_account: z.string().max(5000).nullable().optional(), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + initiating_payment_method_details: + s_treasury_shared_resource_initiating_payment_method_details_initiating_payment_method_details.optional(), + linked_flows: s_treasury_received_debits_resource_linked_flows, + livemode: PermissiveBoolean, + network: z.enum(["ach", "card", "stripe"]), + object: z.enum(["treasury.received_debit"]), + reversal_details: s_treasury_received_debits_resource_reversal_details + .nullable() + .optional(), + status: z.enum(["failed", "succeeded"]), + transaction: z + .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .nullable() + .optional(), +}) + +export const s_token: z.ZodType = z.object({ + bank_account: z.lazy(() => s_bank_account.optional()), + card: z.lazy(() => s_card.optional()), + client_ip: z.string().max(5000).nullable().optional(), + created: z.coerce.number(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["token"]), + type: z.string().max(5000), + used: PermissiveBoolean, +}) + +export const s_topup: z.ZodType = z.object({ + amount: z.coerce.number(), + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string().max(5000), + description: z.string().max(5000).nullable().optional(), + expected_availability_date: z.coerce.number().nullable().optional(), + failure_code: z.string().max(5000).nullable().optional(), + failure_message: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["topup"]), + source: s_source.nullable().optional(), + statement_descriptor: z.string().max(5000).nullable().optional(), + status: z.enum(["canceled", "failed", "pending", "reversed", "succeeded"]), + transfer_group: z.string().max(5000).nullable().optional(), +}) + +export const s_transfer: z.ZodType = + z.object({ + amount: z.coerce.number(), + amount_reversed: z.coerce.number(), + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000).nullable().optional(), + destination: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + destination_payment: z + .union([z.string().max(5000), z.lazy(() => s_charge)]) + .optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + object: z.enum(["transfer"]), + reversals: z.object({ + data: z.array(z.lazy(() => s_transfer_reversal)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }), + reversed: PermissiveBoolean, + source_transaction: z + .union([z.string().max(5000), z.lazy(() => s_charge)]) + .nullable() + .optional(), + source_type: z.string().max(5000).optional(), + transfer_group: z.string().max(5000).nullable().optional(), + }) + +export const s_transfer_reversal: z.ZodType< + t_transfer_reversal, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + balance_transaction: z + .union([z.string().max(5000), z.lazy(() => s_balance_transaction)]) + .nullable() + .optional(), + created: z.coerce.number(), + currency: z.string(), + destination_payment_refund: z + .union([z.string().max(5000), z.lazy(() => s_refund)]) + .nullable() + .optional(), + id: z.string().max(5000), + metadata: z.record(z.string().max(500)).nullable().optional(), + object: z.enum(["transfer_reversal"]), + source_refund: z + .union([z.string().max(5000), z.lazy(() => s_refund)]) + .nullable() + .optional(), + transfer: z.union([z.string().max(5000), z.lazy(() => s_transfer)]), +}) + +export const s_treasury_credit_reversal: z.ZodType< + t_treasury_credit_reversal, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + financial_account: z.string().max(5000), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + network: z.enum(["ach", "stripe"]), + object: z.enum(["treasury.credit_reversal"]), + received_credit: z.string().max(5000), + status: z.enum(["canceled", "posted", "processing"]), + status_transitions: s_treasury_received_credits_resource_status_transitions, + transaction: z + .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .nullable() + .optional(), +}) + +export const s_treasury_debit_reversal: z.ZodType< + t_treasury_debit_reversal, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + created: z.coerce.number(), + currency: z.string(), + financial_account: z.string().max(5000).nullable().optional(), + hosted_regulatory_receipt_url: z.string().max(5000).nullable().optional(), + id: z.string().max(5000), + linked_flows: s_treasury_received_debits_resource_debit_reversal_linked_flows + .nullable() + .optional(), + livemode: PermissiveBoolean, + metadata: z.record(z.string().max(500)), + network: z.enum(["ach", "card"]), + object: z.enum(["treasury.debit_reversal"]), + received_debit: z.string().max(5000), + status: z.enum(["failed", "processing", "succeeded"]), + status_transitions: s_treasury_received_debits_resource_status_transitions, + transaction: z + .union([z.string().max(5000), z.lazy(() => s_treasury_transaction)]) + .nullable() + .optional(), +}) + +export const s_treasury_transaction_entry: z.ZodType< + t_treasury_transaction_entry, + z.ZodTypeDef, + unknown +> = z.object({ + balance_impact: s_treasury_transactions_resource_balance_impact, + created: z.coerce.number(), + currency: z.string(), + effective_at: z.coerce.number(), + financial_account: z.string().max(5000), + flow: z.string().max(5000).nullable().optional(), + flow_details: z.lazy(() => + s_treasury_transactions_resource_flow_details.nullable().optional(), + ), + flow_type: z.enum([ + "credit_reversal", + "debit_reversal", + "inbound_transfer", + "issuing_authorization", + "other", + "outbound_payment", + "outbound_transfer", + "received_credit", + "received_debit", + ]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["treasury.transaction_entry"]), + transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_treasury_transaction), + ]), + type: z.enum([ + "credit_reversal", + "credit_reversal_posting", + "debit_reversal", + "inbound_transfer", + "inbound_transfer_return", + "issuing_authorization_hold", + "issuing_authorization_release", + "other", + "outbound_payment", + "outbound_payment_cancellation", + "outbound_payment_failure", + "outbound_payment_posting", + "outbound_payment_return", + "outbound_transfer", + "outbound_transfer_cancellation", + "outbound_transfer_failure", + "outbound_transfer_posting", + "outbound_transfer_return", + "received_credit", + "received_debit", + ]), +}) + +export const s_treasury_transaction: z.ZodType< + t_treasury_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + balance_impact: s_treasury_transactions_resource_balance_impact, + created: z.coerce.number(), + currency: z.string(), + description: z.string().max(5000), + entries: z + .object({ + data: z.array(z.lazy(() => s_treasury_transaction_entry)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z + .string() + .max(5000) + .regex(new RegExp("^/v1/treasury/transaction_entries")), + }) + .nullable() + .optional(), + financial_account: z.string().max(5000), + flow: z.string().max(5000).nullable().optional(), + flow_details: z.lazy(() => + s_treasury_transactions_resource_flow_details.nullable().optional(), + ), + flow_type: z.enum([ + "credit_reversal", + "debit_reversal", + "inbound_transfer", + "issuing_authorization", + "other", + "outbound_payment", + "outbound_transfer", + "received_credit", + "received_debit", + ]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["treasury.transaction"]), + status: z.enum(["open", "posted", "void"]), + status_transitions: + s_treasury_transactions_resource_abstract_transaction_resource_status_transitions, +}) + +export const s_legal_entity_company: z.ZodType< + t_legal_entity_company, + z.ZodTypeDef, + unknown +> = z.object({ + address: s_address.optional(), + address_kana: s_legal_entity_japan_address.nullable().optional(), + address_kanji: s_legal_entity_japan_address.nullable().optional(), + directors_provided: PermissiveBoolean.optional(), + directorship_declaration: s_legal_entity_directorship_declaration + .nullable() + .optional(), + executives_provided: PermissiveBoolean.optional(), + export_license_id: z.string().max(5000).optional(), + export_purpose_code: z.string().max(5000).optional(), + name: z.string().max(5000).nullable().optional(), + name_kana: z.string().max(5000).nullable().optional(), + name_kanji: z.string().max(5000).nullable().optional(), + owners_provided: PermissiveBoolean.optional(), + ownership_declaration: s_legal_entity_ubo_declaration.nullable().optional(), + ownership_exemption_reason: z + .enum([ + "qualified_entity_exceeds_ownership_threshold", + "qualifies_as_financial_institution", + ]) + .optional(), + phone: z.string().max(5000).nullable().optional(), + structure: z + .enum([ + "free_zone_establishment", + "free_zone_llc", + "government_instrumentality", + "governmental_unit", + "incorporated_non_profit", + "incorporated_partnership", + "limited_liability_partnership", + "llc", + "multi_member_llc", + "private_company", + "private_corporation", + "private_partnership", + "public_company", + "public_corporation", + "public_partnership", + "registered_charity", + "single_member_llc", + "sole_establishment", + "sole_proprietorship", + "tax_exempt_government_instrumentality", + "unincorporated_association", + "unincorporated_non_profit", + "unincorporated_partnership", + ]) + .optional(), + tax_id_provided: PermissiveBoolean.optional(), + tax_id_registrar: z.string().max(5000).optional(), + vat_id_provided: PermissiveBoolean.optional(), + verification: z.lazy(() => + s_legal_entity_company_verification.nullable().optional(), + ), +}) + +export const s_account_settings: z.ZodType< + t_account_settings, + z.ZodTypeDef, + unknown +> = z.object({ + bacs_debit_payments: s_account_bacs_debit_payments_settings.optional(), + branding: z.lazy(() => s_account_branding_settings), + card_issuing: s_account_card_issuing_settings.optional(), + card_payments: s_account_card_payments_settings, + dashboard: s_account_dashboard_settings, + invoices: z.lazy(() => s_account_invoices_settings.optional()), + payments: s_account_payments_settings, + payouts: s_account_payout_settings.optional(), + sepa_debit_payments: s_account_sepa_debit_payments_settings.optional(), + treasury: s_account_treasury_settings.optional(), +}) + +export const s_api_errors: z.ZodType = + z.object({ + advice_code: z.string().max(5000).optional(), + charge: z.string().max(5000).optional(), + code: z.string().max(5000).optional(), + decline_code: z.string().max(5000).optional(), + doc_url: z.string().max(5000).optional(), + message: z.string().max(40000).optional(), + network_advice_code: z.string().max(5000).optional(), + network_decline_code: z.string().max(5000).optional(), + param: z.string().max(5000).optional(), + payment_intent: z.lazy(() => s_payment_intent.optional()), + payment_method: z.lazy(() => s_payment_method.optional()), + payment_method_type: z.string().max(5000).optional(), + request_log_url: z.string().max(5000).optional(), + setup_intent: z.lazy(() => s_setup_intent.optional()), + source: z + .union([z.lazy(() => s_bank_account), z.lazy(() => s_card), s_source]) + .optional(), + type: z.enum([ + "api_error", + "card_error", + "idempotency_error", + "invalid_request_error", + ]), + }) + +export const s_legal_entity_person_verification: z.ZodType< + t_legal_entity_person_verification, + z.ZodTypeDef, + unknown +> = z.object({ + additional_document: z.lazy(() => + s_legal_entity_person_verification_document.nullable().optional(), + ), + details: z.string().max(5000).nullable().optional(), + details_code: z.string().max(5000).nullable().optional(), + document: z.lazy(() => + s_legal_entity_person_verification_document.optional(), + ), + status: z.string().max(5000), +}) + +export const s_connect_collection_transfer: z.ZodType< + t_connect_collection_transfer, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + currency: z.string(), + destination: z.union([z.string().max(5000), z.lazy(() => s_account)]), + id: z.string().max(5000), + livemode: PermissiveBoolean, + object: z.enum(["connect_collection_transfer"]), +}) + +export const s_thresholds_resource_usage_threshold_config: z.ZodType< + t_thresholds_resource_usage_threshold_config, + z.ZodTypeDef, + unknown +> = z.object({ + filters: z + .array(z.lazy(() => s_thresholds_resource_usage_alert_filter)) + .nullable() + .optional(), + gte: z.coerce.number(), + meter: z.union([z.string().max(5000), s_billing_meter]), + recurrence: z.enum(["one_time"]), +}) + +export const s_billing_credit_grants_resource_balance_credit: z.ZodType< + t_billing_credit_grants_resource_balance_credit, + z.ZodTypeDef, + unknown +> = z.object({ + amount: s_billing_credit_grants_resource_amount, + credits_application_invoice_voided: z.lazy(() => + s_billing_credit_grants_resource_balance_credits_application_invoice_voided + .nullable() + .optional(), + ), + type: z.enum(["credits_application_invoice_voided", "credits_granted"]), +}) + +export const s_billing_credit_grants_resource_balance_debit: z.ZodType< + t_billing_credit_grants_resource_balance_debit, + z.ZodTypeDef, + unknown +> = z.object({ + amount: s_billing_credit_grants_resource_amount, + credits_applied: z.lazy(() => + s_billing_credit_grants_resource_balance_credits_applied + .nullable() + .optional(), + ), + type: z.enum(["credits_applied", "credits_expired", "credits_voided"]), +}) + +export const s_payment_method_details: z.ZodType< + t_payment_method_details, + z.ZodTypeDef, + unknown +> = z.object({ + ach_credit_transfer: s_payment_method_details_ach_credit_transfer.optional(), + ach_debit: s_payment_method_details_ach_debit.optional(), + acss_debit: s_payment_method_details_acss_debit.optional(), + affirm: s_payment_method_details_affirm.optional(), + afterpay_clearpay: s_payment_method_details_afterpay_clearpay.optional(), + alipay: s_payment_flows_private_payment_methods_alipay_details.optional(), + alma: s_payment_method_details_alma.optional(), + amazon_pay: s_payment_method_details_amazon_pay.optional(), + au_becs_debit: s_payment_method_details_au_becs_debit.optional(), + bacs_debit: s_payment_method_details_bacs_debit.optional(), + bancontact: z.lazy(() => s_payment_method_details_bancontact.optional()), + billie: s_payment_method_details_billie.optional(), + blik: s_payment_method_details_blik.optional(), + boleto: s_payment_method_details_boleto.optional(), + card: s_payment_method_details_card.optional(), + card_present: s_payment_method_details_card_present.optional(), + cashapp: s_payment_method_details_cashapp.optional(), + customer_balance: s_payment_method_details_customer_balance.optional(), + eps: s_payment_method_details_eps.optional(), + fpx: s_payment_method_details_fpx.optional(), + giropay: s_payment_method_details_giropay.optional(), + grabpay: s_payment_method_details_grabpay.optional(), + ideal: z.lazy(() => s_payment_method_details_ideal.optional()), + interac_present: s_payment_method_details_interac_present.optional(), + kakao_pay: s_payment_method_details_kakao_pay.optional(), + klarna: s_payment_method_details_klarna.optional(), + konbini: s_payment_method_details_konbini.optional(), + kr_card: s_payment_method_details_kr_card.optional(), + link: s_payment_method_details_link.optional(), + mobilepay: s_payment_method_details_mobilepay.optional(), + multibanco: s_payment_method_details_multibanco.optional(), + naver_pay: s_payment_method_details_naver_pay.optional(), + nz_bank_account: s_payment_method_details_nz_bank_account.optional(), + oxxo: s_payment_method_details_oxxo.optional(), + p24: s_payment_method_details_p24.optional(), + pay_by_bank: s_payment_method_details_pay_by_bank.optional(), + payco: s_payment_method_details_payco.optional(), + paynow: s_payment_method_details_paynow.optional(), + paypal: s_payment_method_details_paypal.optional(), + pix: s_payment_method_details_pix.optional(), + promptpay: s_payment_method_details_promptpay.optional(), + revolut_pay: s_payment_method_details_revolut_pay.optional(), + samsung_pay: s_payment_method_details_samsung_pay.optional(), + satispay: s_payment_method_details_satispay.optional(), + sepa_debit: s_payment_method_details_sepa_debit.optional(), + sofort: z.lazy(() => s_payment_method_details_sofort.optional()), + stripe_account: s_payment_method_details_stripe_account.optional(), + swish: s_payment_method_details_swish.optional(), + twint: s_payment_method_details_twint.optional(), + type: z.string().max(5000), + us_bank_account: z.lazy(() => + s_payment_method_details_us_bank_account.optional(), + ), + wechat: s_payment_method_details_wechat.optional(), + wechat_pay: s_payment_method_details_wechat_pay.optional(), + zip: s_payment_method_details_zip.optional(), +}) + +export const s_charge_transfer_data: z.ZodType< + t_charge_transfer_data, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number().nullable().optional(), + destination: z.union([z.string().max(5000), z.lazy(() => s_account)]), +}) + +export const s_dispute_evidence: z.ZodType< + t_dispute_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + access_activity_log: z.string().max(150000).nullable().optional(), + billing_address: z.string().max(5000).nullable().optional(), + cancellation_policy: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + cancellation_policy_disclosure: z.string().max(150000).nullable().optional(), + cancellation_rebuttal: z.string().max(150000).nullable().optional(), + customer_communication: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + customer_email_address: z.string().max(5000).nullable().optional(), + customer_name: z.string().max(5000).nullable().optional(), + customer_purchase_ip: z.string().max(5000).nullable().optional(), + customer_signature: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + duplicate_charge_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + duplicate_charge_explanation: z.string().max(150000).nullable().optional(), + duplicate_charge_id: z.string().max(5000).nullable().optional(), + enhanced_evidence: s_dispute_enhanced_evidence, + product_description: z.string().max(150000).nullable().optional(), + receipt: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + refund_policy: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + refund_policy_disclosure: z.string().max(150000).nullable().optional(), + refund_refusal_explanation: z.string().max(150000).nullable().optional(), + service_date: z.string().max(5000).nullable().optional(), + service_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + shipping_address: z.string().max(5000).nullable().optional(), + shipping_carrier: z.string().max(5000).nullable().optional(), + shipping_date: z.string().max(5000).nullable().optional(), + shipping_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + shipping_tracking_number: z.string().max(5000).nullable().optional(), + uncategorized_file: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + uncategorized_text: z.string().max(150000).nullable().optional(), +}) + +export const s_payment_pages_checkout_session_automatic_tax: z.ZodType< + t_payment_pages_checkout_session_automatic_tax, + z.ZodTypeDef, + unknown +> = z.object({ + enabled: PermissiveBoolean, + liability: z.lazy(() => s_connect_account_reference.nullable().optional()), + status: z + .enum(["complete", "failed", "requires_location_inputs"]) + .nullable() + .optional(), +}) + +export const s_payment_pages_checkout_session_discount: z.ZodType< + t_payment_pages_checkout_session_discount, + z.ZodTypeDef, + unknown +> = z.object({ + coupon: z + .union([z.string().max(5000), s_coupon]) + .nullable() + .optional(), + promotion_code: z + .union([z.string().max(5000), z.lazy(() => s_promotion_code)]) + .nullable() + .optional(), +}) + +export const s_payment_pages_checkout_session_invoice_creation: z.ZodType< + t_payment_pages_checkout_session_invoice_creation, + z.ZodTypeDef, + unknown +> = z.object({ + enabled: PermissiveBoolean, + invoice_data: z.lazy(() => s_payment_pages_checkout_session_invoice_settings), +}) + +export const s_payment_pages_checkout_session_total_details: z.ZodType< + t_payment_pages_checkout_session_total_details, + z.ZodTypeDef, + unknown +> = z.object({ + amount_discount: z.coerce.number(), + amount_shipping: z.coerce.number().nullable().optional(), + amount_tax: z.coerce.number(), + breakdown: z.lazy(() => + s_payment_pages_checkout_session_total_details_resource_breakdown.optional(), + ), +}) + +export const s_line_items_discount_amount: z.ZodType< + t_line_items_discount_amount, + z.ZodTypeDef, + unknown +> = z.object({ amount: z.coerce.number(), discount: z.lazy(() => s_discount) }) + +export const s_confirmation_tokens_resource_payment_method_preview: z.ZodType< + t_confirmation_tokens_resource_payment_method_preview, + z.ZodTypeDef, + unknown +> = z.object({ + acss_debit: s_payment_method_acss_debit.optional(), + affirm: s_payment_method_affirm.optional(), + afterpay_clearpay: s_payment_method_afterpay_clearpay.optional(), + alipay: s_payment_flows_private_payment_methods_alipay.optional(), + allow_redisplay: z.enum(["always", "limited", "unspecified"]).optional(), + alma: s_payment_method_alma.optional(), + amazon_pay: s_payment_method_amazon_pay.optional(), + au_becs_debit: s_payment_method_au_becs_debit.optional(), + bacs_debit: s_payment_method_bacs_debit.optional(), + bancontact: s_payment_method_bancontact.optional(), + billie: s_payment_method_billie.optional(), + billing_details: s_billing_details, + blik: s_payment_method_blik.optional(), + boleto: s_payment_method_boleto.optional(), + card: z.lazy(() => s_payment_method_card.optional()), + card_present: s_payment_method_card_present.optional(), + cashapp: s_payment_method_cashapp.optional(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer)]) + .nullable() + .optional(), + customer_balance: s_payment_method_customer_balance.optional(), + eps: s_payment_method_eps.optional(), + fpx: s_payment_method_fpx.optional(), + giropay: s_payment_method_giropay.optional(), + grabpay: s_payment_method_grabpay.optional(), + ideal: s_payment_method_ideal.optional(), + interac_present: s_payment_method_interac_present.optional(), + kakao_pay: s_payment_method_kakao_pay.optional(), + klarna: s_payment_method_klarna.optional(), + konbini: s_payment_method_konbini.optional(), + kr_card: s_payment_method_kr_card.optional(), + link: s_payment_method_link.optional(), + mobilepay: s_payment_method_mobilepay.optional(), + multibanco: s_payment_method_multibanco.optional(), + naver_pay: s_payment_method_naver_pay.optional(), + nz_bank_account: s_payment_method_nz_bank_account.optional(), + oxxo: s_payment_method_oxxo.optional(), + p24: s_payment_method_p24.optional(), + pay_by_bank: s_payment_method_pay_by_bank.optional(), + payco: s_payment_method_payco.optional(), + paynow: s_payment_method_paynow.optional(), + paypal: s_payment_method_paypal.optional(), + pix: s_payment_method_pix.optional(), + promptpay: s_payment_method_promptpay.optional(), + revolut_pay: s_payment_method_revolut_pay.optional(), + samsung_pay: s_payment_method_samsung_pay.optional(), + satispay: s_payment_method_satispay.optional(), + sepa_debit: z.lazy(() => s_payment_method_sepa_debit.optional()), + sofort: s_payment_method_sofort.optional(), + swish: s_payment_method_swish.optional(), + twint: s_payment_method_twint.optional(), + type: z.enum([ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "card_present", + "cashapp", + "customer_balance", + "eps", + "fpx", + "giropay", + "grabpay", + "ideal", + "interac_present", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "link", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "pix", + "promptpay", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "sofort", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ]), + us_bank_account: s_payment_method_us_bank_account.optional(), + wechat_pay: s_payment_method_wechat_pay.optional(), + zip: s_payment_method_zip.optional(), +}) + +export const s_discounts_resource_discount_amount: z.ZodType< + t_discounts_resource_discount_amount, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + discount: z.union([ + z.string().max(5000), + z.lazy(() => s_discount), + z.lazy(() => s_deleted_discount), + ]), +}) + +export const s_credit_notes_pretax_credit_amount: z.ZodType< + t_credit_notes_pretax_credit_amount, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + credit_balance_transaction: z + .union([ + z.string().max(5000), + z.lazy(() => s_billing_credit_balance_transaction), + ]) + .optional(), + discount: z + .union([ + z.string().max(5000), + z.lazy(() => s_discount), + z.lazy(() => s_deleted_discount), + ]) + .optional(), + type: z.enum(["credit_balance_transaction", "discount"]), +}) + +export const s_credit_note_refund: z.ZodType< + t_credit_note_refund, + z.ZodTypeDef, + unknown +> = z.object({ + amount_refunded: z.coerce.number(), + refund: z.union([z.string().max(5000), z.lazy(() => s_refund)]), +}) + +export const s_invoice_setting_customer_setting: z.ZodType< + t_invoice_setting_customer_setting, + z.ZodTypeDef, + unknown +> = z.object({ + custom_fields: z.array(s_invoice_setting_custom_field).nullable().optional(), + default_payment_method: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + footer: z.string().max(5000).nullable().optional(), + rendering_options: s_invoice_setting_customer_rendering_options + .nullable() + .optional(), +}) + +export const s_customer_balance_resource_cash_balance_transaction_resource_adjusted_for_overdraft: z.ZodType< + t_customer_balance_resource_cash_balance_transaction_resource_adjusted_for_overdraft, + z.ZodTypeDef, + unknown +> = z.object({ + balance_transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_balance_transaction), + ]), + linked_transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_customer_cash_balance_transaction), + ]), +}) + +export const s_customer_balance_resource_cash_balance_transaction_resource_applied_to_payment_transaction: z.ZodType< + t_customer_balance_resource_cash_balance_transaction_resource_applied_to_payment_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + payment_intent: z.union([ + z.string().max(5000), + z.lazy(() => s_payment_intent), + ]), +}) + +export const s_customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction: z.ZodType< + t_customer_balance_resource_cash_balance_transaction_resource_refunded_from_payment_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + refund: z.union([z.string().max(5000), z.lazy(() => s_refund)]), +}) + +export const s_customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance: z.ZodType< + t_customer_balance_resource_cash_balance_transaction_resource_transferred_to_balance, + z.ZodTypeDef, + unknown +> = z.object({ + balance_transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_balance_transaction), + ]), +}) + +export const s_customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction: z.ZodType< + t_customer_balance_resource_cash_balance_transaction_resource_unapplied_from_payment_transaction, + z.ZodTypeDef, + unknown +> = z.object({ + payment_intent: z.union([ + z.string().max(5000), + z.lazy(() => s_payment_intent), + ]), +}) + +export const s_payment_method_card: z.ZodType< + t_payment_method_card, + z.ZodTypeDef, + unknown +> = z.object({ + brand: z.string().max(5000), + checks: s_payment_method_card_checks.nullable().optional(), + country: z.string().max(5000).nullable().optional(), + display_brand: z.string().max(5000).nullable().optional(), + exp_month: z.coerce.number(), + exp_year: z.coerce.number(), + fingerprint: z.string().max(5000).nullable().optional(), + funding: z.string().max(5000), + generated_from: z.lazy(() => + s_payment_method_card_generated_card.nullable().optional(), + ), + last4: z.string().max(5000), + networks: s_networks.nullable().optional(), + regulated_status: z.enum(["regulated", "unregulated"]).nullable().optional(), + three_d_secure_usage: s_three_d_secure_usage.nullable().optional(), + wallet: s_payment_method_card_wallet.nullable().optional(), +}) + +export const s_payment_method_sepa_debit: z.ZodType< + t_payment_method_sepa_debit, + z.ZodTypeDef, + unknown +> = z.object({ + bank_code: z.string().max(5000).nullable().optional(), + branch_code: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + generated_from: z.lazy(() => + s_sepa_debit_generated_from.nullable().optional(), + ), + last4: z.string().max(5000).nullable().optional(), +}) + +export const s_subscription_automatic_tax: z.ZodType< + t_subscription_automatic_tax, + z.ZodTypeDef, + unknown +> = z.object({ + disabled_reason: z.enum(["requires_location_inputs"]).nullable().optional(), + enabled: PermissiveBoolean, + liability: z.lazy(() => s_connect_account_reference.nullable().optional()), +}) + +export const s_subscriptions_resource_subscription_invoice_settings: z.ZodType< + t_subscriptions_resource_subscription_invoice_settings, + z.ZodTypeDef, + unknown +> = z.object({ + account_tax_ids: z + .array( + z.union([z.string().max(5000), z.lazy(() => s_tax_id), s_deleted_tax_id]), + ) + .nullable() + .optional(), + issuer: z.lazy(() => s_connect_account_reference), +}) + +export const s_subscriptions_resource_pending_update: z.ZodType< + t_subscriptions_resource_pending_update, + z.ZodTypeDef, + unknown +> = z.object({ + billing_cycle_anchor: z.coerce.number().nullable().optional(), + expires_at: z.coerce.number(), + subscription_items: z + .array(z.lazy(() => s_subscription_item)) + .nullable() + .optional(), + trial_end: z.coerce.number().nullable().optional(), + trial_from_plan: PermissiveBoolean.nullable().optional(), +}) + +export const s_subscription_transfer_data: z.ZodType< + t_subscription_transfer_data, + z.ZodTypeDef, + unknown +> = z.object({ + amount_percent: z.coerce.number().nullable().optional(), + destination: z.union([z.string().max(5000), z.lazy(() => s_account)]), +}) + +export const s_tax_i_ds_owner: z.ZodType< + t_tax_i_ds_owner, + z.ZodTypeDef, + unknown +> = z.object({ + account: z.union([z.string().max(5000), z.lazy(() => s_account)]).optional(), + application: z.union([z.string().max(5000), s_application]).optional(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer)]) + .optional(), + type: z.enum(["account", "application", "customer", "self"]), +}) + +export const s_bank_connections_resource_accountholder: z.ZodType< + t_bank_connections_resource_accountholder, + z.ZodTypeDef, + unknown +> = z.object({ + account: z.union([z.string().max(5000), z.lazy(() => s_account)]).optional(), + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer)]) + .optional(), + type: z.enum(["account", "customer"]), +}) + +export const s_invoices_payments_invoice_payment_associated_payment: z.ZodType< + t_invoices_payments_invoice_payment_associated_payment, + z.ZodTypeDef, + unknown +> = z.object({ + charge: z.union([z.string().max(5000), z.lazy(() => s_charge)]).optional(), + payment_intent: z + .union([z.string().max(5000), z.lazy(() => s_payment_intent)]) + .optional(), + type: z.enum(["charge", "payment_intent"]), +}) + +export const s_automatic_tax: z.ZodType< + t_automatic_tax, + z.ZodTypeDef, + unknown +> = z.object({ + disabled_reason: z + .enum([ + "finalization_requires_location_inputs", + "finalization_system_error", + ]) + .nullable() + .optional(), + enabled: PermissiveBoolean, + liability: z.lazy(() => s_connect_account_reference.nullable().optional()), + status: z + .enum(["complete", "failed", "requires_location_inputs"]) + .nullable() + .optional(), +}) + +export const s_invoices_resource_from_invoice: z.ZodType< + t_invoices_resource_from_invoice, + z.ZodTypeDef, + unknown +> = z.object({ + action: z.string().max(5000), + invoice: z.union([z.string().max(5000), z.lazy(() => s_invoice)]), +}) + +export const s_connect_account_reference: z.ZodType< + t_connect_account_reference, + z.ZodTypeDef, + unknown +> = z.object({ + account: z.union([z.string().max(5000), z.lazy(() => s_account)]).optional(), + type: z.enum(["account", "self"]), +}) + +export const s_billing_bill_resource_invoicing_parents_invoice_parent: z.ZodType< + t_billing_bill_resource_invoicing_parents_invoice_parent, + z.ZodTypeDef, + unknown +> = z.object({ + quote_details: s_billing_bill_resource_invoicing_parents_invoice_quote_parent + .nullable() + .optional(), + subscription_details: z.lazy(() => + s_billing_bill_resource_invoicing_parents_invoice_subscription_parent + .nullable() + .optional(), + ), + type: z.enum(["quote_details", "subscription_details"]), +}) + +export const s_invoices_resource_pretax_credit_amount: z.ZodType< + t_invoices_resource_pretax_credit_amount, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number(), + credit_balance_transaction: z + .union([ + z.string().max(5000), + z.lazy(() => s_billing_credit_balance_transaction), + ]) + .nullable() + .optional(), + discount: z + .union([ + z.string().max(5000), + z.lazy(() => s_discount), + z.lazy(() => s_deleted_discount), + ]) + .optional(), + type: z.enum(["credit_balance_transaction", "discount"]), +}) + +export const s_issuing_cardholder_individual: z.ZodType< + t_issuing_cardholder_individual, + z.ZodTypeDef, + unknown +> = z.object({ + card_issuing: s_issuing_cardholder_card_issuing.nullable().optional(), + dob: s_issuing_cardholder_individual_dob.nullable().optional(), + first_name: z.string().max(5000).nullable().optional(), + last_name: z.string().max(5000).nullable().optional(), + verification: z.lazy(() => + s_issuing_cardholder_verification.nullable().optional(), + ), +}) + +export const s_issuing_dispute_evidence: z.ZodType< + t_issuing_dispute_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + canceled: z.lazy(() => s_issuing_dispute_canceled_evidence.optional()), + duplicate: z.lazy(() => s_issuing_dispute_duplicate_evidence.optional()), + fraudulent: z.lazy(() => s_issuing_dispute_fraudulent_evidence.optional()), + merchandise_not_as_described: z.lazy(() => + s_issuing_dispute_merchandise_not_as_described_evidence.optional(), + ), + no_valid_authorization: z.lazy(() => + s_issuing_dispute_no_valid_authorization_evidence.optional(), + ), + not_received: z.lazy(() => + s_issuing_dispute_not_received_evidence.optional(), + ), + other: z.lazy(() => s_issuing_dispute_other_evidence.optional()), + reason: z.enum([ + "canceled", + "duplicate", + "fraudulent", + "merchandise_not_as_described", + "no_valid_authorization", + "not_received", + "other", + "service_not_as_described", + ]), + service_not_as_described: z.lazy(() => + s_issuing_dispute_service_not_as_described_evidence.optional(), + ), +}) + +export const s_transfer_data: z.ZodType< + t_transfer_data, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number().optional(), + destination: z.union([z.string().max(5000), z.lazy(() => s_account)]), +}) + +export const s_payment_links_resource_automatic_tax: z.ZodType< + t_payment_links_resource_automatic_tax, + z.ZodTypeDef, + unknown +> = z.object({ + enabled: PermissiveBoolean, + liability: z.lazy(() => s_connect_account_reference.nullable().optional()), +}) + +export const s_payment_links_resource_invoice_creation: z.ZodType< + t_payment_links_resource_invoice_creation, + z.ZodTypeDef, + unknown +> = z.object({ + enabled: PermissiveBoolean, + invoice_data: z.lazy(() => + s_payment_links_resource_invoice_settings.nullable().optional(), + ), +}) + +export const s_payment_links_resource_subscription_data: z.ZodType< + t_payment_links_resource_subscription_data, + z.ZodTypeDef, + unknown +> = z.object({ + description: z.string().max(5000).nullable().optional(), + invoice_settings: z.lazy( + () => s_payment_links_resource_subscription_data_invoice_settings, + ), + metadata: z.record(z.string().max(500)), + trial_period_days: z.coerce.number().nullable().optional(), + trial_settings: s_subscriptions_trials_resource_trial_settings + .nullable() + .optional(), +}) + +export const s_payment_links_resource_transfer_data: z.ZodType< + t_payment_links_resource_transfer_data, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number().nullable().optional(), + destination: z.union([z.string().max(5000), z.lazy(() => s_account)]), +}) + +export const s_quotes_resource_automatic_tax: z.ZodType< + t_quotes_resource_automatic_tax, + z.ZodTypeDef, + unknown +> = z.object({ + enabled: PermissiveBoolean, + liability: z.lazy(() => s_connect_account_reference.nullable().optional()), + status: z + .enum(["complete", "failed", "requires_location_inputs"]) + .nullable() + .optional(), +}) + +export const s_quotes_resource_computed: z.ZodType< + t_quotes_resource_computed, + z.ZodTypeDef, + unknown +> = z.object({ + recurring: z.lazy(() => s_quotes_resource_recurring.nullable().optional()), + upfront: z.lazy(() => s_quotes_resource_upfront), +}) + +export const s_quotes_resource_from_quote: z.ZodType< + t_quotes_resource_from_quote, + z.ZodTypeDef, + unknown +> = z.object({ + is_revision: PermissiveBoolean, + quote: z.union([z.string().max(5000), z.lazy(() => s_quote)]), +}) + +export const s_invoice_setting_quote_setting: z.ZodType< + t_invoice_setting_quote_setting, + z.ZodTypeDef, + unknown +> = z.object({ + days_until_due: z.coerce.number().nullable().optional(), + issuer: z.lazy(() => s_connect_account_reference), +}) + +export const s_quotes_resource_total_details: z.ZodType< + t_quotes_resource_total_details, + z.ZodTypeDef, + unknown +> = z.object({ + amount_discount: z.coerce.number(), + amount_shipping: z.coerce.number().nullable().optional(), + amount_tax: z.coerce.number(), + breakdown: z.lazy(() => + s_quotes_resource_total_details_resource_breakdown.optional(), + ), +}) + +export const s_quotes_resource_transfer_data: z.ZodType< + t_quotes_resource_transfer_data, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number().nullable().optional(), + amount_percent: z.coerce.number().nullable().optional(), + destination: z.union([z.string().max(5000), z.lazy(() => s_account)]), +}) + +export const s_setup_attempt_payment_method_details: z.ZodType< + t_setup_attempt_payment_method_details, + z.ZodTypeDef, + unknown +> = z.object({ + acss_debit: s_setup_attempt_payment_method_details_acss_debit.optional(), + amazon_pay: s_setup_attempt_payment_method_details_amazon_pay.optional(), + au_becs_debit: + s_setup_attempt_payment_method_details_au_becs_debit.optional(), + bacs_debit: s_setup_attempt_payment_method_details_bacs_debit.optional(), + bancontact: z.lazy(() => + s_setup_attempt_payment_method_details_bancontact.optional(), + ), + boleto: s_setup_attempt_payment_method_details_boleto.optional(), + card: s_setup_attempt_payment_method_details_card.optional(), + card_present: z.lazy(() => + s_setup_attempt_payment_method_details_card_present.optional(), + ), + cashapp: s_setup_attempt_payment_method_details_cashapp.optional(), + ideal: z.lazy(() => s_setup_attempt_payment_method_details_ideal.optional()), + kakao_pay: s_setup_attempt_payment_method_details_kakao_pay.optional(), + klarna: s_setup_attempt_payment_method_details_klarna.optional(), + kr_card: s_setup_attempt_payment_method_details_kr_card.optional(), + link: s_setup_attempt_payment_method_details_link.optional(), + naver_pay: s_setup_attempt_payment_method_details_naver_pay.optional(), + nz_bank_account: + s_setup_attempt_payment_method_details_nz_bank_account.optional(), + paypal: s_setup_attempt_payment_method_details_paypal.optional(), + revolut_pay: s_setup_attempt_payment_method_details_revolut_pay.optional(), + sepa_debit: s_setup_attempt_payment_method_details_sepa_debit.optional(), + sofort: z.lazy(() => + s_setup_attempt_payment_method_details_sofort.optional(), + ), + type: z.string().max(5000), + us_bank_account: + s_setup_attempt_payment_method_details_us_bank_account.optional(), +}) + +export const s_subscription_schedules_resource_default_settings: z.ZodType< + t_subscription_schedules_resource_default_settings, + z.ZodTypeDef, + unknown +> = z.object({ + application_fee_percent: z.coerce.number().nullable().optional(), + automatic_tax: z.lazy(() => + s_subscription_schedules_resource_default_settings_automatic_tax.optional(), + ), + billing_cycle_anchor: z.enum(["automatic", "phase_start"]), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .nullable() + .optional(), + default_payment_method: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + description: z.string().max(5000).nullable().optional(), + invoice_settings: z.lazy( + () => s_invoice_setting_subscription_schedule_setting, + ), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + transfer_data: z.lazy(() => + s_subscription_transfer_data.nullable().optional(), + ), +}) + +export const s_subscription_schedule_phase_configuration: z.ZodType< + t_subscription_schedule_phase_configuration, + z.ZodTypeDef, + unknown +> = z.object({ + add_invoice_items: z.array( + z.lazy(() => s_subscription_schedule_add_invoice_item), + ), + application_fee_percent: z.coerce.number().nullable().optional(), + automatic_tax: z.lazy(() => s_schedules_phase_automatic_tax.optional()), + billing_cycle_anchor: z + .enum(["automatic", "phase_start"]) + .nullable() + .optional(), + collection_method: z + .enum(["charge_automatically", "send_invoice"]) + .nullable() + .optional(), + currency: z.string(), + default_payment_method: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + default_tax_rates: z.array(s_tax_rate).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + discounts: z.array(z.lazy(() => s_discounts_resource_stackable_discount)), + end_date: z.coerce.number(), + invoice_settings: z.lazy(() => + s_invoice_setting_subscription_schedule_phase_setting.nullable().optional(), + ), + items: z.array(z.lazy(() => s_subscription_schedule_configuration_item)), + metadata: z.record(z.string().max(500)).nullable().optional(), + on_behalf_of: z + .union([z.string().max(5000), z.lazy(() => s_account)]) + .nullable() + .optional(), + proration_behavior: z.enum(["always_invoice", "create_prorations", "none"]), + start_date: z.coerce.number(), + transfer_data: z.lazy(() => + s_subscription_transfer_data.nullable().optional(), + ), + trial_end: z.coerce.number().nullable().optional(), +}) + +export const s_terminal_configuration_configuration_resource_device_type_specific_config: z.ZodType< + t_terminal_configuration_configuration_resource_device_type_specific_config, + z.ZodTypeDef, + unknown +> = z.object({ + splashscreen: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .optional(), +}) + +export const s_terminal_reader_reader_resource_reader_action: z.ZodType< + t_terminal_reader_reader_resource_reader_action, + z.ZodTypeDef, + unknown +> = z.object({ + failure_code: z.string().max(5000).nullable().optional(), + failure_message: z.string().max(5000).nullable().optional(), + process_payment_intent: z.lazy(() => + s_terminal_reader_reader_resource_process_payment_intent_action.optional(), + ), + process_setup_intent: z.lazy(() => + s_terminal_reader_reader_resource_process_setup_intent_action.optional(), + ), + refund_payment: z.lazy(() => + s_terminal_reader_reader_resource_refund_payment_action.optional(), + ), + set_reader_display: + s_terminal_reader_reader_resource_set_reader_display_action.optional(), + status: z.enum(["failed", "in_progress", "succeeded"]), + type: z.enum([ + "process_payment_intent", + "process_setup_intent", + "refund_payment", + "set_reader_display", + ]), +}) + +export const s_inbound_transfers: z.ZodType< + t_inbound_transfers, + z.ZodTypeDef, + unknown +> = z.object({ + billing_details: s_treasury_shared_resource_billing_details, + type: z.enum(["us_bank_account"]), + us_bank_account: z.lazy(() => + s_inbound_transfers_payment_method_details_us_bank_account.optional(), + ), +}) + +export const s_outbound_payments_payment_method_details: z.ZodType< + t_outbound_payments_payment_method_details, + z.ZodTypeDef, + unknown +> = z.object({ + billing_details: s_treasury_shared_resource_billing_details, + financial_account: + s_outbound_payments_payment_method_details_financial_account.optional(), + type: z.enum(["financial_account", "us_bank_account"]), + us_bank_account: z.lazy(() => + s_outbound_payments_payment_method_details_us_bank_account.optional(), + ), +}) + +export const s_treasury_outbound_payments_resource_returned_status: z.ZodType< + t_treasury_outbound_payments_resource_returned_status, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.enum([ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "declined", + "incorrect_account_holder_name", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ]), + transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_treasury_transaction), + ]), +}) + +export const s_outbound_transfers_payment_method_details: z.ZodType< + t_outbound_transfers_payment_method_details, + z.ZodTypeDef, + unknown +> = z.object({ + billing_details: s_treasury_shared_resource_billing_details, + financial_account: + s_outbound_transfers_payment_method_details_financial_account.optional(), + type: z.enum(["financial_account", "us_bank_account"]), + us_bank_account: z.lazy(() => + s_outbound_transfers_payment_method_details_us_bank_account.optional(), + ), +}) + +export const s_treasury_outbound_transfers_resource_returned_details: z.ZodType< + t_treasury_outbound_transfers_resource_returned_details, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.enum([ + "account_closed", + "account_frozen", + "bank_account_restricted", + "bank_ownership_changed", + "declined", + "incorrect_account_holder_name", + "invalid_account_number", + "invalid_currency", + "no_account", + "other", + ]), + transaction: z.union([ + z.string().max(5000), + z.lazy(() => s_treasury_transaction), + ]), +}) + +export const s_treasury_received_credits_resource_linked_flows: z.ZodType< + t_treasury_received_credits_resource_linked_flows, + z.ZodTypeDef, + unknown +> = z.object({ + credit_reversal: z.string().max(5000).nullable().optional(), + issuing_authorization: z.string().max(5000).nullable().optional(), + issuing_transaction: z.string().max(5000).nullable().optional(), + source_flow: z.string().max(5000).nullable().optional(), + source_flow_details: z.lazy(() => + s_treasury_received_credits_resource_source_flows_details + .nullable() + .optional(), + ), + source_flow_type: z.string().max(5000).nullable().optional(), +}) + +export const s_treasury_transactions_resource_flow_details: z.ZodType< + t_treasury_transactions_resource_flow_details, + z.ZodTypeDef, + unknown +> = z.object({ + credit_reversal: z.lazy(() => s_treasury_credit_reversal.optional()), + debit_reversal: z.lazy(() => s_treasury_debit_reversal.optional()), + inbound_transfer: z.lazy(() => s_treasury_inbound_transfer.optional()), + issuing_authorization: z.lazy(() => s_issuing_authorization.optional()), + outbound_payment: z.lazy(() => s_treasury_outbound_payment.optional()), + outbound_transfer: z.lazy(() => s_treasury_outbound_transfer.optional()), + received_credit: z.lazy(() => s_treasury_received_credit.optional()), + received_debit: z.lazy(() => s_treasury_received_debit.optional()), + type: z.enum([ + "credit_reversal", + "debit_reversal", + "inbound_transfer", + "issuing_authorization", + "other", + "outbound_payment", + "outbound_transfer", + "received_credit", + "received_debit", + ]), +}) + +export const s_legal_entity_company_verification: z.ZodType< + t_legal_entity_company_verification, + z.ZodTypeDef, + unknown +> = z.object({ + document: z.lazy(() => s_legal_entity_company_verification_document), +}) + +export const s_account_branding_settings: z.ZodType< + t_account_branding_settings, + z.ZodTypeDef, + unknown +> = z.object({ + icon: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + logo: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + primary_color: z.string().max(5000).nullable().optional(), + secondary_color: z.string().max(5000).nullable().optional(), +}) + +export const s_account_invoices_settings: z.ZodType< + t_account_invoices_settings, + z.ZodTypeDef, + unknown +> = z.object({ + default_account_tax_ids: z + .array(z.union([z.string().max(5000), z.lazy(() => s_tax_id)])) + .nullable() + .optional(), + hosted_payment_method_save: z + .enum(["always", "never", "offer"]) + .nullable() + .optional(), +}) + +export const s_legal_entity_person_verification_document: z.ZodType< + t_legal_entity_person_verification_document, + z.ZodTypeDef, + unknown +> = z.object({ + back: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + details: z.string().max(5000).nullable().optional(), + details_code: z.string().max(5000).nullable().optional(), + front: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), +}) + +export const s_thresholds_resource_usage_alert_filter: z.ZodType< + t_thresholds_resource_usage_alert_filter, + z.ZodTypeDef, + unknown +> = z.object({ + customer: z + .union([z.string().max(5000), z.lazy(() => s_customer)]) + .nullable() + .optional(), + type: z.enum(["customer"]), +}) + +export const s_billing_credit_grants_resource_balance_credits_application_invoice_voided: z.ZodType< + t_billing_credit_grants_resource_balance_credits_application_invoice_voided, + z.ZodTypeDef, + unknown +> = z.object({ + invoice: z.union([z.string().max(5000), z.lazy(() => s_invoice)]), + invoice_line_item: z.string().max(5000), +}) + +export const s_billing_credit_grants_resource_balance_credits_applied: z.ZodType< + t_billing_credit_grants_resource_balance_credits_applied, + z.ZodTypeDef, + unknown +> = z.object({ + invoice: z.union([z.string().max(5000), z.lazy(() => s_invoice)]), + invoice_line_item: z.string().max(5000), +}) + +export const s_payment_method_details_bancontact: z.ZodType< + t_payment_method_details_bancontact, + z.ZodTypeDef, + unknown +> = z.object({ + bank_code: z.string().max(5000).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + bic: z.string().max(5000).nullable().optional(), + generated_sepa_debit: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + generated_sepa_debit_mandate: z + .union([z.string().max(5000), z.lazy(() => s_mandate)]) + .nullable() + .optional(), + iban_last4: z.string().max(5000).nullable().optional(), + preferred_language: z.enum(["de", "en", "fr", "nl"]).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_ideal: z.ZodType< + t_payment_method_details_ideal, + z.ZodTypeDef, + unknown +> = z.object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .nullable() + .optional(), + bic: z + .enum([ + "ABNANL2A", + "ASNBNL21", + "BITSNL2A", + "BUNQNL2A", + "FVLBNL22", + "HANDNL2A", + "INGBNL2A", + "KNABNL2H", + "MOYONL21", + "NNBANL2G", + "NTSBDEB1", + "RABONL2U", + "RBRBNL21", + "REVOIE23", + "REVOLT21", + "SNSBNL2A", + "TRIONL2U", + ]) + .nullable() + .optional(), + generated_sepa_debit: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + generated_sepa_debit_mandate: z + .union([z.string().max(5000), z.lazy(() => s_mandate)]) + .nullable() + .optional(), + iban_last4: z.string().max(5000).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_sofort: z.ZodType< + t_payment_method_details_sofort, + z.ZodTypeDef, + unknown +> = z.object({ + bank_code: z.string().max(5000).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + bic: z.string().max(5000).nullable().optional(), + country: z.string().max(5000).nullable().optional(), + generated_sepa_debit: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + generated_sepa_debit_mandate: z + .union([z.string().max(5000), z.lazy(() => s_mandate)]) + .nullable() + .optional(), + iban_last4: z.string().max(5000).nullable().optional(), + preferred_language: z + .enum(["de", "en", "es", "fr", "it", "nl", "pl"]) + .nullable() + .optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_method_details_us_bank_account: z.ZodType< + t_payment_method_details_us_bank_account, + z.ZodTypeDef, + unknown +> = z.object({ + account_holder_type: z.enum(["company", "individual"]).nullable().optional(), + account_type: z.enum(["checking", "savings"]).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.union([z.string().max(5000), z.lazy(() => s_mandate)]).optional(), + payment_reference: z.string().max(5000).nullable().optional(), + routing_number: z.string().max(5000).nullable().optional(), +}) + +export const s_payment_pages_checkout_session_invoice_settings: z.ZodType< + t_payment_pages_checkout_session_invoice_settings, + z.ZodTypeDef, + unknown +> = z.object({ + account_tax_ids: z + .array( + z.union([z.string().max(5000), z.lazy(() => s_tax_id), s_deleted_tax_id]), + ) + .nullable() + .optional(), + custom_fields: z.array(s_invoice_setting_custom_field).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + footer: z.string().max(5000).nullable().optional(), + issuer: z.lazy(() => s_connect_account_reference.nullable().optional()), + metadata: z.record(z.string().max(500)).nullable().optional(), + rendering_options: s_invoice_setting_checkout_rendering_options + .nullable() + .optional(), +}) + +export const s_payment_pages_checkout_session_total_details_resource_breakdown: z.ZodType< + t_payment_pages_checkout_session_total_details_resource_breakdown, + z.ZodTypeDef, + unknown +> = z.object({ + discounts: z.array(z.lazy(() => s_line_items_discount_amount)), + taxes: z.array(s_line_items_tax_amount), +}) + +export const s_payment_method_card_generated_card: z.ZodType< + t_payment_method_card_generated_card, + z.ZodTypeDef, + unknown +> = z.object({ + charge: z.string().max(5000).nullable().optional(), + payment_method_details: s_card_generated_from_payment_method_details + .nullable() + .optional(), + setup_attempt: z + .union([z.string().max(5000), z.lazy(() => s_setup_attempt)]) + .nullable() + .optional(), +}) + +export const s_sepa_debit_generated_from: z.ZodType< + t_sepa_debit_generated_from, + z.ZodTypeDef, + unknown +> = z.object({ + charge: z + .union([z.string().max(5000), z.lazy(() => s_charge)]) + .nullable() + .optional(), + setup_attempt: z + .union([z.string().max(5000), z.lazy(() => s_setup_attempt)]) + .nullable() + .optional(), +}) + +export const s_billing_bill_resource_invoicing_parents_invoice_subscription_parent: z.ZodType< + t_billing_bill_resource_invoicing_parents_invoice_subscription_parent, + z.ZodTypeDef, + unknown +> = z.object({ + metadata: z.record(z.string().max(500)).nullable().optional(), + subscription: z.union([z.string().max(5000), z.lazy(() => s_subscription)]), + subscription_proration_date: z.coerce.number().optional(), +}) + +export const s_issuing_cardholder_verification: z.ZodType< + t_issuing_cardholder_verification, + z.ZodTypeDef, + unknown +> = z.object({ + document: z.lazy(() => + s_issuing_cardholder_id_document.nullable().optional(), + ), +}) + +export const s_issuing_dispute_canceled_evidence: z.ZodType< + t_issuing_dispute_canceled_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + additional_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + canceled_at: z.coerce.number().nullable().optional(), + cancellation_policy_provided: PermissiveBoolean.nullable().optional(), + cancellation_reason: z.string().max(5000).nullable().optional(), + expected_at: z.coerce.number().nullable().optional(), + explanation: z.string().max(5000).nullable().optional(), + product_description: z.string().max(5000).nullable().optional(), + product_type: z.enum(["merchandise", "service"]).nullable().optional(), + return_status: z + .enum(["merchant_rejected", "successful"]) + .nullable() + .optional(), + returned_at: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_dispute_duplicate_evidence: z.ZodType< + t_issuing_dispute_duplicate_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + additional_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + card_statement: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + cash_receipt: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + check_image: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + explanation: z.string().max(5000).nullable().optional(), + original_transaction: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_dispute_fraudulent_evidence: z.ZodType< + t_issuing_dispute_fraudulent_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + additional_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + explanation: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_dispute_merchandise_not_as_described_evidence: z.ZodType< + t_issuing_dispute_merchandise_not_as_described_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + additional_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + explanation: z.string().max(5000).nullable().optional(), + received_at: z.coerce.number().nullable().optional(), + return_description: z.string().max(5000).nullable().optional(), + return_status: z + .enum(["merchant_rejected", "successful"]) + .nullable() + .optional(), + returned_at: z.coerce.number().nullable().optional(), +}) + +export const s_issuing_dispute_no_valid_authorization_evidence: z.ZodType< + t_issuing_dispute_no_valid_authorization_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + additional_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + explanation: z.string().max(5000).nullable().optional(), +}) + +export const s_issuing_dispute_not_received_evidence: z.ZodType< + t_issuing_dispute_not_received_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + additional_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + expected_at: z.coerce.number().nullable().optional(), + explanation: z.string().max(5000).nullable().optional(), + product_description: z.string().max(5000).nullable().optional(), + product_type: z.enum(["merchandise", "service"]).nullable().optional(), +}) + +export const s_issuing_dispute_other_evidence: z.ZodType< + t_issuing_dispute_other_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + additional_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + explanation: z.string().max(5000).nullable().optional(), + product_description: z.string().max(5000).nullable().optional(), + product_type: z.enum(["merchandise", "service"]).nullable().optional(), +}) + +export const s_issuing_dispute_service_not_as_described_evidence: z.ZodType< + t_issuing_dispute_service_not_as_described_evidence, + z.ZodTypeDef, + unknown +> = z.object({ + additional_documentation: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + canceled_at: z.coerce.number().nullable().optional(), + cancellation_reason: z.string().max(5000).nullable().optional(), + explanation: z.string().max(5000).nullable().optional(), + received_at: z.coerce.number().nullable().optional(), +}) + +export const s_payment_links_resource_invoice_settings: z.ZodType< + t_payment_links_resource_invoice_settings, + z.ZodTypeDef, + unknown +> = z.object({ + account_tax_ids: z + .array( + z.union([z.string().max(5000), z.lazy(() => s_tax_id), s_deleted_tax_id]), + ) + .nullable() + .optional(), + custom_fields: z.array(s_invoice_setting_custom_field).nullable().optional(), + description: z.string().max(5000).nullable().optional(), + footer: z.string().max(5000).nullable().optional(), + issuer: z.lazy(() => s_connect_account_reference.nullable().optional()), + metadata: z.record(z.string().max(500)).nullable().optional(), + rendering_options: s_invoice_setting_checkout_rendering_options + .nullable() + .optional(), +}) + +export const s_payment_links_resource_subscription_data_invoice_settings: z.ZodType< + t_payment_links_resource_subscription_data_invoice_settings, + z.ZodTypeDef, + unknown +> = z.object({ issuer: z.lazy(() => s_connect_account_reference) }) + +export const s_quotes_resource_recurring: z.ZodType< + t_quotes_resource_recurring, + z.ZodTypeDef, + unknown +> = z.object({ + amount_subtotal: z.coerce.number(), + amount_total: z.coerce.number(), + interval: z.enum(["day", "month", "week", "year"]), + interval_count: z.coerce.number(), + total_details: z.lazy(() => s_quotes_resource_total_details), +}) + +export const s_quotes_resource_upfront: z.ZodType< + t_quotes_resource_upfront, + z.ZodTypeDef, + unknown +> = z.object({ + amount_subtotal: z.coerce.number(), + amount_total: z.coerce.number(), + line_items: z + .object({ + data: z.array(z.lazy(() => s_item)), + has_more: PermissiveBoolean, + object: z.enum(["list"]), + url: z.string().max(5000), + }) + .optional(), + total_details: z.lazy(() => s_quotes_resource_total_details), +}) + +export const s_quotes_resource_total_details_resource_breakdown: z.ZodType< + t_quotes_resource_total_details_resource_breakdown, + z.ZodTypeDef, + unknown +> = z.object({ + discounts: z.array(z.lazy(() => s_line_items_discount_amount)), + taxes: z.array(s_line_items_tax_amount), +}) + +export const s_setup_attempt_payment_method_details_bancontact: z.ZodType< + t_setup_attempt_payment_method_details_bancontact, + z.ZodTypeDef, + unknown +> = z.object({ + bank_code: z.string().max(5000).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + bic: z.string().max(5000).nullable().optional(), + generated_sepa_debit: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + generated_sepa_debit_mandate: z + .union([z.string().max(5000), z.lazy(() => s_mandate)]) + .nullable() + .optional(), + iban_last4: z.string().max(5000).nullable().optional(), + preferred_language: z.enum(["de", "en", "fr", "nl"]).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_setup_attempt_payment_method_details_card_present: z.ZodType< + t_setup_attempt_payment_method_details_card_present, + z.ZodTypeDef, + unknown +> = z.object({ + generated_card: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + offline: s_payment_method_details_card_present_offline.nullable().optional(), +}) + +export const s_setup_attempt_payment_method_details_ideal: z.ZodType< + t_setup_attempt_payment_method_details_ideal, + z.ZodTypeDef, + unknown +> = z.object({ + bank: z + .enum([ + "abn_amro", + "asn_bank", + "bunq", + "handelsbanken", + "ing", + "knab", + "moneyou", + "n26", + "nn", + "rabobank", + "regiobank", + "revolut", + "sns_bank", + "triodos_bank", + "van_lanschot", + "yoursafe", + ]) + .nullable() + .optional(), + bic: z + .enum([ + "ABNANL2A", + "ASNBNL21", + "BITSNL2A", + "BUNQNL2A", + "FVLBNL22", + "HANDNL2A", + "INGBNL2A", + "KNABNL2H", + "MOYONL21", + "NNBANL2G", + "NTSBDEB1", + "RABONL2U", + "RBRBNL21", + "REVOIE23", + "REVOLT21", + "SNSBNL2A", + "TRIONL2U", + ]) + .nullable() + .optional(), + generated_sepa_debit: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + generated_sepa_debit_mandate: z + .union([z.string().max(5000), z.lazy(() => s_mandate)]) + .nullable() + .optional(), + iban_last4: z.string().max(5000).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_setup_attempt_payment_method_details_sofort: z.ZodType< + t_setup_attempt_payment_method_details_sofort, + z.ZodTypeDef, + unknown +> = z.object({ + bank_code: z.string().max(5000).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + bic: z.string().max(5000).nullable().optional(), + generated_sepa_debit: z + .union([z.string().max(5000), z.lazy(() => s_payment_method)]) + .nullable() + .optional(), + generated_sepa_debit_mandate: z + .union([z.string().max(5000), z.lazy(() => s_mandate)]) + .nullable() + .optional(), + iban_last4: z.string().max(5000).nullable().optional(), + preferred_language: z.enum(["de", "en", "fr", "nl"]).nullable().optional(), + verified_name: z.string().max(5000).nullable().optional(), +}) + +export const s_subscription_schedules_resource_default_settings_automatic_tax: z.ZodType< + t_subscription_schedules_resource_default_settings_automatic_tax, + z.ZodTypeDef, + unknown +> = z.object({ + disabled_reason: z.enum(["requires_location_inputs"]).nullable().optional(), + enabled: PermissiveBoolean, + liability: z.lazy(() => s_connect_account_reference.nullable().optional()), +}) + +export const s_invoice_setting_subscription_schedule_setting: z.ZodType< + t_invoice_setting_subscription_schedule_setting, + z.ZodTypeDef, + unknown +> = z.object({ + account_tax_ids: z + .array( + z.union([z.string().max(5000), z.lazy(() => s_tax_id), s_deleted_tax_id]), + ) + .nullable() + .optional(), + days_until_due: z.coerce.number().nullable().optional(), + issuer: z.lazy(() => s_connect_account_reference), +}) + +export const s_subscription_schedule_add_invoice_item: z.ZodType< + t_subscription_schedule_add_invoice_item, + z.ZodTypeDef, + unknown +> = z.object({ + discounts: z.array(z.lazy(() => s_discounts_resource_stackable_discount)), + price: z.union([ + z.string().max(5000), + z.lazy(() => s_price), + s_deleted_price, + ]), + quantity: z.coerce.number().nullable().optional(), + tax_rates: z.array(s_tax_rate).nullable().optional(), +}) + +export const s_schedules_phase_automatic_tax: z.ZodType< + t_schedules_phase_automatic_tax, + z.ZodTypeDef, + unknown +> = z.object({ + disabled_reason: z.enum(["requires_location_inputs"]).nullable().optional(), + enabled: PermissiveBoolean, + liability: z.lazy(() => s_connect_account_reference.nullable().optional()), +}) + +export const s_discounts_resource_stackable_discount: z.ZodType< + t_discounts_resource_stackable_discount, + z.ZodTypeDef, + unknown +> = z.object({ + coupon: z + .union([z.string().max(5000), s_coupon]) + .nullable() + .optional(), + discount: z + .union([z.string().max(5000), z.lazy(() => s_discount)]) + .nullable() + .optional(), + promotion_code: z + .union([z.string().max(5000), z.lazy(() => s_promotion_code)]) + .nullable() + .optional(), +}) + +export const s_invoice_setting_subscription_schedule_phase_setting: z.ZodType< + t_invoice_setting_subscription_schedule_phase_setting, + z.ZodTypeDef, + unknown +> = z.object({ + account_tax_ids: z + .array( + z.union([z.string().max(5000), z.lazy(() => s_tax_id), s_deleted_tax_id]), + ) + .nullable() + .optional(), + days_until_due: z.coerce.number().nullable().optional(), + issuer: z.lazy(() => s_connect_account_reference.nullable().optional()), +}) + +export const s_subscription_schedule_configuration_item: z.ZodType< + t_subscription_schedule_configuration_item, + z.ZodTypeDef, + unknown +> = z.object({ + discounts: z.array(z.lazy(() => s_discounts_resource_stackable_discount)), + metadata: z.record(z.string().max(500)).nullable().optional(), + price: z.union([ + z.string().max(5000), + z.lazy(() => s_price), + s_deleted_price, + ]), + quantity: z.coerce.number().optional(), + tax_rates: z.array(s_tax_rate).nullable().optional(), +}) + +export const s_terminal_reader_reader_resource_process_payment_intent_action: z.ZodType< + t_terminal_reader_reader_resource_process_payment_intent_action, + z.ZodTypeDef, + unknown +> = z.object({ + payment_intent: z.union([ + z.string().max(5000), + z.lazy(() => s_payment_intent), + ]), + process_config: s_terminal_reader_reader_resource_process_config.optional(), +}) + +export const s_terminal_reader_reader_resource_process_setup_intent_action: z.ZodType< + t_terminal_reader_reader_resource_process_setup_intent_action, + z.ZodTypeDef, + unknown +> = z.object({ + generated_card: z.string().max(5000).optional(), + process_config: + s_terminal_reader_reader_resource_process_setup_config.optional(), + setup_intent: z.union([z.string().max(5000), z.lazy(() => s_setup_intent)]), +}) + +export const s_terminal_reader_reader_resource_refund_payment_action: z.ZodType< + t_terminal_reader_reader_resource_refund_payment_action, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.coerce.number().optional(), + charge: z.union([z.string().max(5000), z.lazy(() => s_charge)]).optional(), + metadata: z.record(z.string().max(500)).optional(), + payment_intent: z + .union([z.string().max(5000), z.lazy(() => s_payment_intent)]) + .optional(), + reason: z + .enum(["duplicate", "fraudulent", "requested_by_customer"]) + .optional(), + refund: z.union([z.string().max(5000), z.lazy(() => s_refund)]).optional(), + refund_application_fee: PermissiveBoolean.optional(), + refund_payment_config: + s_terminal_reader_reader_resource_refund_payment_config.optional(), + reverse_transfer: PermissiveBoolean.optional(), +}) + +export const s_inbound_transfers_payment_method_details_us_bank_account: z.ZodType< + t_inbound_transfers_payment_method_details_us_bank_account, + z.ZodTypeDef, + unknown +> = z.object({ + account_holder_type: z.enum(["company", "individual"]).nullable().optional(), + account_type: z.enum(["checking", "savings"]).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.union([z.string().max(5000), z.lazy(() => s_mandate)]).optional(), + network: z.enum(["ach"]), + routing_number: z.string().max(5000).nullable().optional(), +}) + +export const s_outbound_payments_payment_method_details_us_bank_account: z.ZodType< + t_outbound_payments_payment_method_details_us_bank_account, + z.ZodTypeDef, + unknown +> = z.object({ + account_holder_type: z.enum(["company", "individual"]).nullable().optional(), + account_type: z.enum(["checking", "savings"]).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.union([z.string().max(5000), z.lazy(() => s_mandate)]).optional(), + network: z.enum(["ach", "us_domestic_wire"]), + routing_number: z.string().max(5000).nullable().optional(), +}) + +export const s_outbound_transfers_payment_method_details_us_bank_account: z.ZodType< + t_outbound_transfers_payment_method_details_us_bank_account, + z.ZodTypeDef, + unknown +> = z.object({ + account_holder_type: z.enum(["company", "individual"]).nullable().optional(), + account_type: z.enum(["checking", "savings"]).nullable().optional(), + bank_name: z.string().max(5000).nullable().optional(), + fingerprint: z.string().max(5000).nullable().optional(), + last4: z.string().max(5000).nullable().optional(), + mandate: z.union([z.string().max(5000), z.lazy(() => s_mandate)]).optional(), + network: z.enum(["ach", "us_domestic_wire"]), + routing_number: z.string().max(5000).nullable().optional(), +}) + +export const s_treasury_received_credits_resource_source_flows_details: z.ZodType< + t_treasury_received_credits_resource_source_flows_details, + z.ZodTypeDef, + unknown +> = z.object({ + credit_reversal: z.lazy(() => s_treasury_credit_reversal.optional()), + outbound_payment: z.lazy(() => s_treasury_outbound_payment.optional()), + outbound_transfer: z.lazy(() => s_treasury_outbound_transfer.optional()), + payout: z.lazy(() => s_payout.optional()), + type: z.enum([ + "credit_reversal", + "other", + "outbound_payment", + "outbound_transfer", + "payout", + ]), +}) + +export const s_legal_entity_company_verification_document: z.ZodType< + t_legal_entity_company_verification_document, + z.ZodTypeDef, + unknown +> = z.object({ + back: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + details: z.string().max(5000).nullable().optional(), + details_code: z.string().max(5000).nullable().optional(), + front: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), +}) + +export const s_issuing_cardholder_id_document: z.ZodType< + t_issuing_cardholder_id_document, + z.ZodTypeDef, + unknown +> = z.object({ + back: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), + front: z + .union([z.string().max(5000), z.lazy(() => s_file)]) + .nullable() + .optional(), +}) diff --git a/integration-tests/typescript-express/src/generated/todo-lists.yaml/generated.ts b/integration-tests/typescript-express/src/generated/todo-lists.yaml/generated.ts new file mode 100644 index 000000000..44dee3c03 --- /dev/null +++ b/integration-tests/typescript-express/src/generated/todo-lists.yaml/generated.ts @@ -0,0 +1,752 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { + t_CreateTodoListItemParamSchema, + t_CreateTodoListItemRequestBodySchema, + t_DeleteTodoListByIdParamSchema, + t_Error, + t_GetTodoListByIdParamSchema, + t_GetTodoListItemsParamSchema, + t_GetTodoListsQuerySchema, + t_TodoList, + t_UnknownObject, + t_UpdateTodoListByIdParamSchema, + t_UpdateTodoListByIdRequestBodySchema, + t_UploadAttachmentRequestBodySchema, +} from "./models" +import { + s_CreateUpdateTodoList, + s_Error, + s_Statuses, + s_TodoList, + s_UnknownObject, +} from "./schemas" +import { + ExpressRuntimeError, + RequestInputType, +} from "@nahkies/typescript-express-runtime/errors" +import { + ExpressRuntimeResponder, + ExpressRuntimeResponse, + Params, + ServerConfig, + SkipResponse, + StatusCode, + StatusCode4xx, + StatusCode5xx, + startServer, +} from "@nahkies/typescript-express-runtime/server" +import { + parseRequestInput, + responseValidationFactory, +} from "@nahkies/typescript-express-runtime/zod" +import { NextFunction, Request, Response, Router } from "express" +import { z } from "zod" + +export type GetTodoListsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTodoLists = ( + params: Params, + respond: GetTodoListsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTodoListByIdResponder = { + with200(): ExpressRuntimeResponse + withStatusCode4xx(status: StatusCode4xx): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type GetTodoListById = ( + params: Params, + respond: GetTodoListByIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UpdateTodoListByIdResponder = { + with200(): ExpressRuntimeResponse + withStatusCode4xx(status: StatusCode4xx): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UpdateTodoListById = ( + params: Params< + t_UpdateTodoListByIdParamSchema, + void, + t_UpdateTodoListByIdRequestBodySchema, + void + >, + respond: UpdateTodoListByIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type DeleteTodoListByIdResponder = { + with204(): ExpressRuntimeResponse + withStatusCode4xx(status: StatusCode4xx): ExpressRuntimeResponse + withDefault(status: StatusCode): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type DeleteTodoListById = ( + params: Params, + respond: DeleteTodoListByIdResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type GetTodoListItemsResponder = { + with200(): ExpressRuntimeResponse<{ + completedAt?: string | undefined + content: string + createdAt: string + id: string + }> + withStatusCode5xx(status: StatusCode5xx): ExpressRuntimeResponse<{ + code: string + message: string + }> +} & ExpressRuntimeResponder + +export type GetTodoListItems = ( + params: Params, + respond: GetTodoListItemsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type CreateTodoListItemResponder = { + with204(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type CreateTodoListItem = ( + params: Params< + t_CreateTodoListItemParamSchema, + void, + t_CreateTodoListItemRequestBodySchema, + void + >, + respond: CreateTodoListItemResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type ListAttachmentsResponder = { + with200(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type ListAttachments = ( + params: Params, + respond: ListAttachmentsResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type UploadAttachmentResponder = { + with202(): ExpressRuntimeResponse +} & ExpressRuntimeResponder + +export type UploadAttachment = ( + params: Params, + respond: UploadAttachmentResponder, + req: Request, + res: Response, + next: NextFunction, +) => Promise | typeof SkipResponse> + +export type Implementation = { + getTodoLists: GetTodoLists + getTodoListById: GetTodoListById + updateTodoListById: UpdateTodoListById + deleteTodoListById: DeleteTodoListById + getTodoListItems: GetTodoListItems + createTodoListItem: CreateTodoListItem + listAttachments: ListAttachments + uploadAttachment: UploadAttachment +} + +export function createRouter(implementation: Implementation): Router { + const router = Router() + + const getTodoListsQuerySchema = z.object({ + created: z.string().datetime({ offset: true }).optional(), + statuses: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + s_Statuses, + ) + .optional(), + tags: z + .preprocess( + (it: unknown) => (Array.isArray(it) || it === undefined ? it : [it]), + z.array(z.string()), + ) + .optional(), + }) + + const getTodoListsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_TodoList)]], + undefined, + ) + + // getTodoLists + router.get( + `/list`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: parseRequestInput( + getTodoListsQuerySchema, + req.query, + RequestInputType.QueryString, + ), + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTodoLists(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTodoListsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTodoListByIdParamSchema = z.object({ listId: z.string() }) + + const getTodoListByIdResponseBodyValidator = responseValidationFactory( + [ + ["200", s_TodoList], + ["4XX", s_Error], + ], + z.undefined(), + ) + + // getTodoListById + router.get( + `/list/:listId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTodoListByIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatusCode4xx(status: StatusCode4xx) { + return new ExpressRuntimeResponse(status) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTodoListById(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTodoListByIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const updateTodoListByIdParamSchema = z.object({ listId: z.string() }) + + const updateTodoListByIdRequestBodySchema = s_CreateUpdateTodoList + + const updateTodoListByIdResponseBodyValidator = responseValidationFactory( + [ + ["200", s_TodoList], + ["4XX", s_Error], + ], + z.undefined(), + ) + + // updateTodoListById + router.put( + `/list/:listId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + updateTodoListByIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + updateTodoListByIdRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatusCode4xx(status: StatusCode4xx) { + return new ExpressRuntimeResponse(status) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .updateTodoListById(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(updateTodoListByIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const deleteTodoListByIdParamSchema = z.object({ listId: z.string() }) + + const deleteTodoListByIdResponseBodyValidator = responseValidationFactory( + [ + ["204", z.undefined()], + ["4XX", s_Error], + ], + z.undefined(), + ) + + // deleteTodoListById + router.delete( + `/list/:listId`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + deleteTodoListByIdParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatusCode4xx(status: StatusCode4xx) { + return new ExpressRuntimeResponse(status) + }, + withDefault(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .deleteTodoListById(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(deleteTodoListByIdResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const getTodoListItemsParamSchema = z.object({ listId: z.string() }) + + const getTodoListItemsResponseBodyValidator = responseValidationFactory( + [ + [ + "200", + z.object({ + id: z.string(), + content: z.string(), + createdAt: z.string().datetime({ offset: true }), + completedAt: z.string().datetime({ offset: true }).optional(), + }), + ], + ["5XX", z.object({ message: z.string(), code: z.string() })], + ], + undefined, + ) + + // getTodoListItems + router.get( + `/list/:listId/items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + getTodoListItemsParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse<{ + completedAt?: string | undefined + content: string + createdAt: string + id: string + }>(200) + }, + withStatusCode5xx(status: StatusCode5xx) { + return new ExpressRuntimeResponse<{ + code: string + message: string + }>(status) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .getTodoListItems(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(getTodoListItemsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const createTodoListItemParamSchema = z.object({ listId: z.string() }) + + const createTodoListItemRequestBodySchema = z.object({ + id: z.string(), + content: z.string(), + completedAt: z.string().datetime({ offset: true }).optional(), + }) + + const createTodoListItemResponseBodyValidator = responseValidationFactory( + [["204", z.undefined()]], + undefined, + ) + + // createTodoListItem + router.post( + `/list/:listId/items`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: parseRequestInput( + createTodoListItemParamSchema, + req.params, + RequestInputType.RouteParam, + ), + query: undefined, + body: parseRequestInput( + createTodoListItemRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with204() { + return new ExpressRuntimeResponse(204) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .createTodoListItem(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(createTodoListItemResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const listAttachmentsResponseBodyValidator = responseValidationFactory( + [["200", z.array(s_UnknownObject)]], + undefined, + ) + + // listAttachments + router.get( + `/attachments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: undefined, + headers: undefined, + } + + const responder = { + with200() { + return new ExpressRuntimeResponse(200) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .listAttachments(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(listAttachmentsResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + const uploadAttachmentRequestBodySchema = z.object({ + file: z.unknown().optional(), + }) + + const uploadAttachmentResponseBodyValidator = responseValidationFactory( + [["202", z.undefined()]], + undefined, + ) + + // uploadAttachment + router.post( + `/attachments`, + async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: undefined, + query: undefined, + body: parseRequestInput( + uploadAttachmentRequestBodySchema, + req.body, + RequestInputType.RequestBody, + ), + headers: undefined, + } + + const responder = { + with202() { + return new ExpressRuntimeResponse(202) + }, + withStatus(status: StatusCode) { + return new ExpressRuntimeResponse(status) + }, + } + + const response = await implementation + .uploadAttachment(input, responder, req, res, next) + .catch((err) => { + throw ExpressRuntimeError.HandlerError(err) + }) + + // escape hatch to allow responses to be sent by the implementation handler + if (response === SkipResponse) { + return + } + + const { status, body } = + response instanceof ExpressRuntimeResponse + ? response.unpack() + : response + + res.status(status) + + if (body !== undefined) { + res.json(uploadAttachmentResponseBodyValidator(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } + }, + ) + + return router +} + +export async function bootstrap(config: ServerConfig) { + // Todo Lists Example API + return startServer(config) +} diff --git a/integration-tests/typescript-express/src/generated/todo-lists.yaml/models.ts b/integration-tests/typescript-express/src/generated/todo-lists.yaml/models.ts new file mode 100644 index 000000000..f6f8960ab --- /dev/null +++ b/integration-tests/typescript-express/src/generated/todo-lists.yaml/models.ts @@ -0,0 +1,63 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +export type t_Error = { + code?: number | undefined + message?: string | undefined +} + +export type t_Statuses = ("incomplete" | "complete")[] + +export type t_TodoList = { + created: string + id: string + incompleteItemCount: number + name: string + totalItemCount: number + updated: string +} + +export type t_CreateTodoListItemParamSchema = { + listId: string +} + +export type t_CreateTodoListItemRequestBodySchema = { + completedAt?: string | undefined + content: string + id: string +} + +export type t_DeleteTodoListByIdParamSchema = { + listId: string +} + +export type t_UnknownObject = { + [key: string]: unknown | undefined +} + +export type t_GetTodoListByIdParamSchema = { + listId: string +} + +export type t_GetTodoListItemsParamSchema = { + listId: string +} + +export type t_GetTodoListsQuerySchema = { + created?: string | undefined + statuses?: t_Statuses | undefined + tags?: string[] | undefined +} + +export type t_UpdateTodoListByIdParamSchema = { + listId: string +} + +export type t_UpdateTodoListByIdRequestBodySchema = { + name: string +} + +export type t_UploadAttachmentRequestBodySchema = { + file?: unknown | undefined +} diff --git a/integration-tests/typescript-express/src/generated/todo-lists.yaml/schemas.ts b/integration-tests/typescript-express/src/generated/todo-lists.yaml/schemas.ts new file mode 100644 index 000000000..dd11359eb --- /dev/null +++ b/integration-tests/typescript-express/src/generated/todo-lists.yaml/schemas.ts @@ -0,0 +1,25 @@ +/** AUTOGENERATED - DO NOT EDIT **/ +/* tslint:disable */ +/* eslint-disable */ + +import { z } from "zod" + +export const s_CreateUpdateTodoList = z.object({ name: z.string() }) + +export const s_Error = z.object({ + message: z.string().optional(), + code: z.coerce.number().optional(), +}) + +export const s_Statuses = z.array(z.enum(["incomplete", "complete"])) + +export const s_TodoList = z.object({ + id: z.string(), + name: z.string(), + totalItemCount: z.coerce.number(), + incompleteItemCount: z.coerce.number(), + created: z.string().datetime({ offset: true }), + updated: z.string().datetime({ offset: true }), +}) + +export const s_UnknownObject = z.record(z.unknown()) diff --git a/integration-tests/typescript-express/tsconfig.json b/integration-tests/typescript-express/tsconfig.json new file mode 100644 index 000000000..b0cd1fe3a --- /dev/null +++ b/integration-tests/typescript-express/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src", + "types": [], + /* exercise the code path where exactOptionalPropertyTypes is enabled */ + "exactOptionalPropertyTypes": true, + "noUnusedLocals": true + } +} diff --git a/packages/documentation/src/app/getting-started/quick-start/page.mdx b/packages/documentation/src/app/getting-started/quick-start/page.mdx index a2672bee9..ea8a16ce5 100644 --- a/packages/documentation/src/app/getting-started/quick-start/page.mdx +++ b/packages/documentation/src/app/getting-started/quick-start/page.mdx @@ -14,7 +14,12 @@ Cross-file references are also supported, so don't worry about pre-processing th You can check the version we develop and test against [here](https://github.com/mnahkies/openapi-code-generator/blob/main/.github/workflows/ci.yml#L17). -Fetch Client,

Axios Client

,

Koa Server

]}> +Fetch Client, +

Axios Client

, +

Koa Server

, +

Express Server

, +]}> {

Install dependencies

} @@ -24,7 +29,8 @@ You can check the version we develop and test against [here](https://github.com/ npm i @nahkies/typescript-fetch-runtime ``` - You could also install the CLI globally if you prefer, but it's best to version it per project. + You could also run the cli through `npx`, or install it globally if you prefer, but it's recommended to pin its + version as a `devDependency` per project. {

Run generation

} This will generate the client to `./src/generated/clients/some-service` @@ -40,7 +46,7 @@ You can check the version we develop and test against [here](https://github.com/ Use your new type-safe client, and never worry about making a typo in a url or parameter name again. Let the typescript compiler take care of checking that for you. - See [Guide to typescript-fetch client template](../guides/client-templates/typescript-fetch) for more details. + See [Guide to typescript-fetch client template](/guides/client-templates/typescript-fetch) for more details.
@@ -52,7 +58,9 @@ You can check the version we develop and test against [here](https://github.com/ npm i --dev @nahkies/openapi-code-generator npm i axios @nahkies/typescript-axios-runtime ``` - You could also install the CLI globally if you prefer, but it's best to version it per project. + + You could also run the cli through `npx`, or install it globally if you prefer, but it's recommended to pin its + version as a `devDependency` per project. {

Run generation

} This will generate the client to `./src/generated/clients/some-service` @@ -69,7 +77,7 @@ You can check the version we develop and test against [here](https://github.com/ Use your new type-safe client, and never worry about making a typo in a url or parameter name again. Let the typescript compiler take care of checking that for you. - See [Guide to typescript-axios client template](../guides/client-templates/typescript-axios) for more details. + See [Guide to typescript-axios client template](/guides/client-templates/typescript-axios) for more details. @@ -81,7 +89,9 @@ You can check the version we develop and test against [here](https://github.com/ npm i --dev @nahkies/openapi-code-generator @types/koa @types/koa__router npm i @nahkies/typescript-koa-runtime @koa/cors @koa/router koa koa-body zod ``` - You could also install the CLI globally if you prefer, but it's best to version it per project. + + You could also run the cli through `npx`, or install it globally if you prefer, but it's recommended to pin its + version as a `devDependency` per project. You can provide either a local file path or url for the input file. @@ -100,7 +110,40 @@ You can check the version we develop and test against [here](https://github.com/ By default the runtime validation is using zod. - See [Guide to typescript-koa client template](../guides/server-templates/typescript-koa) for more details. + See [Guide to typescript-koa client template](/guides/server-templates/typescript-koa) for more details. + + + + + + {

Install dependencies

} + First install the CLI and the required runtime packages to your project: + ```sh npm2yarn + npm i --dev @nahkies/openapi-code-generator @types/express + npm i @nahkies/typescript-express-runtime express zod + ``` + + You could also run the cli through `npx`, or install it globally if you prefer, but it's recommended to pin its + version as a `devDependency` per project. + + You can provide either a local file path or url for the input file. + + {

Run generation

} + This will generate the server router and validation logic to `./src/generated` + ```sh npm2yarn + npm run openapi-code-generator \ + --input ./openapi.yaml \ # or https://example.com/openapi.{json,yaml} + --output ./src/generated \ + --template typescript-express + ``` + + {

Profit

} + Implement handlers for your server, and be confident that they match what the client expects. Everything + will be strongly typed, so typos are surfaced at development time, not runtime. + + By default the runtime validation is using zod. + + See [Guide to typescript-express client template](/guides/server-templates/typescript-express) for more details.
diff --git a/packages/documentation/src/app/guides/server-templates/typescript-express/page.mdx b/packages/documentation/src/app/guides/server-templates/typescript-express/page.mdx new file mode 100644 index 000000000..6f0e87a4c --- /dev/null +++ b/packages/documentation/src/app/guides/server-templates/typescript-express/page.mdx @@ -0,0 +1,220 @@ +--- +title: typescript-express +--- + +import {Tabs} from 'nextra/components' + +# Using the `typescript-express` template +The `typescript-express` template outputs scaffolding code that handles the following: + +- Building an express [Router](https://expressjs.com/en/5x/api.html#express.router) instance with all routes in the openapi specification +- Generating typescript types and runtime schema parsers for all request parameters/bodies and response bodies, using [zod](https://zod.dev/) or [joi](https://joi.dev/) +- Generating types for route implementations that receive strongly typed, runtime validated inputs and outputs +- (Optionally) Actually starting the server and binding to a port + +See [integration-tests/typescript-express](https://github.com/mnahkies/openapi-code-generator/tree/main/integration-tests/typescript-express) for more samples. + + +### Install dependencies +First install the CLI and the required runtime packages to your project: +```sh npm2yarn +npm i --dev @nahkies/openapi-code-generator @types/express +npm i @nahkies/typescript-express-runtime express zod +``` + +See also [quick start](../../getting-started/quick-start) guide + +### Run generation + + + + ```sh npm2yarn + npm run openapi-code-generator \ + --input ./openapi.yaml \ + --input-type openapi3 \ + --output ./src/generated \ + --template typescript-express \ + --schema-builder zod + ``` + + + ```sh npm2yarn + npm run openapi-code-generator \ + --input ./typespec.tsp \ + --input-type typespec \ + --output ./src/generated \ + --template typescript-express \ + --schema-builder zod + ``` + + + + +### Using the generated code +Running the above will output three files into `./src/generated`: + +- `generated.ts` - exports a `createRouter` and `bootstrap` function, along with associated types used to create your server +- `models.ts` - exports typescript types for schemas +- `schemas.ts` - exports runtime schema validators + +Once generated usage should look something like this: + +```typescript +import {bootstrap, createRouter, CreateTodoList, GetTodoLists} from "../generated" + +// Define your route implementations as async functions implementing the types +// exported from generated.ts +const createTodoList: CreateTodoList = async ({body}, respond) => { + const list = await prisma.todoList.create({ + data: { + // body is strongly typed and parsed at runtime + name: body.name, + }, + }) + + // the `respond` parameter is a strongly typed response builder that pattern matches status codes + // to the expected response schema. + // the response body is validated against the response schema/status code at runtime + return respond.with200().body(dbListToApiList(list)) +} + +const getTodoLists: GetTodoLists = async ({query}) => { + // omitted for brevity +} + +// Starts a server listening on `port` +bootstrap({ + router: createRouter({getTodoLists, createTodoList}), + port: 8080, +}) +``` + +### Multiple routers +By default, a single router is generated, but for larger API surfaces this can become unwieldy. + +You can split the generated routers by using the [--grouping-strategy](/reference/cli-options#--grouping-strategy-value-experimental) +option to control the strategy to use for splitting output into separate files. Set to none for a single generated.ts file, one of: + +- none: don’t split output, yield single generated.ts (default) +- first-tag: group operations based on their first tag +- first-slug: group operations based on their first route slug/segment + +This can help to organize your codebase and separate concerns. + +### Custom Express app + +The provided `bootstrap` function has a limited range of options. For more advanced use-cases, +such as `https` you will need to construct your own Express `app`, and mount the router returned by `createRouter`. + +The only real requirement is that you provide body parsing middleware mounted before the `router` that places +a parsed request body on the `req.body` property. + +Eg: +```typescript +import {createRouter, CreateTodoList, GetTodoLists} from "../generated" + +import express from "express" +import https from "https" +import fs from "fs" + +const createTodoList: CreateTodoList = async ({body}, respond) => { /*omitted for brevity*/ } +const getTodoLists: GetTodoLists = async ({query}, respond) => { /*omitted for brevity*/ } + +const app = express() + +// mount middleware to parse JSON request bodies onto `req.body` +app.use(express.json()) + +// mount the generated router with our handler implementations injected +const router = createRouter({getTodoLists, createTodoList}) +app.use(router) + +// create the HTTPS server using the express app +https + .createServer( + { + key: fs.readFileSync("path/to/key.pem"), + cert: fs.readFileSync("path/to/cert.pem"), + }, + app + ) + .listen(433) +``` + +### Error Handling + +Any errors thrown during the request processing will be wrapped in `ExpressRuntimeError` objects, +and tagged with the `phase` the error was thrown. + +```typescript +class ExpressRuntimeError extends Error { + cause: unknown // the originally thrown exception + phase: "request_validation" | "request_handler" | "response_validation" +} +``` + +This allows for implementing catch-all error middleware for common concerns like failed request validation, +or internal server errors. + +Eg: +```typescript +import {ExpressRuntimeError} from "@nahkies/typescript-express-runtime/errors" +import {Request, Response, NextFunction} from "express" + +export async function genericErrorMiddleware(err: Error, req: Request, res: Response, next: NextFunction) { + if (res.headersSent) { + return next(err) + } + + // if the request validation failed, return a 400 and include helpful + // information about the problem + if (ExpressRuntimeError.isExpressError(err) && err.phase === "request_validation") { + res.status(400).json({ + message: "request validation failed", + meta: err.cause instanceof ZodError ? {issues: err.cause.issues} : {}, + }) + return + } + + // return a 500 and omit information from the response otherwise + logger.error("internal server error", err) + res.status(500).json({ + message: "internal server error", + }) +} +``` + +You can configure the error handler through the `bootstrap` function using the `errorHandler` argument, +or simplify mount directly to the express `app` yourself. + +### Escape Hatches - raw `req` / `res` handling +For most JSON based API's you shouldn't need to reach for this, but there are sometime situations where the +code generation tooling doesn't support something you need (see also [roadmap](/overview/roadmap) / [compatibility](/overview/compatibility)). + +Eg: response headers are not yet supported. + +To account for these situations, we pass the raw express `req`, `res` and `next` objects to your handler implementations, +allowing you full control where its needed. +```typescript +const createTodoList: CreateTodoList = async ({body}, respond, req, res, next) => { + res.setHeader("x-ratelimit-remaining", "100") + // ...your implementation + return respond.with200().body({ /* ... */ }) + } +``` + +It's also possible to skip response processing if needed by returning `SkipResponse` from your implementation. +This allows you take complete control of the response. +```typescript +import {SkipResponse} from '@nahkies/typescript-express-runtime/server' + +const getProfileImage: GetProfileImage = async ({body}, respond, req, res, next) => { + res.setHeader("x-ratelimit-remaining", "100") + res.status(200).send(Buffer.from([/*some binary file*/])) + + return SkipResponse + } +``` + +It should be seldom that these escape hatches are required, and overtime fewer and fewer situations will +require them. diff --git a/packages/documentation/src/app/overview/about/page.mdx b/packages/documentation/src/app/overview/about/page.mdx index 50c4acdf7..a9c09c9a1 100644 --- a/packages/documentation/src/app/overview/about/page.mdx +++ b/packages/documentation/src/app/overview/about/page.mdx @@ -24,7 +24,8 @@ make the generated clients feel idiomatic, and as close to handwritten as possib Server templates handle the routing setup, request and response validation/serialization so that you can focus on the business logic. -- [typescript-koa](../guides/server-templates/typescript-koa) +- [typescript-express](/guides/server-templates/typescript-express) +- [typescript-koa](/guides/server-templates/typescript-koa) ### Client SDK Templates Client templates give you a strongly typed interface to your remote server calls, ensuring that you diff --git a/packages/documentation/src/app/overview/roadmap/page.mdx b/packages/documentation/src/app/overview/roadmap/page.mdx index 2b404c270..5fe03bf3a 100644 --- a/packages/documentation/src/app/overview/roadmap/page.mdx +++ b/packages/documentation/src/app/overview/roadmap/page.mdx @@ -76,18 +76,6 @@ These are items that are nice to have, but generally not breaking and therefore release. There's a decent chance that many of these will beat a v1 release still. - ### Implement a `typescript-express` template - - [express](https://www.npmjs.com/package/express) is probably still the most popular - web framework for nodejs, with approximately 10x more weekly downloads than `koa` - - It's also pretty similar in design to `koa`, and so it should low-effort to add a - template for it. - - This would be beneficial in terms of making the project useful to a wider userbase, - but also be a forcing function to tidy up the koa template code, and abstract it in - a similar way to the client templates are. - ### Support custom serialization/deserialization Sometimes you want to serialize or deserialize objects in a custom way. Good examples diff --git a/packages/documentation/src/app/reference/cli-options/page.mdx b/packages/documentation/src/app/reference/cli-options/page.mdx index 34d5dd8b2..439ebeebe 100644 --- a/packages/documentation/src/app/reference/cli-options/page.mdx +++ b/packages/documentation/src/app/reference/cli-options/page.mdx @@ -37,6 +37,7 @@ directory to output generated code (env: ) As environment variable `OPENAPI_TEMPLATE` Which template you wish to generate, one of: +- [typescript-express](../guides/server-templates/typescript-express) - [typescript-koa](../guides/server-templates/typescript-koa) - [typescript-fetch](../guides/client-templates/typescript-fetch) - [typescript-axios](../guides/client-templates/typescript-axios) diff --git a/packages/documentation/src/lib/playground/load-runtime-types.tsx b/packages/documentation/src/lib/playground/load-runtime-types.tsx index 4655a274f..11c5ef05a 100644 --- a/packages/documentation/src/lib/playground/load-runtime-types.tsx +++ b/packages/documentation/src/lib/playground/load-runtime-types.tsx @@ -19,7 +19,8 @@ export const loadRuntimeTypes = async ( | "typescript-angular" | "typescript-fetch" | "typescript-axios" - | "typescript-koa", + | "typescript-koa" + | "typescript-express", ) => { const fileRootPath = "file:///" @@ -92,6 +93,28 @@ export const loadRuntimeTypes = async ( path: "/node_modules/@nahkies/typescript-koa-runtime/joi.d.ts", }, ], + "typescript-express": [ + { + uri: "https://unpkg.com/@nahkies/typescript-express-runtime@latest/package.json", + path: "/node_modules/@nahkies/typescript-express-runtime/package.json", + }, + { + uri: "https://unpkg.com/@nahkies/typescript-koa-runtime@latest/dist/server.d.ts", + path: "/node_modules/@nahkies/typescript-koa-runtime/server.d.ts", + }, + { + uri: "https://unpkg.com/@nahkies/typescript-koa-runtime@latest/dist/errors.d.ts", + path: "/node_modules/@nahkies/typescript-koa-runtime/errors.d.ts", + }, + { + uri: "https://unpkg.com/@nahkies/typescript-express-runtime@latest/dist/zod.d.ts", + path: "/node_modules/@nahkies/typescript-express-runtime/zod.d.ts", + }, + { + uri: "https://unpkg.com/@nahkies/typescript-express-runtime@latest/dist/joi.d.ts", + path: "/node_modules/@nahkies/typescript-express-runtime/joi.d.ts", + }, + ], } for (const file of files[template]) { diff --git a/packages/openapi-code-generator/package.json b/packages/openapi-code-generator/package.json index 65363efa9..8475f83b4 100644 --- a/packages/openapi-code-generator/package.json +++ b/packages/openapi-code-generator/package.json @@ -101,12 +101,14 @@ "openapi", "openapi3", "typespec", - "zod", "typescript", + "zod", + "api", "sdk", "generator", "codegen", "koa", + "express", "fetch", "axios", "angular" diff --git a/packages/openapi-code-generator/src/cli.ts b/packages/openapi-code-generator/src/cli.ts index c4adafb23..4cb463f59 100644 --- a/packages/openapi-code-generator/src/cli.ts +++ b/packages/openapi-code-generator/src/cli.ts @@ -18,7 +18,7 @@ import {logger} from "./core/logger" import {OpenapiValidator} from "./core/openapi-validator" import type {IdentifierConvention} from "./core/utils" import {configSchema, generate} from "./index" -import type {templates} from "./templates" +import {templateNames, templates} from "./templates" import type {ServerImplementationMethod} from "./templates.types" import {TypescriptFormatterBiome} from "./typescript/common/typescript-formatter.biome" @@ -87,12 +87,7 @@ const program = new Command() .addOption( new Option("-t --template ", "template to use") .env("OPENAPI_TEMPLATE") - .choices([ - "typescript-koa", - "typescript-axios", - "typescript-fetch", - "typescript-angular", - ] as const satisfies Readonly>) + .choices(templateNames) .makeOptionMandatory(), ) .addOption( diff --git a/packages/openapi-code-generator/src/config.ts b/packages/openapi-code-generator/src/config.ts index c841f3427..cc32f9f2d 100644 --- a/packages/openapi-code-generator/src/config.ts +++ b/packages/openapi-code-generator/src/config.ts @@ -3,6 +3,7 @@ import type {GenericLoaderRequestHeaders} from "./core/loaders/generic.loader" import type {CompilerOptions} from "./core/loaders/tsconfig.loader" import {tsconfigSchema} from "./core/schemas/tsconfig.schema" import type {IdentifierConvention} from "./core/utils" +import {templateNames} from "./templates" import type {ServerImplementationMethod} from "./templates.types" export type Config = { @@ -15,6 +16,7 @@ export type Config = { | "typescript-axios" | "typescript-angular" | "typescript-koa" + | "typescript-express" schemaBuilder: "zod" | "joi" enableRuntimeResponseValidation: boolean enableTypedBasePaths: boolean @@ -29,12 +31,7 @@ export type Config = { remoteSpecRequestHeaders?: GenericLoaderRequestHeaders | undefined } -const templatesSchema = z.enum([ - "typescript-koa", - "typescript-fetch", - "typescript-axios", - "typescript-angular", -]) +const templatesSchema = z.enum(templateNames) const schemaBuilderSchema = z.enum(["zod", "joi"]) diff --git a/packages/openapi-code-generator/src/templates.ts b/packages/openapi-code-generator/src/templates.ts index da932ea7d..2c5d59355 100644 --- a/packages/openapi-code-generator/src/templates.ts +++ b/packages/openapi-code-generator/src/templates.ts @@ -2,6 +2,7 @@ import type {OpenapiGenerator} from "./templates.types" import {generateTypescriptAngular} from "./typescript/client/typescript-angular/typescript-angular.generator" import {generateTypescriptAxios} from "./typescript/client/typescript-axios/typescript-axios.generator" import {generateTypescriptFetch} from "./typescript/client/typescript-fetch/typescript-fetch.generator" +import {generateTypescriptExpress} from "./typescript/server/typescript-express/typescript-express.generator" import {generateTypescriptKoa} from "./typescript/server/typescript-koa/typescript-koa.generator" export const templates = { @@ -25,4 +26,17 @@ export const templates = { type: "server", run: generateTypescriptKoa, }, + "typescript-express": { + language: "typescript", + type: "server", + run: generateTypescriptExpress, + }, } satisfies {[key: string]: OpenapiGenerator} + +export const templateNames = [ + "typescript-fetch", + "typescript-axios", + "typescript-angular", + "typescript-koa", + "typescript-express", +] as const satisfies Array diff --git a/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express-router-builder.ts b/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express-router-builder.ts new file mode 100644 index 000000000..46f1607aa --- /dev/null +++ b/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express-router-builder.ts @@ -0,0 +1,250 @@ +import type {Input} from "../../../core/input" +import {isDefined, titleCase} from "../../../core/utils" +import type {ServerImplementationMethod} from "../../../templates.types" +import type {ImportBuilder} from "../../common/import-builder" +import {JoiBuilder} from "../../common/schema-builders/joi-schema-builder" +import type {SchemaBuilder} from "../../common/schema-builders/schema-builder" +import {ZodBuilder} from "../../common/schema-builders/zod-schema-builder" +import type {TypeBuilder} from "../../common/type-builder" +import {constStatement, object} from "../../common/type-utils" +import { + buildExport, + routeToTemplateString, +} from "../../common/typescript-common" +import { + AbstractRouterBuilder, + type ServerSymbols, +} from "../abstract-router-builder" +import type {ServerOperationBuilder} from "../server-operation-builder" + +export class ExpressRouterBuilder extends AbstractRouterBuilder { + private readonly operationTypes: { + operationId: string + statements: string[] + }[] = [] + + constructor( + filename: string, + name: string, + input: Input, + imports: ImportBuilder, + types: TypeBuilder, + schemaBuilder: SchemaBuilder, + private readonly implementationMethod: ServerImplementationMethod, + ) { + super(filename, name, input, imports, types, schemaBuilder) + } + + protected buildImports(): void { + this.imports + .from("express") + .add("Router", "Request", "Response", "NextFunction") + + this.imports.from("express").all("express") + + this.imports + .from("@nahkies/typescript-express-runtime/server") + .add( + "ExpressRuntimeResponder", + "ExpressRuntimeResponse", + "Params", + "SkipResponse", + "StatusCode", + "StatusCode1xx", + "StatusCode2xx", + "StatusCode3xx", + "StatusCode4xx", + "StatusCode5xx", + ) + + this.imports + .from("@nahkies/typescript-express-runtime/errors") + .add("ExpressRuntimeError", "RequestInputType") + + if (this.schemaBuilder instanceof ZodBuilder) { + this.imports + .from("@nahkies/typescript-express-runtime/zod") + .add("parseRequestInput", "responseValidationFactory") + } else if (this.schemaBuilder instanceof JoiBuilder) { + this.imports + .from("@nahkies/typescript-express-runtime/joi") + .add("parseRequestInput", "responseValidationFactory") + } + } + + protected buildOperation(builder: ServerOperationBuilder): string { + const statements: string[] = [] + + const symbols = this.operationSymbols(builder.operationId) + const params = builder.parameters(symbols) + + if (params.path.schema) { + statements.push(constStatement(symbols.paramSchema, params.path.schema)) + } + if (params.query.schema) { + statements.push(constStatement(symbols.querySchema, params.query.schema)) + } + if (params.header.schema) { + statements.push( + constStatement(symbols.requestHeaderSchema, params.header.schema), + ) + } + if (params.body.schema) { + statements.push( + constStatement(symbols.requestBodySchema, params.body.schema), + ) + } + + const responder = builder.responder( + "ExpressRuntimeResponder", + "ExpressRuntimeResponse", + ) + + this.operationTypes.push({ + operationId: builder.operationId, + statements: [ + buildExport({ + name: symbols.responderName, + value: responder.type, + kind: "type", + }), + buildExport({ + name: symbols.implTypeName, + value: `( + params: ${params.type}, + respond: ${symbols.responderName}, + req: Request, + res: Response, + next: NextFunction + ) => Promise | typeof SkipResponse>`, + kind: "type", + }), + ], + }) + + statements.push(` +const ${symbols.responseBodyValidator} = ${builder.responseValidator()} + +// ${builder.operationId} +router.${builder.method.toLowerCase()}(\`${route(builder.route)}\`, async (req: Request, res: Response, next: NextFunction) => { + try { + const input = { + params: ${params.path.schema ? `parseRequestInput(${symbols.paramSchema}, req.params, RequestInputType.RouteParam)` : "undefined"}, + query: ${params.query.schema ? `parseRequestInput(${symbols.querySchema}, req.query, RequestInputType.QueryString)` : "undefined"}, + body: ${params.body.schema ? `parseRequestInput(${symbols.requestBodySchema}, req.body, RequestInputType.RequestBody)` : "undefined"}, + headers: ${params.header.schema ? `parseRequestInput(${symbols.requestHeaderSchema}, req.headers, RequestInputType.RequestHeader)` : "undefined"} + } + + const responder = ${responder.implementation} + + const response = await implementation.${symbols.implPropName}(input, responder, req, res, next) + .catch(err => { throw ExpressRuntimeError.HandlerError(err) }) + + // escape hatch to allow responses to be sent by the implementation handler + if(response === SkipResponse) { + return + } + + const { status, body } = response instanceof ExpressRuntimeResponse ? response.unpack() : response + + res.status(status) + + if (body !== undefined) { + res.json(${symbols.responseBodyValidator}(status, body)) + } else { + res.end() + } + } catch (error) { + next(error) + } +}) +`) + return statements.join("\n\n") + } + + protected buildRouter(routerName: string, statements: string[]): string { + const moduleName = titleCase(routerName) + const implementationExportName = `${moduleName}Implementation` + const createRouterExportName = `create${moduleName}Router` + + return ` +${this.operationTypes.flatMap((it) => it.statements).join("\n\n")} + +${this.implementationExport(implementationExportName)} + +export function ${createRouterExportName}(implementation: ${implementationExportName}): Router { + const router = Router() + + ${statements.join("\n\n")} + + return router +} + +${ + moduleName && + ` +export {${createRouterExportName} as createRouter} +export ${this.implementationMethod === "type" || this.implementationMethod === "interface" ? "type" : ""} {${implementationExportName} as Implementation} +` +} +` + } + + implementationExport(name: string): string { + switch (this.implementationMethod) { + case "type": + case "interface": { + return buildExport({ + name, + value: object( + this.operationTypes + .map((it) => this.operationSymbols(it.operationId)) + .map((it) => `${it.implPropName}: ${it.implTypeName}`) + .join(","), + ), + kind: this.implementationMethod, + }) + } + + case "abstract-class": { + return buildExport({ + name, + value: object( + this.operationTypes + .map((it) => this.operationSymbols(it.operationId)) + .map((it) => `abstract ${it.implPropName}: ${it.implTypeName}`) + .join("\n"), + ), + kind: "abstract-class", + }) + } + + default: { + throw new Error( + `server implementation method '${this.implementationMethod}' is not supported`, + ) + } + } + } + + protected operationSymbols(operationId: string): ServerSymbols { + return { + implPropName: operationId, + implTypeName: titleCase(operationId), + responderName: `${titleCase(operationId)}Responder`, + paramSchema: `${operationId}ParamSchema`, + querySchema: `${operationId}QuerySchema`, + requestBodySchema: `${operationId}RequestBodySchema`, + requestHeaderSchema: `${operationId}RequestHeaderSchema`, + responseBodyValidator: `${operationId}ResponseBodyValidator`, + } + } +} + +function route(route: string): string { + const placeholder = /{([^{}]+)}/g + + return Array.from(route.matchAll(placeholder)).reduce((result, match) => { + return result.replace(match[0], `:${match[1]}`) + }, route) +} diff --git a/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express-server-builder.ts b/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express-server-builder.ts new file mode 100644 index 000000000..466ec8689 --- /dev/null +++ b/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express-server-builder.ts @@ -0,0 +1,29 @@ +import type {Input} from "../../../core/input" +import {CompilationUnit, type ICompilable} from "../../common/compilation-units" +import {ImportBuilder} from "../../common/import-builder" + +export class ExpressServerBuilder implements ICompilable { + constructor( + private readonly filename: string, + private readonly name: string, + private readonly input: Input, + private readonly imports: ImportBuilder = new ImportBuilder(), + ) { + this.imports + .from("@nahkies/typescript-express-runtime/server") + .add("startServer", "ServerConfig") + } + + toString(): string { + return ` + export async function bootstrap(config: ServerConfig) { + // ${this.name} + return startServer(config) + } + ` + } + + toCompilationUnit(): CompilationUnit { + return new CompilationUnit(this.filename, this.imports, this.toString()) + } +} diff --git a/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express.generator.ts b/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express.generator.ts new file mode 100644 index 000000000..d24b0efe2 --- /dev/null +++ b/packages/openapi-code-generator/src/typescript/server/typescript-express/typescript-express.generator.ts @@ -0,0 +1,85 @@ +// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy +import path from "path" +import {normalizeFilename} from "../../../core/utils" +import type {OpenapiTypescriptGeneratorConfig} from "../../../templates.types" +import {CompilationUnit} from "../../common/compilation-units" +import {ImportBuilder} from "../../common/import-builder" +import type {SchemaBuilderType} from "../../common/schema-builders/schema-builder" +import {schemaBuilderFactory} from "../../common/schema-builders/schema-builder" +import {TypeBuilder} from "../../common/type-builder" +import {ExpressRouterBuilder} from "./typescript-express-router-builder" +import {ExpressServerBuilder} from "./typescript-express-server-builder" + +export async function generateTypescriptExpress( + config: OpenapiTypescriptGeneratorConfig, +): Promise { + const {input, emitter, allowAny} = config + + const routesDirectory = + config.groupingStrategy === "none" ? "./" : "./routes/" + + const rootTypeBuilder = await TypeBuilder.fromInput( + "./models.ts", + input, + config.compilerOptions, + {allowAny}, + ) + + const rootSchemaBuilder = await schemaBuilderFactory( + "./schemas.ts", + input, + config.schemaBuilder, + {allowAny}, + ) + + const server = new ExpressServerBuilder( + "index.ts", + input.name(), + input, + new ImportBuilder(), + ) + + const routers = await Promise.all( + input.groupedOperations(config.groupingStrategy).map(async (group) => { + const filename = normalizeFilename( + `${path.join(routesDirectory, group.name)}.ts`, + config.filenameConvention, + ) + const imports = new ImportBuilder({filename}) + + // Create router with imports and types + const routerBuilder = new ExpressRouterBuilder( + filename, + group.name, + input, + imports, + rootTypeBuilder.withImports(imports), + rootSchemaBuilder.withImports(imports), + config.serverImplementationMethod, + ) + + // biome-ignore lint/complexity/noForEach: + group.operations.forEach((it) => routerBuilder.add(it)) + return routerBuilder.toCompilationUnit() + }), + ) + + if (config.groupingStrategy === "none") { + await emitter.emitGenerationResult([ + CompilationUnit.merge( + "./generated.ts", + ...routers, + server.toCompilationUnit(), + ), + rootTypeBuilder.toCompilationUnit(), + rootSchemaBuilder.toCompilationUnit(), + ]) + } else { + await emitter.emitGenerationResult([ + server.toCompilationUnit(), + ...routers, + rootTypeBuilder.toCompilationUnit(), + rootSchemaBuilder.toCompilationUnit(), + ]) + } +} diff --git a/packages/typescript-express-runtime/README.md b/packages/typescript-express-runtime/README.md new file mode 100644 index 000000000..620014270 --- /dev/null +++ b/packages/typescript-express-runtime/README.md @@ -0,0 +1,10 @@ +# @nahkies/typescript-express-runtime + +[![CI/CD](https://github.com/mnahkies/openapi-code-generator/actions/workflows/ci.yml/badge.svg)](https://github.com/mnahkies/openapi-code-generator/actions?query=branch%3Amain+event%3Apush) +[![npm](https://img.shields.io/npm/dm/%40nahkies%2Ftypescript-express-runtime.svg)](https://www.npmjs.com/package/@nahkies/typescript-express-runtime) + +This is a supporting package for code generated using [@nahkies/openapi-code-generator](https://www.npmjs.com/package/@nahkies/openapi-code-generator) using the Typescript Express server stubs template. + +You can [read the docs](https://openapi-code-generator.nahkies.co.nz/guides/server-templates/typescript-express) to find out more! + +It's not intended by be used standalone. Similar in spirit to [tslib](https://www.npmjs.com/package/tslib) diff --git a/packages/typescript-express-runtime/jest.config.js b/packages/typescript-express-runtime/jest.config.js new file mode 100644 index 000000000..e4604b03a --- /dev/null +++ b/packages/typescript-express-runtime/jest.config.js @@ -0,0 +1,12 @@ +const base = require("../../jest.base") +const {name: displayName} = require("./package.json") + +/** + * @type { import('@jest/types').Config.ProjectConfig } + */ +const config = { + ...base, + displayName, +} + +module.exports = config diff --git a/packages/typescript-express-runtime/package.json b/packages/typescript-express-runtime/package.json new file mode 100644 index 000000000..482738565 --- /dev/null +++ b/packages/typescript-express-runtime/package.json @@ -0,0 +1,88 @@ +{ + "name": "@nahkies/typescript-express-runtime", + "version": "0.19.2", + "description": "Runtime package for code generated by @nahkies/openapi-code-generator using the typescript-express template", + "license": "MIT", + "author": { + "name": "Michael Nahkies", + "email": "support@nahkies.co.nz" + }, + "homepage": "https://openapi-code-generator.nahkies.co.nz/", + "repository": { + "type": "git", + "url": "https://github.com/mnahkies/openapi-code-generator.git", + "directory": "packages/typescript-express-runtime" + }, + "bugs": { + "url": "https://github.com/mnahkies/openapi-code-generator/issues" + }, + "exports": { + "./errors": { + "require": "./dist/errors.js", + "import": "./dist/errors.js", + "types": "./dist/errors.d.ts" + }, + "./server": { + "require": "./dist/server.js", + "import": "./dist/server.js", + "types": "./dist/server.d.ts" + }, + "./joi": { + "require": "./dist/joi.js", + "import": "./dist/joi.js", + "types": "./dist/joi.d.ts" + }, + "./zod": { + "require": "./dist/zod.js", + "import": "./dist/zod.js", + "types": "./dist/zod.d.ts" + } + }, + "scripts": { + "clean": "rm -rf ./dist", + "dev": "nodemon --watch ./src -e ts --delay 2 --exec 'yarn build'", + "build": "tsc -p ./tsconfig.json", + "test": "jest" + }, + "peerDependencies": { + "cors": "^2.8.5", + "express": "^5.1.0", + "joi": "^17.1.1", + "zod": "^3.20.6" + }, + "peerDependenciesMeta": { + "cors": { + "optional": true + }, + "joi": { + "optional": true + }, + "zod": { + "optional": true + } + }, + "devDependencies": { + "@types/express": "^5.0.1", + "jest": "^30.0.0-alpha.6", + "joi": "^17.13.3", + "typescript": "~5.8.3", + "zod": "^3.24.3" + }, + "files": [ + "src", + "dist", + "README.md", + "CHANGELOG.md", + "tsconfig.json" + ], + "keywords": [ + "@nahkies/openapi-code-generator", + "runtime", + "typescript-express", + "express", + "zod" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/typescript-express-runtime/src/errors.ts b/packages/typescript-express-runtime/src/errors.ts new file mode 100644 index 000000000..fca31ce31 --- /dev/null +++ b/packages/typescript-express-runtime/src/errors.ts @@ -0,0 +1,50 @@ +export enum RequestInputType { + RouteParam = "route params", + QueryString = "querystring", + RequestBody = "request body", + RequestHeader = "request header", +} + +export class ExpressRuntimeError extends Error { + private constructor( + message: string, + cause: unknown, + public readonly phase: + | "request_validation" + | "request_handler" + | "response_validation", + ) { + super(message, {cause}) + } + + static RequestError( + cause: unknown, + inputType: RequestInputType, + ): ExpressRuntimeError { + return new ExpressRuntimeError( + `Request validation failed parsing ${inputType}`, + cause, + "request_validation", + ) + } + + static HandlerError(cause: unknown) { + return new ExpressRuntimeError( + "Request handler threw unhandled exception", + cause, + "request_handler", + ) + } + + static ResponseError(cause: unknown) { + return new ExpressRuntimeError( + "Response body failed validation", + cause, + "response_validation", + ) + } + + static isExpressError(err: unknown): err is ExpressRuntimeError { + return err instanceof ExpressRuntimeError + } +} diff --git a/packages/typescript-express-runtime/src/joi.ts b/packages/typescript-express-runtime/src/joi.ts new file mode 100644 index 000000000..9c68981bd --- /dev/null +++ b/packages/typescript-express-runtime/src/joi.ts @@ -0,0 +1,77 @@ +import type {Schema as JoiSchema} from "joi" +import {ExpressRuntimeError, type RequestInputType} from "./errors" + +// Note: joi types don't appear to have an equivalent of z.infer, +// hence any seems about as good as we can do here. +export function parseRequestInput( + schema: Schema, + input: unknown, + type: RequestInputType, + // biome-ignore lint/suspicious/noExplicitAny: +): any +export function parseRequestInput( + schema: undefined, + input: unknown, + type: RequestInputType, +): undefined +export function parseRequestInput( + schema: Schema | undefined, + input: unknown, + type: RequestInputType, + // biome-ignore lint/suspicious/noExplicitAny: +): any { + try { + if (!schema) { + return undefined + } + + const result = schema.validate(input, {stripUnknown: true}) + + if (result.error) { + throw result.error + } + + return result.value + } catch (err) { + throw ExpressRuntimeError.RequestError(err, type) + } +} + +export function responseValidationFactory( + possibleResponses: [string, JoiSchema][], + defaultResponse?: JoiSchema, +) { + // Exploit the natural ordering matching the desired specificity of eg: 404 vs 4xx + possibleResponses.sort((x, y) => (x[0] < y[0] ? -1 : 1)) + + return (status: number, value: unknown) => { + for (const [match, schema] of possibleResponses) { + const isMatch = + (/^\d+$/.test(match) && String(status) === match) || + (/^\d[xX]{2}$/.test(match) && String(status)[0] === match[0]) + + if (isMatch) { + const result = schema.validate(value) + + if (result.error) { + throw result.error + } + + return result.value + } + } + + // TODO: wrap thrown error. + if (defaultResponse) { + const result = defaultResponse.validate(value) + + if (result.error) { + throw result.error + } + + return result.value + } + + return value + } +} diff --git a/packages/typescript-express-runtime/src/server.ts b/packages/typescript-express-runtime/src/server.ts new file mode 100644 index 000000000..90bf6db57 --- /dev/null +++ b/packages/typescript-express-runtime/src/server.ts @@ -0,0 +1,198 @@ +import type {Server} from "node:http" +import type {ListenOptions} from "node:net" +import type {AddressInfo} from "node:net" + +import type {OptionsJson} from "body-parser" +import Cors, {type CorsOptions, type CorsOptionsDelegate} from "cors" +import express, { + type ErrorRequestHandler, + type Express, + type RequestHandler, + type Router, +} from "express" + +// from https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range +type Enumerate< + N extends number, + Acc extends number[] = [], +> = Acc["length"] extends N + ? Acc[number] + : Enumerate + +type IntRange = F extends T + ? F + : Exclude, Enumerate> extends never + ? never + : Exclude, Enumerate> | T + +export type StatusCode1xx = IntRange<100, 199> // `1${number}${number}` +export type StatusCode2xx = IntRange<200, 299> // `2${number}${number}` +export type StatusCode3xx = IntRange<300, 399> // `3${number}${number}` +export type StatusCode4xx = IntRange<400, 499> // `4${number}${number}` +export type StatusCode5xx = IntRange<500, 599> // `5${number}${number}` +export type StatusCode = + | StatusCode1xx + | StatusCode2xx + | StatusCode3xx + | StatusCode4xx + | StatusCode5xx + +export type Response = { + status: Status + body: Type +} + +export const SkipResponse = Symbol("skip response processing") + +export class ExpressRuntimeResponse { + private _body?: Type + + constructor(private readonly status: StatusCode) {} + + body(body: Type): this { + this._body = body + return this + } + + unpack(): Response { + return {status: this.status, body: this._body} + } +} + +export type ExpressRuntimeResponder< + Status extends StatusCode = StatusCode, + // biome-ignore lint/suspicious/noExplicitAny: + Type = any, +> = { + withStatus: (status: Status) => ExpressRuntimeResponse +} + +export type ServerConfig = { + /** + * set to "disabled" to disable cors middleware, omit or pass undefined for defaults + * + * by default, all origins are allowed. you probably don't want this in production, + * so it's strongly recommended to explicitly configure this. + **/ + cors?: "disabled" | CorsOptions | CorsOptionsDelegate | undefined + + /** + * set to "disabled" to disable body parsing middleware, omit or pass undefined for defaults. + * + * if disabling, ensure you pass a body parsing middleware that places the parsed + * body on `req.body` for request body processing to work. + **/ + body?: "disabled" | OptionsJson | undefined + + /** + * provide arbitrary express middleware to be mounted before all request handlers + * useful for mounting logging, alternative body parsers, etc + */ + middleware?: RequestHandler[] + + /** + * Provide a custom 404 handler + */ + notFoundHandler?: RequestHandler + + /** + * Provide a custom error handler + */ + errorHandler?: ErrorRequestHandler + + /** + * the router to use, normally obtained by calling the generated `createRouter` + * function + */ + router: Router + + /** + * the port to listen on, a randomly allocated port will be used if none passed + * alternatively ListenOptions can be passed to control the network interface + * bound to. + */ + port?: number | ListenOptions +} + +export type Params = { + params: Params + query: Query + body: Body + headers: Header +} + +/** + * Starts an Express server and listens on `port` or a randomly allocated port if none provided. + * Enables CORS and body parsing by default. It's recommended to customize the CORS options + * for production usage. + * + * If you need more control over your Express server you should avoid calling this function, + * and instead mount the router from your generated codes `createRouter` call directly + * onto a server you have constructed. + */ +export async function startServer({ + middleware = [], + cors = undefined, + body = undefined, + port = 0, + router, + notFoundHandler, + errorHandler, +}: ServerConfig): Promise<{ + app: Express + server: Server + address: AddressInfo +}> { + const app = express() + + if (cors !== "disabled") { + app.use(Cors(cors)) + app.options("*route", Cors(cors)) + } + + if (body !== "disabled") { + app.use(express.json(body)) + } + + if (middleware) { + for (const it of middleware) { + app.use(it) + } + } + + app.use(router) + + if (notFoundHandler) { + app.use(notFoundHandler) + } + + if (errorHandler) { + app.use(errorHandler) + } + + return new Promise((resolve, reject) => { + try { + const server = app.listen(port) + + server.once("listening", () => { + try { + const address = server.address() + + if (!address || typeof address !== "object") { + throw new Error("failed to bind port") + } + + resolve({app, server, address}) + } catch (err) { + reject(err) + } + }) + + server.once("error", (err) => { + reject(err) + }) + } catch (err) { + reject(err) + } + }) +} diff --git a/packages/typescript-express-runtime/src/zod.ts b/packages/typescript-express-runtime/src/zod.ts new file mode 100644 index 000000000..a86eb9825 --- /dev/null +++ b/packages/typescript-express-runtime/src/zod.ts @@ -0,0 +1,56 @@ +import type {z} from "zod" +import {ExpressRuntimeError, type RequestInputType} from "./errors" + +export function parseRequestInput( + schema: Schema, + input: unknown, + type: RequestInputType, +): z.infer +export function parseRequestInput( + schema: undefined, + input: unknown, + type: RequestInputType, +): undefined +export function parseRequestInput( + schema: Schema | undefined, + input: unknown, + type: RequestInputType, +): z.infer | undefined { + try { + return schema?.parse(input) + } catch (err) { + throw ExpressRuntimeError.RequestError(err, type) + } +} + +// TODO: optional response validation +export function responseValidationFactory( + possibleResponses: [string, z.ZodTypeAny][], + defaultResponse?: z.ZodTypeAny, +) { + // Exploit the natural ordering matching the desired specificity of eg: 404 vs 4xx + possibleResponses.sort((x, y) => (x[0] < y[0] ? -1 : 1)) + + return (status: number, value: unknown) => { + try { + for (const [match, schema] of possibleResponses) { + const isMatch = + (/^\d+$/.test(match) && String(status) === match) || + (/^\d[xX]{2}$/.test(match) && String(status)[0] === match[0]) + + if (isMatch) { + return schema.parse(value) + } + } + + if (defaultResponse) { + return defaultResponse.parse(value) + } + + // TODO: throw on unmatched response + return value + } catch (err) { + throw ExpressRuntimeError.ResponseError(err) + } + } +} diff --git a/packages/typescript-express-runtime/tsconfig.json b/packages/typescript-express-runtime/tsconfig.json new file mode 100644 index 000000000..76e65dcfb --- /dev/null +++ b/packages/typescript-express-runtime/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src" + }, + "include": ["src/**/*"], + "references": [] +} diff --git a/tsconfig.json b/tsconfig.json index 9b065904d..f3ac6ef0c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "references": [ { "path": "./packages/openapi-code-generator" }, { "path": "./packages/typescript-axios-runtime" }, + { "path": "./packages/typescript-express-runtime" }, { "path": "./packages/typescript-fetch-runtime" }, { "path": "./packages/typescript-koa-runtime" } ] diff --git a/yarn.lock b/yarn.lock index 017d6b0e0..66cbf47b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3885,6 +3885,30 @@ __metadata: languageName: unknown linkType: soft +"@nahkies/typescript-express-runtime@npm:*, @nahkies/typescript-express-runtime@workspace:packages/typescript-express-runtime": + version: 0.0.0-use.local + resolution: "@nahkies/typescript-express-runtime@workspace:packages/typescript-express-runtime" + dependencies: + "@types/express": "npm:^5.0.1" + jest: "npm:^30.0.0-alpha.6" + joi: "npm:^17.13.3" + typescript: "npm:~5.8.3" + zod: "npm:^3.24.3" + peerDependencies: + cors: ^2.8.5 + express: ^5.1.0 + joi: ^17.1.1 + zod: ^3.20.6 + peerDependenciesMeta: + cors: + optional: true + joi: + optional: true + zod: + optional: true + languageName: unknown + linkType: soft + "@nahkies/typescript-fetch-runtime@npm:*, @nahkies/typescript-fetch-runtime@workspace:packages/typescript-fetch-runtime": version: 0.0.0-use.local resolution: "@nahkies/typescript-fetch-runtime@workspace:packages/typescript-fetch-runtime" @@ -6437,7 +6461,7 @@ __metadata: languageName: node linkType: hard -"@types/express@npm:*": +"@types/express@npm:*, @types/express@npm:^5.0.1": version: 5.0.1 resolution: "@types/express@npm:5.0.1" dependencies: @@ -7214,6 +7238,16 @@ __metadata: languageName: node linkType: hard +"accepts@npm:^2.0.0": + version: 2.0.0 + resolution: "accepts@npm:2.0.0" + dependencies: + mime-types: "npm:^3.0.0" + negotiator: "npm:^1.0.0" + checksum: 10/ea1343992b40b2bfb3a3113fa9c3c2f918ba0f9197ae565c48d3f84d44b174f6b1d5cd9989decd7655963eb03a272abc36968cc439c2907f999bd5ef8653d5a7 + languageName: node + linkType: hard + "acorn-jsx@npm:^5.0.0": version: 5.3.2 resolution: "acorn-jsx@npm:5.3.2" @@ -7894,6 +7928,23 @@ __metadata: languageName: node linkType: hard +"body-parser@npm:^2.2.0": + version: 2.2.0 + resolution: "body-parser@npm:2.2.0" + dependencies: + bytes: "npm:^3.1.2" + content-type: "npm:^1.0.5" + debug: "npm:^4.4.0" + http-errors: "npm:^2.0.0" + iconv-lite: "npm:^0.6.3" + on-finished: "npm:^2.4.1" + qs: "npm:^6.14.0" + raw-body: "npm:^3.0.0" + type-is: "npm:^2.0.0" + checksum: 10/e9d844b036bd15970df00a16f373c7ed28e1ef870974a0a1d4d6ef60d70e01087cc20a0dbb2081c49a88e3c08ce1d87caf1e2898c615dffa193f63e8faa8a84e + languageName: node + linkType: hard + "bonjour-service@npm:^1.2.1": version: 1.3.0 resolution: "bonjour-service@npm:1.3.0" @@ -8109,7 +8160,7 @@ __metadata: languageName: node linkType: hard -"bytes@npm:3.1.2": +"bytes@npm:3.1.2, bytes@npm:^3.1.2": version: 3.1.2 resolution: "bytes@npm:3.1.2" checksum: 10/a10abf2ba70c784471d6b4f58778c0beeb2b5d405148e66affa91f23a9f13d07603d0a0354667310ae1d6dc141474ffd44e2a074be0f6e2254edb8fc21445388 @@ -8882,6 +8933,15 @@ __metadata: languageName: node linkType: hard +"content-disposition@npm:^1.0.0": + version: 1.0.0 + resolution: "content-disposition@npm:1.0.0" + dependencies: + safe-buffer: "npm:5.2.1" + checksum: 10/0dcc1a2d7874526b0072df3011b134857b49d97a3bc135bb464a299525d4972de6f5f464fd64da6c4d8406d26a1ffb976f62afaffef7723b1021a44498d10e08 + languageName: node + linkType: hard + "content-type@npm:^1.0.4, content-type@npm:^1.0.5, content-type@npm:~1.0.4, content-type@npm:~1.0.5": version: 1.0.5 resolution: "content-type@npm:1.0.5" @@ -9003,6 +9063,13 @@ __metadata: languageName: node linkType: hard +"cookie-signature@npm:^1.2.1": + version: 1.2.2 + resolution: "cookie-signature@npm:1.2.2" + checksum: 10/be44a3c9a56f3771aea3a8bd8ad8f0a8e2679bcb967478267f41a510b4eb5ec55085386ba79c706c4ac21605ca76f4251973444b90283e0eb3eeafe8a92c7708 + languageName: node + linkType: hard + "cookie@npm:0.7.1": version: 0.7.1 resolution: "cookie@npm:0.7.1" @@ -9010,7 +9077,7 @@ __metadata: languageName: node linkType: hard -"cookie@npm:~0.7.2": +"cookie@npm:^0.7.1, cookie@npm:~0.7.2": version: 0.7.2 resolution: "cookie@npm:0.7.2" checksum: 10/24b286c556420d4ba4e9bc09120c9d3db7d28ace2bd0f8ccee82422ce42322f73c8312441271e5eefafbead725980e5996cc02766dbb89a90ac7f5636ede608f @@ -9684,7 +9751,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.3.6, debug@npm:^4.4.0": +"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:^4.3.6, debug@npm:^4.4.0": version: 4.4.0 resolution: "debug@npm:4.4.0" dependencies: @@ -9857,7 +9924,7 @@ __metadata: languageName: node linkType: hard -"depd@npm:2.0.0, depd@npm:~2.0.0": +"depd@npm:2.0.0, depd@npm:^2.0.0, depd@npm:~2.0.0": version: 2.0.0 resolution: "depd@npm:2.0.0" checksum: 10/c0c8ff36079ce5ada64f46cc9d6fd47ebcf38241105b6e0c98f412e8ad91f084bcf906ff644cc3a4bd876ca27a62accb8b0fff72ea6ed1a414b89d8506f4a5ca @@ -10836,7 +10903,7 @@ __metadata: languageName: node linkType: hard -"etag@npm:~1.8.1": +"etag@npm:^1.8.1, etag@npm:~1.8.1": version: 1.8.1 resolution: "etag@npm:1.8.1" checksum: 10/571aeb3dbe0f2bbd4e4fadbdb44f325fc75335cd5f6f6b6a091e6a06a9f25ed5392f0863c5442acb0646787446e816f13cbfc6edce5b07658541dff573cab1ff @@ -11002,6 +11069,41 @@ __metadata: languageName: node linkType: hard +"express@npm:^5.1.0": + version: 5.1.0 + resolution: "express@npm:5.1.0" + dependencies: + accepts: "npm:^2.0.0" + body-parser: "npm:^2.2.0" + content-disposition: "npm:^1.0.0" + content-type: "npm:^1.0.5" + cookie: "npm:^0.7.1" + cookie-signature: "npm:^1.2.1" + debug: "npm:^4.4.0" + encodeurl: "npm:^2.0.0" + escape-html: "npm:^1.0.3" + etag: "npm:^1.8.1" + finalhandler: "npm:^2.1.0" + fresh: "npm:^2.0.0" + http-errors: "npm:^2.0.0" + merge-descriptors: "npm:^2.0.0" + mime-types: "npm:^3.0.0" + on-finished: "npm:^2.4.1" + once: "npm:^1.4.0" + parseurl: "npm:^1.3.3" + proxy-addr: "npm:^2.0.7" + qs: "npm:^6.14.0" + range-parser: "npm:^1.2.1" + router: "npm:^2.2.0" + send: "npm:^1.1.0" + serve-static: "npm:^2.2.0" + statuses: "npm:^2.0.1" + type-is: "npm:^2.0.1" + vary: "npm:^1.1.2" + checksum: 10/6dba00bbdf308f43a84ed3f07a7e9870d5208f2a0b8f60f39459dda089750379747819863fad250849d3c9163833f33f94ce69d73938df31e0c5a430800d7e56 + languageName: node + linkType: hard + "exsolve@npm:^1.0.1": version: 1.0.5 resolution: "exsolve@npm:1.0.5" @@ -11206,6 +11308,20 @@ __metadata: languageName: node linkType: hard +"finalhandler@npm:^2.1.0": + version: 2.1.0 + resolution: "finalhandler@npm:2.1.0" + dependencies: + debug: "npm:^4.4.0" + encodeurl: "npm:^2.0.0" + escape-html: "npm:^1.0.3" + on-finished: "npm:^2.4.1" + parseurl: "npm:^1.3.3" + statuses: "npm:^2.0.1" + checksum: 10/b2bd68c310e2c463df0ab747ab05f8defbc540b8c3f2442f86e7d084ac8acbc31f8cae079931b7f5a406521501941e3395e963de848a0aaf45dd414adeb5ff4e + languageName: node + linkType: hard + "find-cache-dir@npm:^3.3.1": version: 3.3.2 resolution: "find-cache-dir@npm:3.3.2" @@ -11370,6 +11486,13 @@ __metadata: languageName: node linkType: hard +"fresh@npm:^2.0.0": + version: 2.0.0 + resolution: "fresh@npm:2.0.0" + checksum: 10/44e1468488363074641991c1340d2a10c5a6f6d7c353d89fd161c49d120c58ebf9890720f7584f509058385836e3ce50ddb60e9f017315a4ba8c6c3461813bfc + languageName: node + linkType: hard + "front-matter@npm:^4.0.2": version: 4.0.2 resolution: "front-matter@npm:4.0.2" @@ -12396,7 +12519,7 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:0.6, iconv-lite@npm:^0.6.2, iconv-lite@npm:^0.6.3": +"iconv-lite@npm:0.6, iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2, iconv-lite@npm:^0.6.3": version: 0.6.3 resolution: "iconv-lite@npm:0.6.3" dependencies: @@ -12951,6 +13074,13 @@ __metadata: languageName: node linkType: hard +"is-promise@npm:^4.0.0": + version: 4.0.0 + resolution: "is-promise@npm:4.0.0" + checksum: 10/0b46517ad47b00b6358fd6553c83ec1f6ba9acd7ffb3d30a0bf519c5c69e7147c132430452351b8a9fc198f8dd6c4f76f8e6f5a7f100f8c77d57d9e0f4261a8a + languageName: node + linkType: hard + "is-regex@npm:^1.2.1": version: 1.2.1 resolution: "is-regex@npm:1.2.1" @@ -15150,6 +15280,13 @@ __metadata: languageName: node linkType: hard +"merge-descriptors@npm:^2.0.0": + version: 2.0.0 + resolution: "merge-descriptors@npm:2.0.0" + checksum: 10/e383332e700a94682d0125a36c8be761142a1320fc9feeb18e6e36647c9edf064271645f5669b2c21cf352116e561914fd8aa831b651f34db15ef4038c86696a + languageName: node + linkType: hard + "merge-stream@npm:^2.0.0": version: 2.0.0 resolution: "merge-stream@npm:2.0.0" @@ -15715,7 +15852,7 @@ __metadata: languageName: node linkType: hard -"mime-types@npm:^3.0.0": +"mime-types@npm:^3.0.0, mime-types@npm:^3.0.1": version: 3.0.1 resolution: "mime-types@npm:3.0.1" dependencies: @@ -17553,7 +17690,7 @@ __metadata: languageName: node linkType: hard -"parseurl@npm:^1.3.2, parseurl@npm:~1.3.2, parseurl@npm:~1.3.3": +"parseurl@npm:^1.3.2, parseurl@npm:^1.3.3, parseurl@npm:~1.3.2, parseurl@npm:~1.3.3": version: 1.3.3 resolution: "parseurl@npm:1.3.3" checksum: 10/407cee8e0a3a4c5cd472559bca8b6a45b82c124e9a4703302326e9ab60fc1081442ada4e02628efef1eb16197ddc7f8822f5a91fd7d7c86b51f530aedb17dfa2 @@ -17647,6 +17784,13 @@ __metadata: languageName: node linkType: hard +"path-to-regexp@npm:^8.0.0": + version: 8.2.0 + resolution: "path-to-regexp@npm:8.2.0" + checksum: 10/23378276a172b8ba5f5fb824475d1818ca5ccee7bbdb4674701616470f23a14e536c1db11da9c9e6d82b82c556a817bbf4eee6e41b9ed20090ef9427cbb38e13 + languageName: node + linkType: hard + "path-type@npm:^3.0.0": version: 3.0.0 resolution: "path-type@npm:3.0.0" @@ -18105,7 +18249,7 @@ __metadata: languageName: node linkType: hard -"proxy-addr@npm:~2.0.7": +"proxy-addr@npm:^2.0.7, proxy-addr@npm:~2.0.7": version: 2.0.7 resolution: "proxy-addr@npm:2.0.7" dependencies: @@ -18266,6 +18410,18 @@ __metadata: languageName: node linkType: hard +"raw-body@npm:^3.0.0": + version: 3.0.0 + resolution: "raw-body@npm:3.0.0" + dependencies: + bytes: "npm:3.1.2" + http-errors: "npm:2.0.0" + iconv-lite: "npm:0.6.3" + unpipe: "npm:1.0.0" + checksum: 10/2443429bbb2f9ae5c50d3d2a6c342533dfbde6b3173740b70fa0302b30914ff400c6d31a46b3ceacbe7d0925dc07d4413928278b494b04a65736fc17ca33e30c + languageName: node + linkType: hard + "react-compiler-runtime@npm:0.0.0-experimental-22c6e49-20241219": version: 0.0.0-experimental-22c6e49-20241219 resolution: "react-compiler-runtime@npm:0.0.0-experimental-22c6e49-20241219" @@ -19176,6 +19332,19 @@ __metadata: languageName: node linkType: hard +"router@npm:^2.2.0": + version: 2.2.0 + resolution: "router@npm:2.2.0" + dependencies: + debug: "npm:^4.4.0" + depd: "npm:^2.0.0" + is-promise: "npm:^4.0.0" + parseurl: "npm:^1.3.3" + path-to-regexp: "npm:^8.0.0" + checksum: 10/8949bd1d3da5403cc024e2989fee58d7fda0f3ffe9f2dc5b8a192f295f400b3cde307b0b554f7d44851077640f36962ca469a766b3d57410d7d96245a7ba6c91 + languageName: node + linkType: hard + "run-applescript@npm:^7.0.0": version: 7.0.0 resolution: "run-applescript@npm:7.0.0" @@ -19410,6 +19579,25 @@ __metadata: languageName: node linkType: hard +"send@npm:^1.1.0, send@npm:^1.2.0": + version: 1.2.0 + resolution: "send@npm:1.2.0" + dependencies: + debug: "npm:^4.3.5" + encodeurl: "npm:^2.0.0" + escape-html: "npm:^1.0.3" + etag: "npm:^1.8.1" + fresh: "npm:^2.0.0" + http-errors: "npm:^2.0.0" + mime-types: "npm:^3.0.1" + ms: "npm:^2.1.3" + on-finished: "npm:^2.4.1" + range-parser: "npm:^1.2.1" + statuses: "npm:^2.0.1" + checksum: 10/9fa3b1a3b9a06b7b4ab00c25e8228326d9665a9745753a34d1ffab8ac63c7c206727331d1dc5be73647f1b658d259a1aa8e275b0e0eee51349370af02e9da506 + languageName: node + linkType: hard + "serialize-javascript@npm:^6.0.2": version: 6.0.2 resolution: "serialize-javascript@npm:6.0.2" @@ -19446,6 +19634,18 @@ __metadata: languageName: node linkType: hard +"serve-static@npm:^2.2.0": + version: 2.2.0 + resolution: "serve-static@npm:2.2.0" + dependencies: + encodeurl: "npm:^2.0.0" + escape-html: "npm:^1.0.3" + parseurl: "npm:^1.3.3" + send: "npm:^1.2.0" + checksum: 10/9f1a900738c5bb02258275ce3bd1273379c4c3072b622e15d44e8f47d89a1ba2d639ec2d63b11c263ca936096b40758acb7a0d989cd6989018a65a12f9433ada + languageName: node + linkType: hard + "set-blocking@npm:^2.0.0": version: 2.0.0 resolution: "set-blocking@npm:2.0.0" @@ -20834,7 +21034,7 @@ __metadata: languageName: node linkType: hard -"type-is@npm:^2.0.1": +"type-is@npm:^2.0.0, type-is@npm:^2.0.1": version: 2.0.1 resolution: "type-is@npm:2.0.1" dependencies: @@ -20900,6 +21100,19 @@ __metadata: languageName: unknown linkType: soft +"typescript-express@workspace:integration-tests/typescript-express": + version: 0.0.0-use.local + resolution: "typescript-express@workspace:integration-tests/typescript-express" + dependencies: + "@nahkies/typescript-express-runtime": "npm:*" + "@types/express": "npm:^5.0.1" + express: "npm:^5.1.0" + joi: "npm:^17.13.3" + typescript: "npm:~5.8.3" + zod: "npm:^3.24.3" + languageName: unknown + linkType: soft + "typescript-fetch@workspace:integration-tests/typescript-fetch": version: 0.0.0-use.local resolution: "typescript-fetch@workspace:integration-tests/typescript-fetch"